refactor: use simplified FastMCP app pattern with health check
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:
@@ -177,20 +177,14 @@ async def health_check(request):
|
||||
# --- ASGI App Setup ---
|
||||
|
||||
|
||||
def create_app():
|
||||
"""Create the Starlette application with MCP at /."""
|
||||
def create_app() -> Starlette:
|
||||
"""Create the Starlette application with health check and MCP."""
|
||||
mcp_app = mcp.http_app()
|
||||
|
||||
# FastMCP.http_app() already includes its own health check and SSE routes.
|
||||
# By default it uses /sse for the stream and /messages for POSTs.
|
||||
# Add health check route directly to the MCP app
|
||||
mcp_app.add_route("/health", health_check, methods=["GET"])
|
||||
|
||||
return Starlette(
|
||||
routes=[
|
||||
Route("/health", health_check, methods=["GET"]),
|
||||
Mount("/", app=mcp_app),
|
||||
],
|
||||
lifespan=mcp_app.lifespan,
|
||||
)
|
||||
return mcp_app
|
||||
|
||||
|
||||
app = create_app()
|
||||
|
||||
Reference in New Issue
Block a user