Skip to content

Commit d5bd5fd

Browse files
committed
Add multi-server mounting example to README
This commit adds documentation for mounting multiple FastMCP servers under different paths, showing how to configure mount_path for each server instance.
1 parent c4c05e1 commit d5bd5fd

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,33 @@ app = Starlette(
383383
app.router.routes.append(Host('mcp.acme.corp', app=mcp.sse_app()))
384384
```
385385

386+
When mounting multiple MCP servers under different paths, you need to configure the mount path for each server:
387+
388+
```python
389+
from starlette.applications import Starlette
390+
from starlette.routing import Mount
391+
from mcp.server.fastmcp import FastMCP
392+
393+
# Create multiple MCP servers
394+
github_mcp = FastMCP("GitHub API")
395+
browser_mcp = FastMCP("Browser")
396+
curl_mcp = FastMCP("Curl")
397+
398+
# Configure mount paths for each server
399+
github_mcp.settings.mount_path = "/github"
400+
browser_mcp.settings.mount_path = "/browser"
401+
curl_mcp.settings.mount_path = "/curl"
402+
403+
# Create Starlette app with multiple mounted servers
404+
app = Starlette(
405+
routes=[
406+
Mount("/github", app=github_mcp.sse_app()),
407+
Mount("/browser", app=browser_mcp.sse_app()),
408+
Mount("/curl", app=curl_mcp.sse_app()),
409+
]
410+
)
411+
```
412+
386413
For more information on mounting applications in Starlette, see the [Starlette documentation](https://www.starlette.io/routing/#submounting-routes).
387414

388415
## Examples

0 commit comments

Comments
 (0)