symfony
A Symfony package designed for building secure servers based on the Model Context Protocol, utilizing Server-Sent Events (SSE) and/or StreamableHTTP for real-time communication. It offers a scalable tool system tailored for enterprise-grade applications.
claude mcp add --transport stdio klapaudius-symfony-mcp-server php -d short_open_tag=0 vendor/bin/mcp-server
How to use
Symfony MCP Server turns a Symfony application into a capable Model Context Protocol (MCP) server, enabling you to build intelligent AI agents that reason about your app's data and logic. The server exposes a suite of tools and prompts that agents can discover and invoke, including resource access, multi-modal outputs, and real-time progress updates. With the built-in Sampling feature, agents can query AI models mid-execution to analyze data, generate recommendations, and decide on actions, while preserving a robust, enterprise-grade security posture for communications and access control. To get started, install the package in your Symfony project, configure your tools and prompts, and run the MCP server to begin orchestrating AI-driven workflows inside your application.
Use cases include automated code review helpers, data analysis agents, and multi-step business process automation. The Tool System lets you define executable functions (tools) that LLMs can call, with support for streaming progress and multiple result types (text, image, audio, resources). Prompts are designed to be context-aware and can be tailored to guide AI behavior, while Resource Management provides dynamic, template-based access to structured data and external providers. This combination enables your agents to reason, plan, and act leveraging your Symfony app’s existing domain models and services.
How to install
Prerequisites
- PHP 8.0+ with CLI access
- Composer (dependency manager for PHP)
- A Symfony project or PHP project structure compatible with the MCP server package
- Optional: Docker if you prefer containerized deployment
Install the MCP server package
- In your Symfony project, add the MCP server package via Composer:
composer require klapaudius/symfony-mcp-server
-
If your project uses Symfony, ensure the bundle or integration is registered according to the package’s documentation (e.g., in config/bundles.php or similar depending on your Symfony version).
-
Publish or copy any required configuration files as described in the package docs. This may include setting up tools, prompts, and resources for your application.
Run the MCP server Option A: Local development
php bin/console mcp:serve
Or, if the package provides a dedicated script, use:
php vendor/bin/mcp-server
Option B: Docker (if you prefer containerized deployment)
docker run -it --rm -v ${PWD}:/app -w /app php:8.2-cli php vendor/bin/mcp-server
Configuration
- Review the default configuration and adjust the tools, prompts, and resources to fit your domain. You can typically customize via config files or environment variables as described in the package docs.
- If you expose the MCP server over HTTP/S, make sure authentication and access control are configured to protect internal APIs.
Additional notes
Tips and common considerations:
- Environment variables: set any API keys for LLM providers, sampling engines, or external resources (e.g., SAMPLING_API_KEY, LLM_API_KEY) as described in the docs.
- Security: prefer streamable transports and authenticated access in production; avoid STDIO-based communication for live deployments.
- Tool discovery: agents can dynamically discover tools; ensure your tools declare capabilities (inputs/outputs) so agents can compose complex workflows.
- Resources: organize data and documents as structured resources that agents can load on demand to improve reasoning accuracy.
- Debugging: use verbose logging during development to inspect tool invocations and sampling responses; enable tracing if supported by your env.
Related MCP Servers
mcp
🤖 Taskade MCP · Official MCP server and OpenAPI to MCP codegen. Build AI agent tools from any OpenAPI API and connect to Claude, Cursor, and more.
boilerplate
TypeScript Model Context Protocol (MCP) server boilerplate providing IP lookup tools/resources. Includes CLI support and extensible structure for connecting AI systems (LLMs) to external data sources like ip-api.com. Ideal template for creating new MCP integrations via Node.js.
MediaWiki
Model Context Protocol (MCP) Server to connect your AI with any MediaWiki
hyperterse
The MCP framework. Connect your data to your agents.
ContextPods
Model Context Protocol management suite/factory. An MCP that can generate and manage other local MCPs in multiple languages. Uses the official SDKs for code gen.
mcp-framework
Rust MCP framework for building AI agents