symfony-php-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| CONSOLE_PATH | No | Path to bin/console relative to SYMFONY_PROJECT_ROOT. Defaults to 'bin/console'. | bin/console |
| PHP_EXECUTABLE | No | PHP binary or wrapper command. Use 'ddev php', 'lando php', or a full path like '/usr/bin/php8.3'. Defaults to 'php'. | php |
| COMMAND_TIMEOUT | No | Seconds before a PHP subprocess is killed. Increase for large projects or slow containers. Defaults to '30'. | 30 |
| DOCKER_CONTAINER | No | Docker container name. When set, commands run as 'docker exec <container> php …'. Takes precedence over PHP_EXECUTABLE. | |
| DOCKER_EXEC_USER | No | Optional -u <user> for docker exec. Useful when the container runs PHP as www-data. | |
| SYMFONY_PROJECT_ROOT | Yes | Required. Absolute path to your Symfony project (the directory containing composer.json). Defaults to current working directory. | . |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| get_project_overviewA | Return a Markdown overview of the Symfony project. Reads composer.json, symfony.lock (or composer.lock), and .env to report:
Call this tool first before using other tools to understand the project. |
| find_routeA | Find Symfony routes matching a URL pattern or route name. Runs Args: url_pattern: Substring or regex to match against route paths and route names. Examples: "/api/users", "user_show", "^/admin" method: Optional HTTP method filter (GET, POST, PUT, PATCH, DELETE). Empty string = no filter (matches all methods). Returns a Markdown table with: route name, path, allowed methods, controller. For single matches, the full route definition is included. Requires PHP and bin/console to be accessible (configure via DOCKER_CONTAINER or PHP_EXECUTABLE if using Docker/DDEV/Lando). |
| analyze_twigA | Analyse a Twig template and return its structural metadata. No PHP execution required – pure filesystem analysis. Extracts:
Args: template_name: Template path as used in Twig (e.g. "user/show.html.twig") or a partial name (e.g. "show" or "user/show"). The templates/ directory is searched recursively. Returns a structured Markdown report. |
| list_servicesA | List Symfony service definitions. Two modes:
Args: filter_pattern: Regex or substring to filter service IDs or class names. Examples: "App\Service", "mailer", "doctrine" Empty = show all defined services. use_container_debug: Set to true to query the full compiled DI container. Requires PHP and bin/console to be accessible. Returns a Markdown table with: service ID, class, public flag, tags. |
| read_code_contextA | Read a file from the Symfony project, with optional comment stripping. Stripping PHPDoc / block comments (/* ... */) significantly reduces token usage without losing functional information – use strip_doc_comments=true (the default) for faster, cheaper analysis. Args: file_path: Path relative to the project root. Examples: "src/Controller/UserController.php" "src/Entity/User.php" Absolute paths inside the project are also accepted. strip_doc_comments: Remove /** ... / and / ... */ blocks. Default: true. strip_line_comments: Also remove // single-line comments. Default: false (inline comments are useful context). Returns the file content with line numbers and a token-savings summary. Security: only files inside the project root can be read (path traversal is blocked). |
| build_indexA | Scan PHP files and build (or update) the symbol index. The index stores all classes, interfaces, traits, enums, and their methods so that find_symbol can locate any symbol instantly without re-scanning. The index is persisted to /.symfony-mcp-index.json and loaded automatically on next server start. Only changed files are re-scanned (incremental), so subsequent calls are fast. Args: directories: Directories to scan, relative to the project root. Default: auto-detected (src/, app/, lib/). Example: ["src", "lib"] force: Re-scan every file even if it hasn't changed. Use this after a major refactor or rename. Run this once after pointing the server at a new project, then again after significant code changes. |
| find_symbolA | Search the symbol index for a PHP class, interface, trait, enum, or method. Returns file paths and line numbers — use the result directly with read_code_context to inspect the implementation. Requires build_index to have been run at least once. Args: name: Name to search for (case-insensitive substring or full name). Examples: "UserController", "UserRepo", "findByEmail", "App\Entity" kind: Optional filter. One of: class, interface, trait, enum, method. Empty = search all symbol types. Typical workflow:
|
| search_codeA | Live regex/substring search across project files. No index required — scans files directly each time. Useful for finding usages, checking for patterns, or searching non-PHP files. Args: pattern: Python regex or plain substring to search for. Examples: "UserRepository", "findByEmail(", "#[Route" path_glob: Glob relative to project root. Default: /*.php Other examples: src//.php, templates/**/.twig, config/**/*.yaml, **/*.php context_lines: Lines of surrounding context to show (0–5). Default: 2. max_results: Max matching snippets to return (1–200). Default: 30. Returns highlighted snippets with file path and line number. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 8 tools
Each tool has a clearly distinct purpose: Twig analysis, index building, route finding, symbol lookup, project overview, service listing, file reading, and regex search. No overlaps or ambiguity.
All tool names follow a consistent verb_noun pattern (e.g., analyze_twig, build_index, find_route) and use snake_case uniformly, making the set predictable.
With 8 tools, the server covers the essential operations for Symfony project inspection without being excessive or sparse. The count is well-scoped for its purpose.
The tool surface covers core read/inspection tasks (routes, services, symbols, code, Twig), but lacks a tool to list all Twig templates or other structural elements, a minor gap.