mirror of
https://github.com/aljazceru/mcp-python-sdk.git
synced 2026-01-28 18:24:20 +01:00
This commit is contained in:
24
README.md
24
README.md
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user