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