From 73c72a603990b2a116656ef8a26c277a5c41873c Mon Sep 17 00:00:00 2001 From: saidsurucu Date: Wed, 2 Jul 2025 03:29:22 +0300 Subject: [PATCH] Fix mount order for /mcp paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Mount /mcp before /mcp/ to fix routing - FastAPI mount order is important for path matching 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- asgi_app.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/asgi_app.py b/asgi_app.py index da1e00f..9f67566 100644 --- a/asgi_app.py +++ b/asgi_app.py @@ -80,9 +80,10 @@ async def custom_401_handler(request: Request, exc: HTTPException): return response -# Mount MCP app as sub-application +# Mount MCP app as sub-application +# Order matters: mount more specific paths first +app.mount("/mcp", mcp_app) # Mount without trailing slash for Claude compatibility app.mount("/mcp/", mcp_app) -app.mount("/mcp", mcp_app) # Also mount without trailing slash for Claude compatibility # FastAPI health check endpoint @app.get("/health")