You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+
## Project Overview
6
+
7
+
This is a Symfony bundle that enables developers to seamlessly add a Model Context Protocol (MCP) server to their Symfony applications. The main goal is to provide a production-ready implementation following the official MCP specifications at https://modelcontextprotocol.io/specification/2025-03-26.
8
+
9
+
The bundle allows Symfony applications to expose tools and resources that can be consumed by Large Language Models (LLMs) through secure transport protocols (SSE and StreamableHTTP), avoiding the security risks of STDIO transport in enterprise environments.
Copy file name to clipboardExpand all lines: README.md
+26-14Lines changed: 26 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,32 +15,34 @@
15
15
16
16
## Overview
17
17
18
-
Symfony MCP Server is a powerful package designed to streamline the implementation of Model Context Protocol (MCP) servers in Symfony applications. This package **utilizes Server-Sent Events (SSE)** transport, providing a secure and controlled integration method.
18
+
Symfony MCP Server is a powerful package designed to streamline the implementation of Model Context Protocol (MCP) servers in Symfony applications. This package **utilizes StreamableHTTP and/or Server-Sent Events (SSE)** transport, providing a secure and controlled integration methods.
19
19
20
-
### Why SSE instead of STDIO?
20
+
### Why not STDIO?
21
21
22
22
While stdio is straightforward and widely used in MCP implementations, it has significant security implications for enterprise environments:
23
23
24
24
-**Security Risk**: STDIO transport potentially exposes internal system details and API specifications
25
25
-**Data Protection**: Organizations need to protect proprietary API endpoints and internal system architecture
26
-
-**Control**: SSE offers better control over the communication channel between LLM clients and your application
26
+
-**Control**: StreamableHTTP or SSE offers better control over the communication channel between LLM clients and your application
27
27
28
-
By implementing the MCP server with SSE transport, enterprises can:
28
+
By implementing the MCP server with StreamableHTTP or SSE transport, enterprises can:
29
29
30
30
- Expose only the necessary tools and resources while keeping proprietary API details private
31
31
- Maintain control over authentication and authorization processes
32
32
33
33
Key benefits:
34
34
35
-
- Seamless and rapid implementation of SSE in existing Symfony projects
35
+
- Seamless and rapid implementation of StreamableHTTP and/or SSE in existing Symfony projects
36
36
- Support for the latest Symfony and PHP versions
37
37
- Efficient server communication and real-time data processing
38
38
- Enhanced security for enterprise environments
39
39
40
40
## Key Features
41
41
42
-
- Real-time communication support through Server-Sent Events (SSE) integration specified in the MCP 2024-11-05 version (Streamable HTTP from 2025-03-26 version is planned)
42
+
- Real-time communication support through StreamableHTTP and/or Server-Sent Events (SSE) integration
43
43
- Implementation of tools and resources compliant with Model Context Protocol specifications
44
+
- Support of streaming tools with progres notifications
45
+
- Support different types of tool results such as Text, Image, Audio, or Resource
44
46
- Adapter-based design architecture with Pub/Sub messaging pattern
45
47
46
48
## Requirements
@@ -62,14 +64,15 @@ Key benefits:
62
64
ping:
63
65
enabled: true # Read the warning section in the default configuration file before disable it
You can also manually create and register tools in `config/packages/klp_mcp_server.yaml`:
128
132
129
133
```php
130
-
use KLP\KlpMcpServer\Services\ToolService\ToolInterface;
134
+
use KLP\KlpMcpServer\Services\ProgressService\ProgressNotifierInterface;
135
+
use KLP\KlpMcpServer\Services\ToolService\Annotation\ToolAnnotation;
136
+
use KLP\KlpMcpServer\Services\ToolService\Result\ToolResultInterface;
137
+
use KLP\KlpMcpServer\Services\ToolService\StreamableToolInterface;
131
138
132
-
class MyCustomTool implements ToolInterface
139
+
class MyCustomTool implements StreamableToolInterface
133
140
{
134
141
// Tool implementation
135
142
}
@@ -155,6 +162,7 @@ This helps you rapidly develop and debug tools by:
155
162
- Showing the tool's input schema and validating inputs
156
163
- Executing the tool with your provided input
157
164
- Displaying formatted results or detailed error information
165
+
- Displaying progress notifications for streaming tool
158
166
- Supporting complex input types including objects and arrays
159
167
160
168
**For deep diving into tools creation please take a look at dedicated documentation [Here](https://github.com/klapaudius/symfony-mcp-server/blob/master/docs/building_tools.md)**
@@ -178,15 +186,19 @@ This will typically open a web interface at `localhost:6274`. To test your MCP s
178
186
2. In the Inspector interface, enter your Symfony server's MCP SSE URL (e.g., `http://localhost:8000/mcp/sse`)
179
187
3. Connect and explore available tools visually
180
188
181
-
The SSE URL follows the pattern: `http(s)://[your-web-server]/[default_path]/sse`where `default_path` is defined in your `config/packages/klp_mcp_server.yaml` file.
189
+
| MCP Specification version | Connection Url pattern |
`default_path`is defined in your `config/packages/klp_mcp_server.yaml` file.
182
194
183
195
## Advanced Features
184
196
185
-
### Pub/Sub Architecture with SSE Adapters
197
+
### Pub/Sub Architecture with Adapters
186
198
187
199
The package implements a publish/subscribe (pub/sub) messaging pattern through its adapter system:
188
200
189
-
1. **Publisher (Server)**: When clients send requests to the `/messages` endpoint, the server processes these requests and publishes responses through the configured adapter.
201
+
1. **Publisher (Server)**: When clients send requests (e.g. `/messages` endpoint for SSE connection), the server processes these requests and publishes responses through the configured adapter.
190
202
191
203
2. **Message Broker (Adapter)**: The adapter maintains message queues for each client, identified by unique client IDs. This provides a reliable asynchronous communication layer.
192
204
@@ -282,8 +294,8 @@ We are committed to actively pursuing the following key initiatives to enhance t
282
294
283
295
- **Core Features:**
284
296
- ✅ Resources implementation compliant with MCP specification.
285
-
- Support for Streamable HTTP (as specified in MCP 2025-03-26 version).
286
-
- Prompts implementation compliant with MCP specification.
297
+
- ✅ Support for Streamable HTTP (as specified in MCP 2025-03-26 version).
298
+
- ⏳️ Prompts implementation compliant with MCP specification.
287
299
- **Additional Adaptaters:**
288
300
- Support for more Pub/Sub adapters (e.g., RabbitMQ).
0 commit comments