Purpose
symfony-agent-mcp is a production-ready Model Context Protocol (MCP) server for Symfony applications. It enables AI assistants to perform deep, read-only introspection of Symfony codebases, so they can answer questions about routing, controllers, services, entities, database structure, migrations, events, forms, security, Doctrine, Messenger, Twig, API Platform, and more.
Main capabilities
- Covers 16 categories, with a total of 1677 tools.
- What can be introspected includes: routing, controllers, services, entities, database structure, migrations, events, forms, security, Doctrine, Messenger, Twig, API Platform, composer packages, and logs.
- Each tool accepts an app_path parameter, pointing to the root directory of the Symfony application.
- Example prompts include: show all POST method routes and their controllers; which services are tagged as doctrine.event_listener; list the last 50 lines of the production log; whether there are circular dependencies in the service container; which Doctrine entities have a relationship with User; show migration history and any destructive migrations; which controllers do not have security attributes.
Security design
- Read-only: never writes, modifies, or executes anything.
- Automatic redaction: passwords, tokens, API keys, and database credentials are replaced with [REDACTED] before the data reaches the AI.
- DLP pipeline: multi-layer data loss prevention scanners (regex patterns plus structured detection, covering credit cards, JWTs, SSH keys, cloud credentials, etc.).
- Path validation: directory traversal attacks are blocked at the input layer.
- No code execution: PHP files are parsed statically (no eval, no PHP runtime).
- No network calls: all data comes only from local files.
- Prompt injection filter: tool output is scanned for injection patterns before being forwarded to the AI.
Usage
Installation options:
- Option A: npx (no installation required).
- Option B: global installation.
- Option C: install from source.
One-click installation: run once to register the server; to make it globally available in all projects, add the --scope user flag.
Integration methods:
- Claude Desktop: add to claude_desktop_config.json.
- Cursor: add to .cursor/mcp.json.
- VS Code Copilot: add to .vscode/mcp.json.
Configuration is done through environment variables passed to the MCP server process. Examples include: disabling dynamic tools for Claude Code; increasing the token budget to 80000 tokens.
Local installation (from source): use when you want to run the server from a local clone (without npm publishing). Then configure the MCP client to point to the built file. Claude Code (run once), Claude Desktop (claude_desktop_config.json), VS Code (.vscode/mcp.json). Tip: after rebuilding (pnpm build), restart the MCP client to pick up the changes.
Data sources
The server reads files directly from the Symfony application—no database connection, no PHP runtime:
- config/routes.yaml, config/routes/*.yaml — YAML routes
- PHP 8 #[Route] attributes on controllers in src/Controller/
- config/services.yaml — DI container services
- config/packages/*.yaml — Framework, security, doctrine, messenger, mailer configuration
- src/Entity/*.php — Doctrine entity files (PHP 8 attributes plus annotations)
- var/log/*.log — application logs
- migrations/, src/Migrations/ — Doctrine migration files
- composer.json, composer.lock — package information
- .env, .env.local, .env.*.local — environment variables (sensitive values automatically redacted)
Applicable scenarios
Suitable for development scenarios that need to let AI assistants understand the structure of a Symfony project, such as querying routes, service dependencies, entity relationships, migration history, log contents, security configuration, etc. Suitable forUse with MCP-capable AI clients (such as Claude Desktop, Cursor, VS Code Copilot).
Limitations and Requirements
- Environment requirements: Node.js ≥ 22.0.0; pnpm ≥ 11.0.0 (or npm/yarn for development).
- Only read-only operations are supported; no write or execute capabilities are provided.
- All data comes from local files; no network calls are made.
- Symfony compatibility information does not specify a concrete version range in the materials.
- The project uses the MIT license, and the author is Ángel Guzmán Maeso.
- For more development guidelines, see DEVELOPMENT.md; for the security policy, see SECURITY.md; for the roadmap, see ROADMAP.md.