A Symfony Bundle that exposes your application's internals as a Model Context Protocol (MCP) server. Connect LLM agents (Claude Desktop, Cursor, Windsurf) directly to your running Symfony app and ask questions like:
Symfony Inspector MCP registers an MCP server inside your Symfony application. Tools and resources let an AI agent introspect your app without leaving the chat:
composer require --dev alya/symfony-inspector-mcp
Register the bundle only for the dev environment in config/bundles.php:
return [
// ...
Alya\SymfonyInspectorMcp\SymfonyInspectorMcpBundle::class => ['dev' => true],
];
Security: the bundle throws a
LogicExceptionat container build time if it is accidentally enabled outside ofdev.
Create config/packages/mcp_inspector.yaml:
mcp_inspector:
transport: stdio
allowed_commands:
- cache:clear
- list
- doctrine:mapping:info
log_file: '%kernel.logs_dir%/%kernel.environment%.log'
log_tail_lines: 200
Create (or extend) config/packages/mcp.yaml:
mcp:
client_transports:
stdio: true
http: false
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"my-symfony-app": {
"command": "/usr/bin/php",
"args": [
"/absolute/path/to/your/project/bin/console",
"mcp:server"
]
}
}
}
Replace /absolute/path/to/your/project with the real path. Restart Claude Desktop after saving.
| Tool | Description |
|---|---|
list_routes |
Lists all registered routes (name, path, methods, controller). |
list_services |
Lists container services. Accepts an optional filter string. |
show_config |
Shows resolved config for a bundle/extension (e.g. "framework", "doctrine"). Accepts an optional path sub-key. |
list_events |
Lists event dispatcher listeners. Accepts an optional event name filter (e.g. "kernel.request"). |
inspect_entity |
Inspects a Doctrine entity — mapping info + source code. Requires doctrine/orm. |
read_logs |
Reads the last N lines of the application log. Accepts an optional lines count. |
run_console |
Executes a whitelisted Symfony console command (see allowed_commands). |
run_tests |
Runs PHPUnit tests and returns output. |
| URI | Description |
|---|---|
symfony://routes |
Full route collection as JSON. |
symfony://entities |
List of Doctrine entity classes. |
symfony://logs/latest |
Latest N lines from the application log file. |
symfony://config/{name} |
Resolved configuration for a bundle or extension (e.g. symfony://config/framework). |
symfony://migrations/status |
Doctrine Migrations status output. Requires doctrine/migrations. |
doctrine/orm ^3.0 (optional — required only for inspect_entity and symfony://entities)doctrine/migrations (optional — required only for symfony://migrations/status)kernel.environment is not dev. There is no silent fallback.run_console only executes commands explicitly listed in mcp_inspector.allowed_commands. Any unlisted command returns an error message.stdio, meaning the MCP server communicates only through standard input/output of your console process — no port is opened.Pull requests are welcome. Please open an issue first to discuss significant changes.
cd symfony-inspector-mcp
composer install
vendor/bin/phpunit
MIT — see LICENSE.
How can I help you explore Laravel packages today?