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.

A flat timeline chart in which a tangled session cord on the left becomes a row of separate, identical request cards on the right, with one sky-blue arrow.

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:

Area2025-11-252026-07-28
Connection setupinitialize / notifications/initialized handshakeNo handshake; version and capabilities in each request's _meta; new server/discover RPC
SessionsMcp-Session-Id headerRemoved; use explicit handles passed as tool arguments
Asking the user or modelServer-initiated elicitation/create, sampling/createMessage, roots/listMulti Round-Trip Requests (resultType: "input_required")
HTTP headersBody carries the methodMcp-Method and Mcp-Name required on Streamable HTTP POSTs
Change notificationsHTTP GET endpoint, resources/subscribesubscriptions/listen stream
Long-running workExperimental tasks in coreio.modelcontextprotocol/tasks extension
Client registrationDynamic Client Registration commonDCR deprecated in favour of Client ID Metadata Documents
Stream resumabilityLast-Event-ID redeliveryRemoved; 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.

Flowchart of the MCP 2026-07-28 migration in eight steps. Step 1, upgrade the SDK. Step 2, remove session state and replace it with explicit handles. Step 3, stop reading initialize and read _meta per request. Step 4, implement server/discover. Step 5, accept Mcp-Method and Mcp-Name headers. Step 6, convert elicitation and sampling to MRTR with signed requestState. Step 7, move tasks and notifications to the extension and subscriptions/listen. Step 8, switch auth to CIMD with issuer checks. A side lane shows legacy 2025 clients served in parallel until traffic drains.
The eight-step migration, with a legacy lane kept open while old clients drain.
  • 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 says pip install mcp installs 2.x, that FastMCP is renamed MCPServer (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-Id or 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 example open_cart returning cart_id.
  • Read context from `_meta`, not from `initialize`. Each request now carries io.modelcontextprotocol/protocolVersion and io.modelcontextprotocol/clientCapabilities; clients should send clientInfo and servers should return serverInfo in each result. A mismatched version returns UnsupportedProtocolVersionError.
  • 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-Method and Mcp-Name alongside MCP-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) and subscriptions/listen instead 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/call with id 1.
  • The server returns an InputRequiredResult whose inputRequests contains a key such as github_login with an elicitation/create request, plus an optional opaque requestState.
  • The client asks the user, then retries tools/call with a new id, the answers in inputResponses under the same keys, and the exact requestState echoed 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: true in 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 (native for desktop, CLI and localhost apps).
  • Everyone: validate a present iss parameter 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 _meta and no prior handshake; confirm results carry resultType.
  • Send a request with a missing or wrong Mcp-Name and expect a 400.
  • Run one MRTR flow end to end, then replay the same requestState as 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-Method instead 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

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