refactor: simplify ASGI app setup by mounting FastMCP app at root
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 7s

This commit is contained in:
Ben
2025-12-24 04:52:24 +00:00
parent 8fc4312685
commit df492c8bb4

View File

@@ -178,15 +178,14 @@ async def health_check(request):
def create_app(): def create_app():
"""Create the Starlette application with MCP at /mcp.""" """Create the Starlette application with MCP at /."""
mcp_app = mcp.http_app() mcp_app = mcp.http_app()
routes = [ # FastMCP.http_app() already includes its own health check and SSE routes.
Route("/health", health_check, methods=["GET"]), # By mounting at /, we get /sse and /messages (FastMCP defaults).
Mount("/", app=mcp_app), # 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() app = create_app()