Migrating an MCP Server to the Stateless 2026 Spec
Migrating an MCP server to the 2026-07-28 spec means four changes: drop any reliance on the initialize handshake and the Mcp-Session-Id header, read version and capabilities from each request's _meta, send the new Mcp-Method and Mcp-Name headers, and replace server-initiated elicitation or sampling with Multi Round-Trip Requests. Auth moves from Dynamic Client Registration towards Client ID Metadata Documents.
The 2026-07-28 release post calls the removal of initialize and sessions a breaking change, and it is. If your server was written against 2025-11-25, it probably works today only because SDKs still serve old clients. This post is the order I would do the migration in, with the spec text behind each step, as of late November 2026.
What changed in the MCP 2026-07-28 spec?
The MCP 2026-07-28 spec makes the protocol core stateless: every request carries everything a server needs to process it. The official changelog lists nine major changes. The ones that touch most servers:
| Area | 2025-11-25 | 2026-07-28 |
|---|---|---|
| Connection setup | initialize / notifications/initialized handshake | No handshake; version and capabilities in each request's _meta; new server/discover RPC |
| Sessions | Mcp-Session-Id header | Removed; use explicit handles passed as tool arguments |
| Asking the user or model | Server-initiated elicitation/create, sampling/createMessage, roots/list | Multi Round-Trip Requests (resultType: "input_required") |
| HTTP headers | Body carries the method | Mcp-Method and Mcp-Name required on Streamable HTTP POSTs |
| Change notifications | HTTP GET endpoint, resources/subscribe | subscriptions/listen stream |
| Long-running work | Experimental tasks in core | io.modelcontextprotocol/tasks extension |
| Client registration | Dynamic Client Registration common | DCR deprecated in favour of Client ID Metadata Documents |
| Stream resumability | Last-Event-ID redelivery | Removed; re-issue the request with a new ID |
The changelog also removes ping and logging/setLevel, requires a resultType field on every result, and asks list endpoints to return ttlMs and cacheScope caching hints. Roots, Sampling and Logging are deprecated but keep working; the release post says they stay supported for at least twelve months.
If you are new to the protocol itself, start with what MCP is and come back.
How do you migrate an MCP server, step by step?
Migrating an MCP server works best as eight small steps, each testable on its own, starting with the SDK and ending with auth.
- Upgrade the SDK. In TypeScript, the SDK guide for 2026-07-28 uses the v2 packages (
@modelcontextprotocol/server,@modelcontextprotocol/client) and says nothing uses the new revision by default: you opt in. In Python, the v2 "what's new" page sayspip install mcpinstalls 2.x, thatFastMCPis renamedMCPServer(from mcp.server import MCPServer), and that v2 serves both revisions at once. - Find and remove session state. Search for anything keyed on
Mcp-Session-Idor a per-connection object. The changelog's replacement is an explicit, server-minted handle returned by one tool and passed back as an ordinary argument to the next, for exampleopen_cartreturningcart_id. - Read context from `_meta`, not from `initialize`. Each request now carries
io.modelcontextprotocol/protocolVersionandio.modelcontextprotocol/clientCapabilities; clients should sendclientInfoand servers should returnserverInfoin each result. A mismatched version returnsUnsupportedProtocolVersionError. - Implement `server/discover`. The changelog says servers MUST implement it to advertise versions, capabilities and identity. Current SDKs generate it for you.
- Handle the new headers. Streamable HTTP POSTs must carry
Mcp-MethodandMcp-NamealongsideMCP-Protocol-Version. The TypeScript guide says missing or mismatched values return HTTP 400 with error code-32020. - Convert elicitation and sampling to MRTR. Covered in detail below.
- Move tasks and notifications. Adopt the tasks extension (polling with
tasks/get) andsubscriptions/listeninstead of the old GET endpoint. - Update auth. Covered in the auth section below.
In the TypeScript v2 SDK, the HTTP entry point is createMcpHandler(() => new McpServer(...)), which builds a fresh server per request and by default also serves 2025-era clients (legacy: 'stateless'); legacy: 'reject' serves only the new revision. For stdio, the guide replaces server.connect(new StdioServerTransport()) with serveStdio(() => buildServer()). On the client side, versionNegotiation: { mode: 'auto' } probes with server/discover and falls back.
How do Multi Round-Trip Requests replace elicitation and sampling?
Multi Round-Trip Requests (MRTR) replace server-initiated requests with a result that asks the client to retry: the server returns resultType: "input_required" with an inputRequests map, and the client re-sends the original call with inputResponses. The MRTR page of the spec says servers MUST use this pattern for elicitation/create, sampling/createMessage and roots/list, and that the old pattern is no longer supported.
The flow, using a tool that needs the user's GitHub login:
- The client calls
tools/callwith id 1. - The server returns an
InputRequiredResultwhoseinputRequestscontains a key such asgithub_loginwith anelicitation/createrequest, plus an optional opaquerequestState. - The client asks the user, then retries
tools/callwith a new id, the answers ininputResponsesunder the same keys, and the exactrequestStateechoed back. - Any server instance can complete the call, because everything it needs is in the retry.
MRTR is only allowed on tools/call, prompts/get and resources/read. The security rules matter more than the shape. The spec says servers MUST treat requestState as attacker-controlled input and MUST protect its integrity (HMAC or AEAD) whenever it influences authorisation, resource access or business logic. It recommends binding the state to the authenticated principal, a short expiry and a digest of the original request. In TypeScript that is createRequestStateCodec({ key: SECRET }) wired into the server's requestState.verify option, with handlers returning inputRequired({ inputRequests: { ... } }) and reading answers with acceptedContent(ctx.mcpReq.inputResponses, 'count', SCHEMA). In Python, the v2 page shows an Elicit("How many copies?", Quantity) resolver attached to a tool parameter, and notes that ctx.elicit() raises NoBackChannelError on 2026 connections, so old code fails loudly rather than silently.
If you scale out, every replica needs the same signing keys. The Python page says retries need a shared RequestStateSecurity(keys=[...]) across workers. I treat a missing shared key as a launch blocker.
What does the 2026 spec change for MCP authorization?
The 2026-07-28 spec deprecates OAuth Dynamic Client Registration as a client registration mechanism in favour of Client ID Metadata Documents (CIMD), and adds issuer checks. Under the client registration page, a client's client_id is an HTTPS URL with a path, pointing to a JSON document that must include client_id, client_name and redirect_uris, with client_id matching the URL exactly.
What to change:
- Authorization servers: advertise
client_id_metadata_document_supported: truein OAuth metadata, fetch and validate the document, and validate redirect URIs against it. - Clients: prefer pre-registered credentials, then CIMD, then DCR as a fallback, in that order. If you keep DCR, send an
application_type(nativefor desktop, CLI and localhost apps). - Everyone: validate a present
issparameter against the recorded issuer before redeeming an authorization code (RFC 9207), and key stored client credentials by issuer, re-registering when the authorization server changes.
DCR still works for authorization servers that do not support CIMD, and the release post gives no removal date. For the wider picture of scopes and token handling, see how AI agents authenticate, and for the threat model behind these rules, MCP security risks.
How do you test a migrated MCP server before cutting over?
Testing a migrated MCP server means proving three things: new clients work without a session, old clients still work, and a retry can land on a different instance. The TypeScript guide notes that createMcpHandler can be driven in-process through its fetch function, which makes these tests cheap.
My checklist:
- Call every tool with only
_metaand no prior handshake; confirm results carryresultType. - Send a request with a missing or wrong
Mcp-Nameand expect a 400. - Run one MRTR flow end to end, then replay the same
requestStateas a different user and after its expiry; both must fail. - Put two instances behind a plain round-robin balancer and run the MRTR flow 50 times.
- Connect a 2025-era client and confirm it still lists and calls tools.
- Check gateways and WAF rules route on
Mcp-Methodinstead of parsing JSON bodies, as the release post suggests.
Plan the legacy lane deliberately. Serving both revisions is the default in both SDKs, which is convenient, but set a date to stop accepting 2025 traffic once your clients have moved. For servers that wrap internal tools, the scoping notes in MCP servers for internal tools still apply.
Work with me
I build and migrate MCP servers for teams that want their tools available to Claude, ChatGPT and their own agents. See MCP server development or AI agent development, and browse my work before booking a scoping call.
Frequently asked
Will my 2025-era MCP server stop working with new clients?
Not immediately. Both official SDKs serve 2025-era and 2026-era clients side by side by default, and clients can negotiate down. The risk is clients that pin the new revision, and server code that relies on sessions or server-initiated elicitation, which has no back channel on 2026 connections.
Do I still need a database for session state after the migration?
Only for state your application genuinely owns. The protocol no longer gives you a session, so cross-call state becomes an explicit handle passed as a tool argument, backed by whatever store you choose. MRTR state can travel in a signed requestState instead of a server-side store.
Are Sampling and Roots removed in MCP 2026-07-28?
No. They are deprecated, which means they still work but new implementations should not adopt them. The changelog suggests calling LLM provider APIs directly instead of Sampling and passing directories through tool parameters or configuration instead of Roots.
Is Dynamic Client Registration still allowed?
Yes, as a fallback. DCR remains in the spec for backwards compatibility with authorization servers that do not support Client ID Metadata Documents, but it is deprecated and clients should prefer pre-registration or CIMD where available.
Sources
- 2026-07-28 release post (blog.modelcontextprotocol.io)
- official changelog (modelcontextprotocol.io)
- SDK guide for 2026-07-28 (ts.sdk.modelcontextprotocol.io)
- v2 "what's new" page (py.sdk.modelcontextprotocol.io)
- MRTR page of the spec (modelcontextprotocol.io)
- client registration page (modelcontextprotocol.io)
Related services
Building something like this?
Naman Gundaniya takes on full-stack and AI projects: fixed quote after a free 30-minute scoping call, replies within 24 hours.
Get in touch