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
When mounting multiple MCP servers under different paths, you can configure the mount path in several ways:
1617
+
You can also mount multiple MCP servers at different sub-paths. The SSE transport automatically detects the mount path via ASGI's `root_path` mechanism, so message endpoints are correctly routed:
1618
1618
1619
1619
```python
1620
1620
from starlette.applications import Starlette
@@ -1624,31 +1624,18 @@ from mcp.server.fastmcp import FastMCP
1624
1624
# Create multiple MCP servers
1625
1625
github_mcp = FastMCP("GitHub API")
1626
1626
browser_mcp = FastMCP("Browser")
1627
-
curl_mcp = FastMCP("Curl")
1628
1627
search_mcp = FastMCP("Search")
1629
1628
1630
-
# Method 1: Configure mount paths via settings (recommended for persistent configuration)
1631
-
github_mcp.settings.mount_path ="/github"
1632
-
browser_mcp.settings.mount_path ="/browser"
1633
-
1634
-
# Method 2: Pass mount path directly to sse_app (preferred for ad-hoc mounting)
1635
-
# This approach doesn't modify the server's settings permanently
1636
-
1637
-
# Create Starlette app with multiple mounted servers
1629
+
# Mount each server at its own sub-path
1630
+
# The SSE transport automatically uses ASGI's root_path to construct
1631
+
# the correct message endpoint (e.g., /github/messages/, /browser/messages/)
Copy file name to clipboardExpand all lines: docs/migration.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,6 +116,12 @@ result = await session.list_resources(params=PaginatedRequestParams(cursor="next
116
116
result =await session.list_tools(params=PaginatedRequestParams(cursor="next_page_token"))
117
117
```
118
118
119
+
### `mount_path` parameter removed from FastMCP
120
+
121
+
The `mount_path` parameter has been removed from `FastMCP.__init__()`, `FastMCP.run()`, `FastMCP.run_sse_async()`, and `FastMCP.sse_app()`. It was also removed from the `Settings` class.
122
+
123
+
This parameter was redundant because the SSE transport already handles sub-path mounting via ASGI's standard `root_path` mechanism. When using Starlette's `Mount("/path", app=mcp.sse_app())`, Starlette automatically sets `root_path` in the ASGI scope, and the `SseServerTransport` uses this to construct the correct message endpoint path.
124
+
119
125
### Resource URI type changed from `AnyUrl` to `str`
120
126
121
127
The `uri` field on resource-related types now uses `str` instead of Pydantic's `AnyUrl`. This aligns with the [MCP specification schema](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/draft/schema.ts) which defines URIs as plain strings (`uri: string`) without strict URL validation. This change allows relative paths like `users/me` that were previously rejected.
0 commit comments