|
| 1 | +# MCP Bundle [WIP] |
| 2 | + |
| 3 | +Symfony integration bundle for [Model Context Protocol](https://modelcontextprotocol.io/) using the Symfony AI |
| 4 | +MCP SDK [symfony/mcp-sdk](https://github.com/symfony/mcp-sdk). |
| 5 | + |
| 6 | +**Currently only supports tools as server via Server-Sent Events (SSE) and STDIO.** |
| 7 | + |
| 8 | +## Installation |
| 9 | + |
| 10 | +```bash |
| 11 | +composer require symfony/mcp-bundle |
| 12 | +``` |
| 13 | + |
| 14 | +## Usage |
| 15 | + |
| 16 | +At first, you need to decide whether your application should act as a MCP server or client. Both can be configured |
| 17 | +in the `mcp` section of your `config/packages/mcp.yaml` file. |
| 18 | + |
| 19 | +### Act as Server |
| 20 | + |
| 21 | +**Currently only supports tools.** |
| 22 | + |
| 23 | +To use your application as an MCP server, exposing tools to clients like [Claude Desktop](https://claude.ai/download), |
| 24 | +you need to configure in the `client_transports` section the transports you want to expose to clients. |
| 25 | +You can use either STDIO or SSE. |
| 26 | + |
| 27 | +### Act as Client |
| 28 | + |
| 29 | +**Not implemented yet.** |
| 30 | + |
| 31 | +To use your application as an MCP client, integrating other MCP servers, you need to configure the `servers` you want to |
| 32 | +connect to. You can use either STDIO or Server-Sent Events (SSE) as transport methods. |
| 33 | + |
| 34 | +You can find a list of example Servers in the [MCP Server List](https://modelcontextprotocol.io/examples). |
| 35 | + |
| 36 | +Tools of those servers are available in your [AI Bundle](https://github.com/symfony/ai-bundle) |
| 37 | +configuration and usable in your agents. |
| 38 | + |
| 39 | +## Configuration |
| 40 | + |
| 41 | +```yaml |
| 42 | +mcp: |
| 43 | + app: 'app' # Application name to be exposed to clients |
| 44 | + version: '1.0.0' # Application version to be exposed to clients |
| 45 | + |
| 46 | + # Configure this application to act as an MCP server |
| 47 | + # Currently exposes tools registered in Symfony AI Bundle |
| 48 | + client_transports: |
| 49 | + stdio: true # Enable STDIO via command |
| 50 | + sse: true # Enable Server-Sent Event via controller |
| 51 | + |
| 52 | + # Configure MCP servers to be used by this application |
| 53 | + # Not implemented yet |
| 54 | + servers: |
| 55 | + name: |
| 56 | + transport: 'stdio' # Transport method to use, either 'stdio' or 'sse' |
| 57 | + stdio: |
| 58 | + command: 'php /path/bin/console mcp' # Command to execute to start the client |
| 59 | + arguments: [] # Arguments to pass to the command |
| 60 | + sse: |
| 61 | + url: 'http://localhost:8000/sse' # URL to SSE endpoint of MCP server |
| 62 | + |
| 63 | +``` |
0 commit comments