# Migrating an MCP Server to the Stateless 2026 Spec

> An MCP 2026-07-28 migration guide: remove sessions and the handshake, add Mcp-Method headers, move elicitation to MRTR and switch auth to CIMD, step by step.

- Author: Naman Gundaniya (https://hellonaman.com)
- Published: 2026-12-03
- Updated: 2026-12-03
- Canonical URL: https://hellonaman.com/blog/mcp-2026-07-28-migration

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](https://blog.modelcontextprotocol.io/posts/2026-07-28/) 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](https://modelcontextprotocol.io/specification/2026-07-28/changelog.md) 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](https://hellonaman.com/blog/what-is-mcp) 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.](https://hellonaman.com/blog/mcp-2026-07-28-migration/diagram.svg)

*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](https://ts.sdk.modelcontextprotocol.io/v2/migration/support-2026-07-28.md) 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](https://py.sdk.modelcontextprotocol.io/v2/whats-new/) 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](https://modelcontextprotocol.io/specification/2026-07-28/basic/patterns/mrtr.md) 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](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/client-registration.md), 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](https://hellonaman.com/blog/ai-agent-authentication), and for the threat model behind these rules, [MCP security risks](https://hellonaman.com/blog/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](https://hellonaman.com/blog/mcp-server-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](https://hellonaman.com/services/mcp-server-development) or [AI agent development](https://hellonaman.com/services/ai-agent-development), and browse [my work](https://hellonaman.com/work) before booking a scoping call.

## FAQ

### 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)](https://blog.modelcontextprotocol.io/posts/2026-07-28/)
- [official changelog (modelcontextprotocol.io)](https://modelcontextprotocol.io/specification/2026-07-28/changelog.md)
- [SDK guide for 2026-07-28 (ts.sdk.modelcontextprotocol.io)](https://ts.sdk.modelcontextprotocol.io/v2/migration/support-2026-07-28.md)
- [v2 "what's new" page (py.sdk.modelcontextprotocol.io)](https://py.sdk.modelcontextprotocol.io/v2/whats-new/)
- [MRTR page of the spec (modelcontextprotocol.io)](https://modelcontextprotocol.io/specification/2026-07-28/basic/patterns/mrtr.md)
- [client registration page (modelcontextprotocol.io)](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/client-registration.md)
