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
docs: clarify streamable_http_path configuration when mounting servers
- Add StreamableHTTP servers section mirroring SSE servers structure
- Start with simple mounting examples, then explain path composition
- Document how to configure streamable_http_path for different scenarios
- Add inline comments in Starlette mounting example
This addresses confusion around endpoint paths when mounting
FastMCP servers as sub-applications in ASGI frameworks.
@@ -1002,6 +1007,57 @@ By default, SSE servers are mounted at `/sse` and Streamable HTTP servers are mo
1002
1007
1003
1008
For more information on mounting applications in Starlette, see the [Starlette documentation](https://www.starlette.io/routing/#submounting-routes).
1004
1009
1010
+
#### StreamableHTTP servers
1011
+
1012
+
You can mount the StreamableHTTP server to an existing ASGI server using the `streamable_http_app` method. This allows you to integrate the StreamableHTTP server with other ASGI applications.
1013
+
1014
+
```python
1015
+
from starlette.applications import Starlette
1016
+
from starlette.routing import Mount, Host
1017
+
from mcp.server.fastmcp import FastMCP
1018
+
1019
+
1020
+
mcp = FastMCP("My App")
1021
+
1022
+
# Mount the StreamableHTTP server to the existing ASGI server
When mounting StreamableHTTP servers, be aware that the server's `streamable_http_path` setting (default: `/mcp`) is relative to where you mount the app. For example:
1034
+
1035
+
```python
1036
+
from starlette.applications import Starlette
1037
+
from starlette.routing import Mount
1038
+
from mcp.server.fastmcp import FastMCP
1039
+
1040
+
# Create multiple MCP servers
1041
+
api_mcp = FastMCP("API Server")
1042
+
chat_mcp = FastMCP("Chat Server")
1043
+
1044
+
# Default behavior: endpoints will be at /api/mcp and /chat/mcp
> **Note**: SSE transport is being superseded by [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http).
0 commit comments