From df492c8bb484229d562900ac5e866eb3402061df Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 24 Dec 2025 04:52:24 +0000 Subject: [PATCH] refactor: simplify ASGI app setup by mounting FastMCP app at root --- src/monarch_mcp_custom/server.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/monarch_mcp_custom/server.py b/src/monarch_mcp_custom/server.py index e39be99..bc0afa7 100644 --- a/src/monarch_mcp_custom/server.py +++ b/src/monarch_mcp_custom/server.py @@ -178,15 +178,14 @@ async def health_check(request): def create_app(): - """Create the Starlette application with MCP at /mcp.""" + """Create the Starlette application with MCP at /.""" mcp_app = mcp.http_app() - routes = [ - Route("/health", health_check, methods=["GET"]), - Mount("/", app=mcp_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. - return Starlette(routes=routes, lifespan=mcp_app.lifespan) + return Starlette(routes=[Mount("/", app=mcp_app)], lifespan=mcp_app.lifespan) app = create_app()