mount_path does not work with sse_app #783
Description
Activity
Hello i opened a merge request, there was no 1.9.x branch available so I targeted main.
- addedbugSomething isn't workingSomething isn't workingneeds reproneeds additional information to be able to reproduce bugneeds additional information to be able to reproduce bug
on Oct 3, 2025 Hi @kinch-tech thanks for this submission could you provide a full code snippet to reproduce the issue so we can debug?
Closing this via #1881, which removes the
mount_pathparameter entirely.The
mount_pathparameter was redundant because the SSE transport already handles sub-path mounting automatically via ASGI's standardroot_pathmechanism. When you use Starlette'sMount(), it setsroot_pathin the ASGI scope, andSseServerTransportalready uses this to construct the correct message endpoint path (seesse.pylines 148-161).The fix: Just remove any
mount_pathconfiguration and rely on ASGI's built-in mechanism:from starlette.applications import Starlette from starlette.routing import Mount from mcp.server.fastmcp import FastMCP github_mcp = FastMCP("GitHub API") browser_mcp = FastMCP("Browser") # This just works - no mount_path needed app = Starlette( routes=[ Mount("/github", app=github_mcp.sse_app()), Mount("/browser", app=browser_mcp.sse_app()), ] )
The SSE transport will automatically return
/github/messages/and/browser/messages/as the message endpoints to clients.
while i start mcp server with mcp.run, provided with mount_path, then client get bad response with 404。
the endpoint for handling post message should be normalized_message_endpoint, not the original message_path