Revert "Add message queue for SSE messages POST endpoint (#459)" (#649)

This commit is contained in:
ihrpr
2025-05-07 16:35:20 +01:00
committed by GitHub
parent c8a14c9dba
commit 9d99aee014
26 changed files with 51 additions and 1247 deletions

View File

@@ -449,30 +449,6 @@ if __name__ == "__main__":
For more information on mounting applications in Starlette, see the [Starlette documentation](https://www.starlette.io/routing/#submounting-routes).
#### Message Dispatch Options
By default, the SSE server uses an in-memory message dispatch system for incoming POST messages. For production deployments or distributed scenarios, you can use Redis or implement your own message dispatch system that conforms to the `MessageDispatch` protocol:
```python
# Using the built-in Redis message dispatch
from mcp.server.fastmcp import FastMCP
from mcp.server.message_queue import RedisMessageDispatch
# Create a Redis message dispatch
redis_dispatch = RedisMessageDispatch(
redis_url="redis://localhost:6379/0", prefix="mcp:pubsub:"
)
# Pass the message dispatch instance to the server
mcp = FastMCP("My App", message_queue=redis_dispatch)
```
To use Redis, add the Redis dependency:
```bash
uv add "mcp[redis]"
```
## Examples
### Echo Server