Symfony-specific analysis tools for the SIN-Code Bundle. 8 MCP tools that turn your Symfony project into a queryable knowledge graph for coding agents and humans.
Part of the SIN-Code agent-engineering stack. Install alongside the rest via the SIN-Code Bundle.
sin-code-symfony-lens exposes 8 production-grade analyzers as MCP tools, so
agents like opencode, Claude Code, and Cursor can ask deep, structured
questions about a Symfony codebase — services, routes, Doctrine entities,
Twig templates, the DI container, and migration safety — without running the
full PHP toolchain.
It is a static, regex-based analyzer: it parses services.yaml, PHP
attributes, Doctrine annotations, Twig {% extends %} chains, and Doctrine
migration SQL — fast enough to run on every keystroke.
| Tool | What it analyzes |
|---|---|
symfony_analyze_services |
services.yaml + PHP attributes → service graph (aliases, autowiring, factories, decorates) |
symfony_analyze_routes |
#[Route] attributes + routes.yaml + routes.xml + legacy @Route annotations |
symfony_analyze_entities |
Doctrine entities — fields, types, relations (OneToMany/ManyToOne/...), indexes, lifecycle callbacks |
symfony_analyze_templates |
Twig extends / include / use / import / macro / block resolution |
symfony_analyze_container |
Full DI container view (services + routes + parameters) in a single response |
symfony_validate_migration |
Detects breaking DDL changes in pending Doctrine migrations (drop column, change type, etc.) |
symfony_phpstan_check |
Runs PHPStan/Psalm, parses JSON output, integrates with the Proof-of-Correctness stack |
symfony_full_analysis |
All of the above in a single tool call (use for cold-start of a new project) |
# Standalone
pip install sin-code-symfony-lens
# Or via the SIN-Code Bundle (recommended)
pip install sin-code-bundle[symfony]Then run the MCP server:
symfony-lens # → FastMCP server on stdioWire it into your opencode config:
# From any agent that speaks MCP:
result = await client.call_tool(
"symfony_analyze_services",
{"project_root": "/path/to/symfony-app"}
)
# → {
# "services": 87,
# "autowired": 76,
# "decorated": 4,
# "graph": [...]
# }symfony_lens/
├── server.py # FastMCP entrypoint (8 @mcp.tool() definitions)
├── analyzers/
│ ├── service_analyzer.py # services.yaml + PHP #[AsService] etc.
│ ├── route_analyzer.py # #[Route], routes.yaml, routes.xml, @Route
│ ├── entity_analyzer.py # Doctrine #[ORM\Entity] + field introspection
│ ├── twig_analyzer.py # Twig template graph
│ └── container_analyzer.py # aggregate view
├── doctrine/
│ ├── schema_inspector.py # ORM metadata
│ └── migration_validator.py # DDL diff vs. previous schema
├── static_analysis/
│ └── phpstan_bridge.py # JSON parser + sin-poc integration
└── utils/ # PHP regex parser, YAML/attribute helpers
Every module ships with a .doc.md companion (CoDocs standard).
tree-sitter-php requires a C toolchain at install time. For a 50 MB tool that
runs in <300 ms per project, a hand-tuned regex parser hits 95% of the cases
agents actually need (route paths, service IDs, attribute names) and stays
zero-dep. The remaining 5% fall through to phpstan_bridge, which calls the
real PHP toolchain when needed.
pip install -e .[dev]
pytest -v20 tests, all green.
- SIN-Code-Bundle — orchestrator
- SIN-Code-Semantic-Codebase-Knowledge-Graphs — stores the analysis output as a queryable graph
- SIN-Code-Proof-of-Correctness — consumes
phpstan_bridgeoutput - SIN-Code-Architectural-Debt-Watchdogs — flags unused services / dead routes
MIT — see LICENSE.
See CHANGELOG.md for release notes (current: 0.1.0, 2026-06-05).
{ "mcp": { "symfony-lens": { "type": "local", "command": ["symfony-lens"] } } }