Why mcp-asgi-http exists¶
The official MCP Python SDK and FastMCP can expose Streamable HTTP. Tutorials show app.mount("/mcp", ...). That is enough for local demos.
Problems show up when you put the same pattern on Mangum with lifespan="off", share auth with a REST API, or hit Function URL slash redirects. This package is the small set of helpers we kept rewriting for that case:
- Stateless Streamable HTTP ASGI app (JSON responses, no session store)
- Path middleware instead of
Mountfor/mcp - Optional API key / JWT / dual auth, or
auth=Noneif the gateway already authenticated once_readyfor lazy init when lifespan never runs
It is not a tool framework. Register tools with the official SDK (or FastMCP). Use this to mount and protect /mcp next to your existing API.
What this is not¶
- Not AWS Serverless MCP Server (that product is guidance tools for SAM/Lambda).
- Not an SSE mount tutorial. Prefer Streamable HTTP for new remote servers.
- Not a stdio proxy. See
mcp-streamablehttp-proxyif you need that bridge.
Try it¶
Or run a fullstack sample and point Cursor / Claude at the public /mcp URL.