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
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 8s
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user