symfony-agent-mcp
symfony-agent-mcp
功能 • 快速开始 • 集成 • 使用 • 文档 • 贡献 • 许可证
一个面向 Symfony 应用程序的生产就绪的 Model Context Protocol (MCP) 服务器。 为 AI 助手提供对整个 Symfony 代码库的深度、只读内省——路由、控制器、服务、实体、数据库模式、迁移、事件、表单、安全、Doctrine、Messenger、Twig、API Platform 等等。
客户端 | 安装 |
Claude Code | 运行 |
Claude Desktop | 添加到 |
Cursor | 添加到 |
VS Code Copilot | 添加到 |
任何 MCP 客户端 | stdio 传输, |
功能
16 个类别中的 1,679 个工具
Available tool categories (16 categories, 1,679 tools total, ~164,729 tokens if all active)
Category │ Tools │ Est. tokens │ Description
─────────────────┼────────────┼────────────────┼────────────────────────────────────────────────────────
symfony-core │ 549 tools │ ~ 53995 tokens │ Routes, services, controllers, events, commands, bundles, DI container, kernel
database │ 176 tools │ ~ 17121 tokens │ Entities, migrations, Doctrine ORM, relationships, query patterns, indexes, DBAL
security │ 133 tools │ ~ 13008 tokens │ Voters, firewalls, authenticators, JWT, OAuth, CSRF, access control, secrets vault
frontend │ 121 tools │ ~ 11568 tokens │ Twig, translations, asset mapper, Symfony UX, Turbo, live components, Webpack
testing │ 110 tools │ ~ 10559 tokens │ PHPUnit, Behat, Cypress, Playwright, Psalm, PHPStan, Rector, static analysis
integrations │ 106 tools │ ~ 10939 tokens │ Stripe, Slack, Sentry, Elasticsearch, Twilio, SendGrid, Mailgun, Datadog, OpenAI
serializer │ 91 tools │ ~ 9031 tokens │ Serializer, validation, forms, constraints, DTOs, transformers, normalizers
messaging │ 87 tools │ ~ 8455 tokens │ Messenger, notifier, webhooks, Mercure, mailer, transports, stamps, failure handling
api │ 68 tools │ ~ 6438 tokens │ API Platform, OpenAPI, GraphQL, REST patterns, versioning, rate limits, Nelmio
infrastructure │ 68 tools │ ~ 6794 tokens │ Docker, CI/CD, Kubernetes, Terraform, Helm, Nginx, serverless, cloud platforms
cache-sessions │ 62 tools │ ~ 5945 tokens │ Cache pools, HTTP cache, sessions, rate limiter, lock, cache warmers, OPcache
config │ 35 tools │ ~ 3157 tokens │ Environment config, framework settings, Monolog, CORS, locale, feature flags
code-quality │ 25 tools │ ~ 2447 tokens │ Profiler, dead code detection, dependency graph, accessibility, code metrics
cloud-aws │ 18 tools │ ~ 1945 tokens │ AWS S3, SES, Cognito, ECS, Lambda/Bref, Parameter Store, Secrets Manager, CloudFront
cloud-other │ 16 tools │ ~ 1851 tokens │ Azure Blob/Pipelines, Google Cloud Run/Storage, Firebase, DigitalOcean, Consul
queues │ 14 tools │ ~ 1476 tokens │ RabbitMQ, Kafka, SQS FIFO/DLQ, Pusher, Redis pub/sub and streams
To activate a category: call activate_category(category: "<key>")
To search for specific tools: call search_tools(query: "what you want to do")安全优先设计
只读 — 从不写入、修改或执行任何内容
自动脱敏 — 密码、令牌、API 密钥和数据库凭据在数据到达 AI 之前被替换为
[REDACTED]DLP 管道 — 多层数据丢失防护扫描器(正则模式 + 结构检测,用于信用卡、JWT、SSH 密钥、云凭据等)
路径验证 — 目录遍历攻击在输入层被阻止
不执行代码 — PHP 文件被静态解析(无
eval,无 PHP 运行时)无网络调用 — 所有数据仅来自本地文件
提示注入过滤器 — 工具输出在转发给 AI 之前会扫描注入模式
Related MCP server: phpustik MCP Server
快速开始
选项 A:npx(无需安装)
npx @shakaran/symfony-agent-mcp选项 B:全局安装
npm install -g @shakaran/symfony-agent-mcp
symfony-agent-mcp选项 C:从源码
git clone https://github.com/shakaran/symfony-agent-mcp
cd symfony-agent-mcp
pnpm install
pnpm build
pnpm start参见 GETTING_STARTED.md 获取分步指南,包括 Node.js 设置、故障排除和首次使用验证。
集成
一键安装
客户端 | 安装 |
Cursor | |
VS Code | |
VS Code Insiders | |
Windsurf | |
Claude Code | |
Claude Desktop |
Claude Code
运行一次以注册服务器:
# npx (no local install required)
claude mcp add symfony -- npx @shakaran/symfony-agent-mcp
# Or from a local source build
claude mcp add symfony -- node /path/to/symfony-agent-mcp/dist/server.js要使其在所有项目中全局可用,请添加 --scope user 标志:
claude mcp add --scope user symfony -- npx @shakaran/symfony-agent-mcpClaude Desktop
添加到您的 Claude Desktop 配置文件(claude_desktop_config.json):
{
"mcpServers": {
"symfony": {
"command": "npx",
"args": ["@shakaran/symfony-agent-mcp"]
}
}
}Cursor
添加到 .cursor/mcp.json:
{
"symfony": {
"command": "npx",
"args": ["@shakaran/symfony-agent-mcp"]
}
}VS Code Copilot
添加到 .vscode/mcp.json:
{
"servers": {
"symfony": {
"type": "stdio",
"command": "npx",
"args": ["@shakaran/symfony-agent-mcp"]
}
}
}使用
每个工具都接受一个 app_path 参数,指向您的 Symfony 应用程序的根目录:
list_routes(app_path: "/var/www/myapp")
→ Found 42 routes: GET /api/users [api_users], POST /login [app_login], …
get_entity_details(app_path: "/var/www/myapp", entity_name: "User")
→ Entity: User | Table: users
Properties: id (int, PK), email (string 180), isActive (bool)
Relationships: OneToMany → Post (author)
get_error_summary(app_path: "/var/www/myapp")
→ Last 24h: 3 CRITICAL, 12 ERROR, 47 WARNING
get_code_quality_report(app_path: "/var/www/myapp")
→ God classes: UserManager (1240 lines), dead services: 4, N+1 risks: 7您可以与 Claude 一起使用的示例提示:
"显示所有使用 POST 方法的路由及其控制器"
"哪些服务被标记为
doctrine.event_listener?""列出生产日志的最后 50 行"
"服务容器中是否存在循环依赖?"
"哪些 Doctrine 实体与 User 有关系?"
"显示迁移历史以及任何破坏性迁移"
"哪些控制器没有安全属性?"
配置
所有配置都通过传递给 MCP 服务器进程的环境变量完成。
工具发现
变量 | 默认值 | 描述 |
|
| 启用动态工具发现。当为 |
|
| 每个会话可激活的最大估计令牌数。当超过此限制时,激活将被阻止;传递 |
安全与访问
变量 | 默认值 | 描述 |
| (任意) | 服务器可以检查的绝对应用路径的冒号分隔列表。示例: |
|
| 设置为 |
| (全部) | 逗号分隔的工具名称允许列表。仅列出的工具可被调用。 |
| (无) | 逗号分隔的拒绝列表。优先于允许列表。 |
| (关闭) | 用于请求签名的 32 个以上字符的密钥。启用每个请求的身份验证。 |
| (关闭) | 用于会话令牌生成的密钥。 |
| (关闭) | 用于验证传入请求的令牌。 |
|
| 设置为 |
|
| 会话令牌的有效时间窗口(秒)。 |
速率限制
变量 | 默认值 | 描述 |
|
| 每个窗口的最大请求数。设置为 |
|
| 速率限制窗口(毫秒)(1 分钟)。 |
|
| 1 秒内的最大突发请求数。 |
传输
变量 | 默认值 | 描述 |
| (关闭) | HTTP/SSE 传输的端口。设置后,除了 stdio 之外还会启动 HTTP 服务器。 |
|
| 设置为 |
|
| 每个工具的执行超时时间(毫秒)。 |
示例:禁用动态工具的 Claude Code
{
"mcpServers": {
"symfony": {
"command": "npx",
"args": ["@shakaran/symfony-agent-mcp"],
"env": {
"SYMFONY_MCP_DYNAMIC_TOOLS": "false"
}
}
}
}示例:令牌预算增加到 80 000 个令牌
{
"mcpServers": {
"symfony": {
"command": "node",
"args": ["/path/to/symfony-agent-mcp/dist/server.js"],
"env": {
"SYMFONY_MCP_TOKEN_BUDGET": "80000"
}
}
}
}本地安装(从源码)
当您想从本地克隆运行服务器时使用此方法(无需 npm 发布)。
# 1. Clone the repo
git clone https://github.com/shakaran/symfony-agent-mcp
cd symfony-agent-mcp
# 2. Install dependencies (Node.js ≥ 22 required)
pnpm install # or: npm install
# 3. Build TypeScript → dist/
pnpm build # or: npm run build
# 4. Test the server responds
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node dist/server.js然后将您的 MCP 客户端配置为指向构建后的文件:
Claude Code(运行一次):
claude mcp add symfony -- node /absolute/path/to/symfony-agent-mcp/dist/server.jsClaude Desktop(claude_desktop_config.json):
{
"mcpServers": {
"symfony": {
"command": "node",
"args": ["/absolute/path/to/symfony-agent-mcp/dist/server.js"]
}
}
}VS Code(.vscode/mcp.json):
{
"servers": {
"symfony": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/symfony-agent-mcp/dist/server.js"]
}
}
}提示: 重新构建(
pnpm build)后,请重启您的 MCP 客户端以获取更改。
它读取什么
服务器直接从您的 Symfony 应用读取文件——无需数据库连接,无需 PHP 运行时:
config/routes.yaml、config/routes/*.yaml— YAML 路由src/Controller/中控制器上的 PHP 8#[Route]属性config/services.yaml— DI 容器服务config/packages/*.yaml— 框架、安全、doctrine、messenger、mailer 配置src/Entity/*.php— Doctrine 实体文件(PHP 8 属性 + 注解)var/log/*.log— 应用程序日志migrations/、src/Migrations/— Doctrine 迁移文件composer.json、composer.lock— 包信息.env、.env.local、.env.*.local— 环境变量(敏感值自动脱敏)
Symfony 兼容性
Symfony | PHP | ORM 映射 |
5.4 LTS | 8.0+ | 注解或属性 |
6.x | 8.0+ | 属性 |
7.x | 8.2+ | 属性 |
8.x | 8.2+ | 属性 |
环境要求
Node.js ≥ 22.0.0
pnpm ≥ 11.0.0(或使用 npm/yarn 进行开发)
开发
pnpm install
pnpm dev # watch mode (TypeScript → dist/)
pnpm test # run all tests
pnpm lint # ESLint
pnpm typecheck # tsc --noEmit完整开发指南请参阅 DEVELOPMENT.md:架构概述、添加新工具、测试策略及贡献指南。
文档
文档 | 描述 |
分步安装、Node.js 前置要求、故障排查 | |
系统设计、安全流水线、组件概览,共记录 16 个类别的 1,679 个工具 | |
开发工作流、添加工具、测试、贡献 | |
威胁模型、DLP 流水线、负责任披露政策 | |
发布历史与路线图 | |
高层项目概览与统计数据 |
贡献
欢迎在 github.com/shakaran/symfony-agent-mcp 提交 Issue 和拉取请求。
提交 PR 前请阅读 DEVELOPMENT.md,关于负责任披露政策请阅读 SECURITY.md。
许可证
MIT © Ángel Guzmán Maeso
Maintenance
Related MCP Servers
- AlicenseAqualityCmaintenanceA production-ready Model Context Protocol (MCP) server that bridges your Symfony/PHP project with LLMs such as Claude. It exposes tools that let the AI read your project's routes, services, Twig templates, and PHP source code.8MIT
- AlicenseBqualityCmaintenanceEnables AI assistants to deeply interact with the PHP ecosystem, including runtime, static analysis, security scanning, testing, Composer, and frameworks like Laravel and Symfony. It exposes over 30 tools, 8 resources, and 7 prompts via MCP, allowing natural language commands to run PHP linting, static analysis, audits, tests, and project initialization.41MIT
- FlicenseNot gradedqualityCmaintenanceEnables debugging Symfony applications by inspecting profiler data through a standalone MCP server.
- AlicenseNot gradedqualityBmaintenanceMCP server that exposes Symfony profiler runtime data (requests, queries, logs) to AI agents like Claude Code for debugging and optimization.MIT
Related MCP Connectors
Security-first WordPress MCP server. 129 tools for Claude, ChatGPT, Gemini. Free on wp.org.
Scans MCP servers for tool poisoning, prompt injection and supply chain risks.
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/shakaran/symfony-agent-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server