formbridge / formbridge-bundle
Symfony forms as MCP tools, as forms a person completes inside the conversation (MCP Apps), and as tools for Symfony AI agents.
Package info
github.com/harivansh0/formbridge-bundle
Type:symfony-bundle
pkg:composer/formbridge/formbridge-bundle
Requires
- php: >=8.2
- mcp/sdk: ^0.9
- nyholm/psr7: ^1.8
- psr/cache: ^2.0|^3.0
- psr/container: ^1.1|^2.0
- psr/event-dispatcher: ^1.0
- psr/log: ^1.0|^2.0|^3.0
- symfony/cache: ^7.4|^8.0
- symfony/config: ^7.4|^8.0
- symfony/console: ^7.4|^8.0
- symfony/dependency-injection: ^7.4|^8.0
- symfony/event-dispatcher: ^7.4|^8.0
- symfony/form: ^7.4|^8.0
- symfony/framework-bundle: ^7.4|^8.0
- symfony/http-foundation: ^7.4|^8.0
- symfony/http-kernel: ^7.4|^8.0
- symfony/lock: ^7.4|^8.0
- symfony/mcp-bundle: ^1.0@beta
- symfony/routing: ^7.4|^8.0
- symfony/security-csrf: ^7.4|^8.0
- symfony/service-contracts: ^2.5|^3.0
- symfony/translation-contracts: ^2.5|^3.0
- symfony/twig-bundle: ^7.4|^8.0
- symfony/validator: ^7.4|^8.0
Requires (Dev)
- phpunit/phpunit: ^11.5|^12.0|^13.0
- symfony/ai-agent: ^1.0@beta
- symfony/ai-platform: ^1.0@beta
- symfony/browser-kit: ^7.4|^8.0
- symfony/css-selector: ^7.4|^8.0
- symfony/rate-limiter: ^7.4|^8.0
- symfony/translation: ^7.4|^8.0
Suggests
- symfony/ai-agent: With symfony/ai-bundle, to give the form tools to Symfony AI agents (form_bridge.agents)
- symfony/ai-platform: To fill forms in from free text with a model (form_bridge.fill)
- symfony/rate-limiter: To limit how often the "paste a message" page calls the model (form_bridge.fill.rate_limiter)
- symfony/translation: To show the texts of the forms in the visitor's language
Provides
None
Conflicts
- symfony/ai-agent: <1.0
- symfony/ai-bundle: <1.0
- symfony/ai-platform: <1.0
Replaces
None
README
FormBridge exposes Symfony forms as MCP tools, as forms a person completes inside the conversation (MCP Apps), and as tools of Symfony AI agents. An agent fills a form in and gets the form's own validation back; none of the tools an agent is given can save. Saving requires the form shown to the person or the review page.
use FormBridge\Attribute\AsFormTool; #[AsFormTool( name: 'create_booking', form: BookingType::class, description: 'Book seats for one person in a workshop session.', submitLabel: 'Book', )] final class CreateBookingHandler { public function __invoke(BookingRequest $request): Booking { // Runs when a valid form was submitted. To refuse after all, throw a // ValidationFailedException before writing anything. } }
How it works
Agent\FormToolbox (Symfony AI agents) and Ai\FormFiller (free text) enter at step 2.
Controller\ReviewController takes steps 6 to 9 for clients that cannot show an MCP App.
How saving is guarded explains each step.
Installation
composer require formbridge/formbridge-bundle
Requirements
PHP 8.2+, Symfony 7.4+ with Form, Validator, Twig, Lock and CSRF protection, symfony/mcp-bundle
1.0 (beta) and mcp/sdk 0.9. symfony/ai-agent, symfony/ai-platform and symfony/rate-limiter
are optional.
Documentation
docs/index.md covers installation, configuration, routes, how saving is guarded, events, extension points, translations, the supported field types and the limitations.
Tests
composer update vendor/bin/phpunit
The suite runs against a small application in tests/App, on PHP 8.2 with Symfony 7.4 and on
PHP 8.4 with Symfony 8.1.
License
MIT, see LICENSE.