Three production lessons for running a multi-tenant MCP server

No_Advertising2536 · reddit · 2026-07-20

The author shares three practical lessons from running a multi-tenant streamable-HTTP MCP server in production.

1) Session transport breaks with multiple workers

The SDK assumes follow-up requests will land on the same worker that handled initialize. With 2+ Gunicorn workers, that assumption fails and clients see intermittent errors. The fix is to make the transport stateless and create a fresh server per request.

2) Starlette route wrappers can break the ASGI cycle

Mounting a plain async function can cause TypeErrors because transport.handlerequest() manages the ASGI lifecycle itself. The solution is to mount a real ASGI callable class.

3) Multi-tenant auth needs per-request server creation

StreamableHTTPSessionManager uses a single server instance, which makes per-request bearer-token auth awkward. The author instead parses auth, constructs a tenant-bound server, and uses a fresh stateless transport.

They add that this has been stable for months, and disclose that the server is Mengram, a long-term memory product for agents with 29 MCP tools, a free tier, paid plans from $5/month, Apache 2.0/self-hostable, and an official MCP registry listing.

Original post →

More from coding & agent

coding & agent channel →