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():
"""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()