• AI
  • MCP
  • backend

What stateless MCP changes for server deployment

See which MCP 2026-07-28 changes affect a deployed server: no initialize handshake or Mcp-Session-Id, per-request _meta, MRTR, the Tasks extension, and a new error code.

Imagine a bank with several counters. In the old way of working, you tell your story to the clerk at counter 1. If you come back later and counter 1 is busy, the clerk at counter 3 knows nothing about you. You have to wait for counter 1, or the bank has to copy every conversation to every clerk. In the new way, you bring a filled-in form every time. Any free clerk can read it and help you straight away.

The MCP specification revision 2026-07-28 makes the same switch for AI tool servers. This article explains what changed, why it matters when you run more than one server instance, and how to migrate step by step. The authoritative list of changes is the 2026-07-28 changelog. The earlier release-candidate post gives background on why the changes were made.

The basic ideas in plain words

MCP (Model Context Protocol) is an open protocol that lets an AI application, such as a chat app or coding agent, call tools and read data from a separate program. The AI application is the client. The program that offers the tools is the MCP server.

MCP messages use JSON-RPC, a simple format where each message is a JSON object with a method (what to do), params (the input), and an id that links a response to its request.

A session is memory that the server keeps about one client between requests. In older MCP versions, the client and server first ran a handshake: an opening exchange (initialize) where they agreed on a protocol version and capabilities. Over HTTP, the server could then give the client a session ID in the Mcp-Session-Id header. The client sent that ID on every later request.

A server instance is one running copy of your server program. When traffic grows, you run several instances behind a load balancer: a component that spreads incoming requests across the instances.

Stateless means the server does not need memory of earlier requests to handle the next one. Each request carries everything needed, like the filled-in form in the bank.

Why sessions make scaling hard

Sessions and load balancers do not mix well. Suppose instance A handled the handshake and stored the session in its process memory. The load balancer sends the next request to instance B. Instance B has never seen that session ID.

Teams usually work around this in one of two ways. The first is sticky routing: the load balancer always sends a client to the same instance. The second is a shared store, such as Redis, that every instance reads sessions from. Both add work and new ways to fail. If instance A restarts, its in-memory sessions are gone.

The 2026-07-28 revision removes protocol-level sessions. Any healthy instance can handle any request. That is the main reason to care about this change if you deploy MCP servers.

What the revision removes and adds

Changes in MCP are proposed as SEPs (Specification Enhancement Proposals): numbered documents, each linked below. These are the changes from the changelog that matter most for deployment:

  • No handshake. The initialize / notifications/initialized exchange is gone. Each request carries its protocol version and client capabilities in _meta, a metadata object inside params (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities). Clients should also send io.modelcontextprotocol/clientInfo. Servers should return io.modelcontextprotocol/serverInfo in each result’s _meta (SEP-2575).
  • server/discover. Servers must implement this method. It advertises the supported versions, capabilities and server identity. Clients may call it first. They can also send any request directly and handle UnsupportedProtocolVersionError if the version is wrong (SEP-2575).
  • No Mcp-Session-Id. Streamable HTTP, the HTTP transport of MCP, no longer has protocol sessions. tools/list, resources/list and prompts/list no longer vary per connection. Servers that need state across calls use explicit handles. A handle is an ID minted by the server and passed back as an ordinary tool argument (SEP-2567).
  • No server-initiated requests. Before, a server could send its own request to the client in the middle of a tool call. Examples are sampling/createMessage (ask the client’s model for text), elicitation/create (ask the user a question) and roots/list (ask which folders are available). That is no longer allowed. It is replaced by MRTR (Multi Round-Trip Requests). The server answers a tools/call, resources/read or prompts/get with an InputRequiredResult (resultType: "input_required"). That result lists what it needs in inputRequests. The client then retries the original request with inputResponses. If the server included requestState, the client sends it back unchanged (SEP-2322).
  • Deprecations. Roots, Sampling and Logging are deprecated. They still work during the deprecation window, but new implementations should not add them (SEP-2577).
  • Tasks became an extension. A task is a handle for work that takes a long time. Experimental tasks moved out of the core protocol into the official io.modelcontextprotocol/tasks extension. Clients check progress with tasks/get, send input with tasks/update, and can ask to cancel with tasks/cancel. tasks/list was removed (SEP-2663, Tasks overview).
  • New error code. “Resource not found” changed from -32002 to -32602 (Invalid Params) (SEP-2164).

On HTTP, every POST must also carry three headers. MCP-Protocol-Version repeats the version. Mcp-Method repeats the method. Mcp-Name repeats the tool, prompt or resource name for tools/call, resources/read and prompts/get. If headers and body disagree, the server must reply 400 Bad Request with error -32020 (HeaderMismatch) (Streamable HTTP transport). The reason: load balancers and gateways can route on headers without parsing the JSON body, and the check stops them from being fooled by a body that says something else.

The same tool call, before and after

In the legacy flow (2025-11-25 and earlier), the client first sends initialize. The server may return an Mcp-Session-Id response header. The client sends notifications/initialized. Later calls depend on that session:

POST /mcp HTTP/1.1
Content-Type: application/json
Accept: application/json, text/event-stream
MCP-Protocol-Version: 2025-11-25
Mcp-Session-Id: 1868a90c-...

{"jsonrpc": "2.0", "id": 3, "method": "tools/call",
 "params": {"name": "get_weather", "arguments": {"location": "Seattle, WA"}}}

If this request reaches an instance that did not handle initialize, the session is unknown there.

Under 2026-07-28 there is no prior handshake. The request describes itself. This example follows the one in the Streamable HTTP page of the specification:

POST /mcp HTTP/1.1
Content-Type: application/json
Accept: application/json, text/event-stream
MCP-Protocol-Version: 2026-07-28
Mcp-Method: tools/call
Mcp-Name: get_weather

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_weather",
    "arguments": { "location": "Seattle, WA" },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientInfo": { "name": "ExampleClient", "version": "1.0.0" },
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Any healthy instance can handle it. The specification says a modern-only server that still receives Mcp-Session-Id from an older client should ignore the header. It should not mint or echo session IDs.

Separate transport state from application state

Removing protocol sessions does not make your application stateless. A tool that starts a report still has to store the job somewhere. What changes is where that state lives and how the client refers to it.

Input in the middle of a request. With MRTR, the server returns inputRequests. It can put whatever it needs to continue into requestState. The retry may reach a different instance, so that instance must be able to work from the retry alone. The spec treats requestState as attacker-controlled input, because it passes through the client. If it affects authorization or business logic, protect it with an HMAC or AEAD (two ways to detect tampering with a secret key). Bind it to the user, a short expiry and the original request.

Long-running work. Do not build your own “job ID and poll” protocol. Use the Tasks extension when both sides support it. The client declares io.modelcontextprotocol/tasks in clientCapabilities.extensions. The server advertises it in server/discover. The server may then answer a supported request with resultType: "task", a taskId, ttlMs (how long the task is kept) and pollIntervalMs (how often to check). The overview says the task must be stored durably before that response is sent. Never return a task to a client that did not declare the extension.

Other cross-call state. For state that is neither of these, SEP-2567 points to server-minted handles passed as normal tool arguments. Store the data behind the handle in a database or queue, not in process memory.

Apply authorization on every request. A task ID or handle must not work like a password that lets one user read another user’s work.

Migration steps

  1. Find out which clients you serve. Check your logs for the MCP-Protocol-Version values and client names you receive. This tells you whether you must keep supporting the legacy handshake.
  2. Upgrade the server SDK. Use a release of your MCP SDK that explicitly supports 2026-07-28. Support depends on the SDK and the client, so read its release notes rather than assuming.
  3. List session assumptions in your code. Search for per-session variables, logic that runs on initialize, server-to-client requests sent from inside a tool handler, and calls to tasks/list, ping or logging/setLevel (also removed by this revision).
  4. Move state out of process memory. Put long jobs behind the Tasks extension. Put mid-request questions behind MRTR with protected requestState. Put other state behind handles stored in a database.
  5. Update client-side error handling. Anywhere code checks for -32002 to mean “resource not found”, also accept -32602.
  6. Decide on old clients. The versioning page allows a “dual-era” server. A request with modern _meta is served statelessly. An initialize request selects legacy behavior for that session. A legacy client cannot talk to a modern-only server, so keep the legacy path until your logs show the clients you need have moved.
  7. Remove sticky routing last. Only after tests pass across instances (see the checklist below) should you turn off sticky sessions or the shared session store.

The changelog also documents conventions for carrying OpenTelemetry trace context (traceparent, tracestate, baggage) in _meta. If you trace agent runs, tracing AI agents with OpenTelemetry covers how to read the resulting spans.

Common mistakes

  • Thinking “stateless” means “no database”. Only the protocol session is gone. Jobs, handles and user data still need durable storage.
  • Trusting requestState as-is. It comes back from the client. Unsigned state that controls access can be edited.
  • Treating a task ID as proof of access. Check that the caller owns the task on every tasks/get, tasks/update and tasks/cancel.
  • Forgetting the HTTP headers. A body with correct _meta but missing Mcp-Method or Mcp-Name is rejected.
  • Hard-coding -32002. A 2026-07-28 server returns -32602 for a missing resource.
  • Removing the legacy path too early. Older clients have no way to “fall forward” to the new protocol and will simply fail.

Test checklist

  • A tools/call routed to an instance that never saw an earlier request from this client succeeds.
  • A request with a mismatched Mcp-Name header gets 400 and -32020. A request with an unsupported version gets UnsupportedProtocolVersionError listing the supported versions.
  • An MRTR retry handled by a different instance completes. A tampered, expired or other user’s requestState is rejected.
  • A task created on one instance can be read with tasks/get from another instance after a process restart. An unknown or foreign taskId returns an error, not data.
  • Client code that detects “resource not found” by matching -32002 also handles -32602. Keep -32002 only if you still talk to legacy servers.
  • If you run a dual-era server, a legacy client still completes initialize and its calls. A legacy client against a modern-only endpoint gets an error that names the supported versions.

Conclusion

MCP 2026-07-28 removes the handshake and Mcp-Session-Id, so any instance can handle any request, like any free clerk reading a filled-in form. The state your product needs does not disappear. It moves into protected requestState, durably stored Tasks, or explicit handles. Check your SDK version, list the places that assume a session, update error handling for -32602, and test requests across instances and protocol versions before you remove sticky routing.

Written by Duy Pham Independent developer. I build the apps on this site and write about how they work.

More about me