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
Copy file name to clipboardExpand all lines: README.md
+27-2Lines changed: 27 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -943,10 +943,35 @@ The streamable HTTP transport supports:
943
943
944
944
### Mounting to an Existing ASGI Server
945
945
946
-
> **Note**: SSE transport is being superseded by [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http).
947
-
948
946
By default, SSE servers are mounted at `/sse` and Streamable HTTP servers are mounted at `/mcp`. You can customize these paths using the methods described below.
949
947
948
+
#### Streamable HTTP servers
949
+
950
+
The following example shows how to use `streamable_http_app()`, a method that returns a `Starlette` application object.
951
+
You can then append additional routes to that application as needed.
To customize the route from the default of "/mcp", either specify the `streamable_http_path` option for the `FastMCP` constructor,
964
+
or set `FASTMCP_STREAMABLE_HTTP_PATH` environment variable.
965
+
966
+
Note that in Starlette and FastAPI (which is based on Starlette), the "/mcp" route will redirect to "/mcp/",
967
+
so you may need to use "/mcp/" when pointing MCP clients at your servers.
968
+
969
+
For more information on mounting applications in Starlette, see the [Starlette documentation](https://www.starlette.io/routing/#submounting-routes).
970
+
971
+
#### SSE servers
972
+
973
+
> **Note**: SSE transport is being superseded by [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http).
974
+
950
975
You can mount the SSE server to an existing ASGI server using the `sse_app` method. This allows you to integrate the SSE server with other ASGI applications.
0 commit comments