From ebb571a7a60dc470c363d0bc1e4b91aba1ca05dd Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 24 Dec 2025 04:55:05 +0000 Subject: [PATCH] refactor: mount FastMCP app at /mcp and re-add /health to root for compatibility --- src/monarch_mcp_custom/server.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/monarch_mcp_custom/server.py b/src/monarch_mcp_custom/server.py index bc0afa7..369aac7 100644 --- a/src/monarch_mcp_custom/server.py +++ b/src/monarch_mcp_custom/server.py @@ -182,10 +182,14 @@ def create_app(): mcp_app = mcp.http_app() # FastMCP.http_app() already includes its own health check and SSE routes. - # By mounting at /, we get /sse and /messages (FastMCP defaults). - # We can add our custom /health if we want it to be distinct. + # By default it uses /sse for the stream and /messages for POSTs. - return Starlette(routes=[Mount("/", app=mcp_app)], lifespan=mcp_app.lifespan) + routes = [ + Route("/health", health_check, methods=["GET"]), + Mount("/mcp", app=mcp_app), + ] + + return Starlette(routes=routes, lifespan=mcp_app.lifespan) app = create_app()