# Moving MCP servers to 2026-07-28 without breaking older clients

> Most servers need no logic changes, but the TypeScript SDK will not upgrade itself, and choosing the wrong legacy mode breaks older clients immediately.

Original: https://fdetimes.net/en/guides/migrate-mcp-server-2026-07-28/

The MCP specification dated 2026-07-28 deletes the `initialize` / `notifications/initialized` handshake that every client used to perform before calling a tool. The `Mcp-Session-Id` header is gone too. Instead, each request carries its own protocol version and the client's capabilities in `_meta`.

It sounds like an overhaul, but the numbers in SEP-2567 are reassuring. An automated survey, using an LLM to classify a sample of 1,000 open-source MCP server repositories, found that 90.0% never reference a session ID at the application layer, so they have no logic to migrate. Only 2.5% keep application state per session.

The traps lie elsewhere. The TypeScript SDK does not move you to the new version automatically, the Python SDK has a misleading flag, and according to the compatibility matrix, old clients (2025-11-25 and earlier) calling a server that supports only the new version will fail, as will the reverse.

For an FDE running MCP servers for a client, a rushed upgrade can break the agents of an entire department. This guide walks through the migration step by step to avoid that.

## What you will do, and what you need

The goal is to move an MCP server running on Streamable HTTP to the 2026-07-28 version, keep serving old clients, and verify the result with a smoke test.

You need a server built on the TypeScript SDK or the Python SDK, and a terminal with `curl` and `grep`. The code below is simplified sketch code; check import names and function signatures against the SDK v2 documentation before copying.

## Step 1: does your server actually use sessions?

Measure before changing anything. Find every place the code reads a session ID:

```bash
grep -rn -i "mcp-session-id\|sessionid" src/
```

If the matches sit only in transport setup, you almost certainly belong to the 90.0%: the work is just changing how the server is constructed. If a tool reads the session ID to look up a shopping cart, a database connection or user context, flag that tool for step 4.

## Step 2: pin versions before touching code

Python SDK v2 renames `FastMCP` to `MCPServer`, imported from `mcp.server.mcpserver`. The SDK's migration guide advises packages that depend on `mcp` to keep an upper bound of `<2` until migration is finished, so that a stray `pip install` does not pull in v2 halfway through:

```toml
dependencies = ["mcp<2"]
```

Do the migration on a separate branch, and lift the upper bound only once the following steps pass.

## Step 3: in TypeScript, replace the hand-built transport with createMcpHandler

The TypeScript SDK v2 documentation is explicit: a manually instantiated `McpServer` still uses the 2025-era protocol and does not upgrade itself. To serve 2026-07-28 over HTTP, you must use `createMcpHandler(factory)`.

Vikram Vaswani's tutorial on the AAIF blog lays out the concrete path: switch the `@modelcontextprotocol/sdk` package to `@modelcontextprotocol/server`, and use `createMcpHandler()` with `toNodeHandler()` instead of building a `StreamableHTTPServerTransport` yourself.

```ts
// Sketch, simplified: check import paths and signatures against the SDK v2 docs
import http from 'node:http';
import { createMcpHandler } from '@modelcontextprotocol/server';
// Omitted here: import toNodeHandler (take the correct import path from the SDK v2 docs)

const handler = createMcpHandler(() => buildServer()); // factory that builds your server
http.createServer(toNodeHandler(handler)).listen(3000);
```

According to the AAIF post, the whole transport registry, session lookup, UUID generation and cleanup callbacks disappear. By default, this handler still serves 2025 traffic in stateless fashion; the `{ legacy: 'reject' }` option refuses old clients outright. Do not turn it on in a client environment until you have a list of the clients.

## Step 3b: in Python, do not trust stateless_http

In Python the rename is the easy part: `from mcp.server.mcpserver import MCPServer` instead of `FastMCP`. The part that misleads people is the `stateless_http=True` flag.

The "What's new in v2" documentation states that this flag affects only how 2025-era clients are served and has no effect on 2026 traffic. A common mistake is to see the word "stateless" in the flag's name, switch it on and consider the migration done.

**Key point:** A flag with stateless in its name is no proof that the server speaks the new protocol.

Since the flag proves nothing, the surest check is to send a request in the new format to the Python server: the `MCP-Protocol-Version` header plus `_meta` in the body, as in the sample request in step 6.

If `server/discover` lists 2026-07-28 and `tools/call` responds normally, the server is accepting new traffic. If not, consult the Python SDK v2 documentation on serving the new version before moving to step 4.

## Step 4: replace sessions with explicit handles

For the tools flagged in step 1, the new specification sets a simple rule: a server that needs to keep state across calls issues its own handle and receives it back as an ordinary tool parameter.

Take a hypothetical server that manages shopping carts and used to tie each cart to a session. Now the `open_cart` tool returns a `cart_id`, and `add_item` takes `cart_id` in its arguments. State is no longer hidden in the transport; it sits on the surface of the API, where the model can see it and pass it back.

Because it sits on the surface, the handle will leak. SEP-2567 warns that handles will drift into chat logs, clipboards and subagent prompts.

The SEP's design guidance (which is non-normative) is that authenticated servers should check the `(handle, auth_context)` pair on every call, while unauthenticated servers should generate handles with at least 128 bits of cryptographically secure entropy and limit their lifetime.

## Step 5: requestState is attacker data

If the server uses the Multi Round-Trip Requests (MRTR) pattern, the specification requires `requestState` to be treated as attacker-controlled input. Where it affects authorization, resource access or business logic, you must protect its integrity with HMAC or AEAD and reject state that fails verification. The spec also recommends binding it to a principal, a short TTL and the identifier of the original request.

Python SDK v2 seals `request_state` for you, but the default key is generated separately for each process. With one instance that is fine. With three instances behind a load balancer, state sealed by instance A will be rejected by instance B, so deployments with multiple replicas must pass a shared key through `RequestStateSecurity(keys=[...])`, drawn from a secret manager rather than hard-coded.

## Step 6: verify with a smoke test

The new transport rules are strict enough to test with `curl`. Every POST must carry an `MCP-Protocol-Version` header matching `io.modelcontextprotocol/protocolVersion` in the body's `_meta`, plus `Mcp-Method` on every request and `Mcp-Name` for `tools/call`, `resources/read` and `prompts/get`. A valid request looks like this (simplified; some servers may require extra headers such as `Accept`):

```bash
curl -i -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -H "MCP-Protocol-Version: 2026-07-28" \
  -H "Mcp-Method: tools/call" \
  -H "Mcp-Name: open_cart" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call",
       "params":{"name":"open_cart","arguments":{},
         "_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28",
                  "io.modelcontextprotocol/clientCapabilities":{}}}}'
```

Starting from that sample, change one thing at a time to test the cases below:

| Check | How | Expected result |
|---|---|---|
| Header does not match body | Keep the 2026-07-28 header, change the value in `_meta` | 400 Bad Request, HeaderMismatch error (-32020) |
| Version advertisement | Call `server/discover` | List of versions the server supports |
| Unknown version | Declare a version the server does not support | UnsupportedProtocolVersionError (-32022) with the supported list |
| Old-style traffic (new-version-only server) | `curl -i -X GET` or `-X DELETE` against the endpoint | 405 |
| Old session | Send an `Mcp-Session-Id` header | Ignored; the response contains no session ID |

`server/discover` is a mandatory server-side RPC, although clients are not required to call it first. A server that supports only the new version should also ignore `Last-Event-ID`. Put this whole table into CI so the next SDK upgrade cannot quietly break the protocol.

## The most common mistakes

The first is assuming that installing TypeScript SDK v2 is enough, when a hand-built `McpServer` still speaks the 2025 protocol. The second is switching on `stateless_http=True` in Python and closing the ticket.

The third is enabling `legacy: 'reject'` too early, landing squarely in the "fail" cell of the compatibility matrix. The last, and hardest to spot, is letting each replica generate its own sealing key and discovering it only when you scale out.

## Where this skill matters on a client deployment

At a client, you rarely control every caller: one team uses an IDE, another runs an internal agent written earlier in the year.

The specification allows a dual-era server to serve both eras, even simultaneously on the same endpoint, and that is the configuration to choose by default.

The first job is to list the clients and the protocol version each one uses; only then set a date to switch off old traffic.

If you are looking for FDE work, put this skill on your CV as measurable results: the number of tools moved to handles, the smoke test suite you added to CI, the number of days of dual-era running without incident. In an interview, how you explain why a handle must be bound to `auth_context` tells a hiring manager more than any line claiming "MCP experience".

The server may now be stateless, but its operator cannot afford to be: someone still has to remember which clients are on the old protocol.

**Try this week:**

- Grep an MCP server you maintain for Mcp-Session-Id and sessionId, and note which tools genuinely need state across calls.
- Write four curl smoke tests (GET returns 405, header-body mismatch returns 400, server/discover, Mcp-Session-Id ignored) and add them to CI.
- List the clients calling your client's server, with each one's protocol version, before deciding whether to enable legacy: 'reject'.

## Sources

- [Key Changes - Model Context Protocol (2026-07-28)](https://modelcontextprotocol.io/specification/2026-07-28/changelog.md)

- [Streamable HTTP - Model Context Protocol](https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-http.md)

- [Versioning and Compatibility - Model Context Protocol](https://modelcontextprotocol.io/specification/2026-07-28/basic/versioning.md)

- [SEP-2567: Sessionless MCP via Explicit State Handles](https://modelcontextprotocol.io/seps/2567-sessionless-mcp.md)

- [Multi Round-Trip Requests - Model Context Protocol](https://modelcontextprotocol.io/specification/2026-07-28/basic/patterns/mrtr.md)

- [Supporting protocol revision 2026-07-28 (MCP TypeScript SDK)](https://ts.sdk.modelcontextprotocol.io/v2/migration/support-2026-07-28.md)

- [Migration Guide - MCP Python SDK](https://py.sdk.modelcontextprotocol.io/migration/)

- [What's new in v2 (MCP Python SDK)](https://py.sdk.modelcontextprotocol.io/whats-new/index.md)

- [Migrate sessions to stateless requests with MCP 2026-07-28 (AAIF)](https://aaif.io/blog/migrate-sessions-to-stateless-requests-with-mcp-2026-07-28)
