What is the main scaling tradeoff introduced by stateful MCP sessions?
A stateful MCP session pins a client to one server instance, so the load balancer needs sticky routing, which blocks the stateless horizontal scaling that cloud replicas rely on.
Think of a coat check at a theater. The first time you arrive, you hand over your coat and get a numbered ticket; the attendant remembers which hook holds your coat for the whole evening. That memory is convenient: you do not re-describe your coat every time. But it means you must return to that exact attendant. If the theater hires ten attendants and sends you to a random one, only the one holding your ticket can find your coat. A stateful MCP session works the same way. The server remembers your session in its own memory after one setup handshake, so later messages get there fast. The cost is that every later message has to come back to that same server; you cannot just spray requests across a fresh pool of identical servers.
Detailed answer & concept explanation~8 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: session lifecycle and capability negotiation, what the persistent channel buys, why in-memory state forces sticky routing, the conflict with stateless scaling, and the stateless-mode or shared-store mitigations.
| Concern | Stateful MCP session | Stateless request-response |
|---|---|---|
| Capability negotiation | Once at initialize, reused | Implied or repeated per call |
| Notifications, subscriptions | Yes, pushed over live channel | No, client must poll |
| Routing requirement | Sticky, affinity to one instance | Any replica, fully interchangeable |
| Horizontal scaling | Constrained, pinned traffic | Native, spread freely |
| Failure on instance loss | Session dies, must reconnect | Retry hits any healthy replica |
Real products, models, and research that use this idea.
- Claude Code keeps a live MCP session per server so tools/list_changed and resource subscriptions push updates without re-handshaking.
- The Streamable HTTP transport, the 2025 successor to HTTP+SSE, adds a stateless mode precisely so remote MCP servers can scale across replicas.
- Teams hosting remote MCP servers behind AWS ALB or NGINX enable session affinity, or externalize session state to Redis, to survive autoscaling and rolling deploys.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you make a remote MCP server horizontally scalable while still supporting subscriptions?
QWhat does the Streamable HTTP transport change versus the old HTTP+SSE transport for scaling?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Picking TLS or disk serialization. The real cost is sticky routing: session state lives in one instance's memory, so the load balancer must pin the client there.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.