AGT-11Recommended
Build the MCP server without sessions
Answer every MCP request from that request alone. Read the protocol version and client capabilities from its _meta, and keep state across calls only behind handles passed as tool arguments.
How to do it
The 2026-07-28 revision removed the initialize handshake and the Mcp-Session-Id header. Every request carries io.modelcontextprotocol/protocolVersion and io.modelcontextprotocol/clientCapabilities in _meta. Implement server/discover, which the revision requires, so clients can see your versions and capabilities. Then any instance behind a load balancer can answer any request. Prove it as Run two copies of the app in staging says. Ignore an Mcp-Session-Id sent by an older client, and answer GET or DELETE on the endpoint with 405. Store cart or draft state under a handle that a tool returns, and check it as Check the caller's rights on every handle says. Pick an SDK that supports the revision, as Use the Model Context Protocol to give agents your tools says.
Examples
HTTP example
POST /mcp HTTP/1.1
Host: example.com
Content-Type: application/json
Accept: application/json, text/event-stream
MCP-Protocol-Version: 2026-07-28
Mcp-Method: tools/call
Mcp-Name: add_item
{"jsonrpc":"2.0","id":7,"method":"tools/call","params":{"name":"add_item",
"arguments":{"basket_id":"bsk_7Hq2","sku":"TENT-2P"},
"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}}}}
How to check
Run two server instances behind a round-robin proxy. A scripted client calls server/discover, creates a handle and uses it in three more calls. Every call succeeds, whichever instance answers. The server never sends an Mcp-Session-Id header.
Sources
Related rules
- SCL-6 Run two copies of the app in staging in Scaling
- AGT-12 Check the caller's rights on every handle in Agents as users
- STK-89 Use the Model Context Protocol to give agents your tools in Software choices
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/agents-as-users/mcp-servers/stateless-mcp-server">Agent Wranglers agents as users playbook</a>. In code you write, add a comment next to it with the same link.