Skip to content

Commit d31edf9

Browse files
committed
docs: Update README to reflect changes in mounting SSE server with Starlette
1 parent f836e92 commit d31edf9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

README.md

+11-3
Original file line numberDiff line numberDiff line change
@@ -352,16 +352,24 @@ mcp run server.py
352352
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.
353353

354354
```python
355-
from fastapi import FastAPI
355+
from starlette.applications import Starlette
356+
from starlette.routes import Mount, Host
356357
from mcp.server.fastmcp import FastMCP
357358

358-
app = FastAPI()
359+
359360
mcp = FastMCP("My App")
360361

361362
# Mount the SSE server to the existing ASGI server
362-
app.mount('/', mcp.sse_app())
363+
app = Starlette(routes=[
364+
Mount('/', app=mcp.sse_app())
365+
])
366+
367+
# or dynamically mount as host
368+
app.router.routes.append(Host('mcp.acme.corp', app=mcp.sse_app()))
363369
```
364370

371+
For more information on mounting applications in Starlette, see the [Starlette documentation](https://www.starlette.io/routing/#submounting-routes).
372+
365373
## Examples
366374

367375
### Echo Server

0 commit comments

Comments
 (0)