refactor: mount FastMCP app at /mcp and re-add /health to root for compatibility
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 8s

This commit is contained in:
Ben
2025-12-24 04:55:05 +00:00
parent df492c8bb4
commit ebb571a7a6

View File

@@ -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()