MCP Spec 2026-07-28: Stateless Protocol and Server Migration
What is MCP spec 2026-07-28?
MCP 2026-07-28 is a revision of the Model Context Protocol specification that makes the protocol stateless: the initialize handshake and the Mcp-Session-Id header are gone, and the protocol version and client capabilities travel in the _meta of every request. The revision adds a required server/discover method, replaces server-to-client requests with Multi Round-Trip Requests, and moves Roots, Sampling, Logging and Dynamic Client Registration to Deprecated status.
TL;DR
- -MCP 2026-07-28 has no initialize and no protocol sessions: every request is self-contained, and any replica can handle it. Application state between calls still has to live somewhere, and it's passed as an explicit identifier in tool arguments.
- -A server on Python SDK mcp 2.x serves new and old clients at one address with no configuration. In the author's measurement on mcp 2.3.0, an mcp 1.30.0 client connected to it over 2025-11-25 and called a tool.
- -A client that speaks only 2026-07-28 doesn't work with an old server, and the reverse holds too: an old client can't connect to a server that serves only the new revision.
- -Calling ctx.elicit() on a 2026-07-28 connection fails with code -32600. The Python SDK replacement is a parameter with Resolve and Elicit: one piece of code works in both revisions.
- -Claude Code negotiates 2026-07-28 by default; in Codex CLI 0.172.0 the mcp_2026_07_28 flag is off. Roots, Sampling, Logging and DCR can be removed no earlier than a revision released on or after 2027-07-28.
MCP spec 2026-07-28 is a revision of the Model Context Protocol specification that makes the protocol stateless. The initialize handshake and the Mcp-Session-Id header are removed, and every request carries the protocol version and client capabilities itself. The server can no longer send the client a request in the middle of a call: it returns the question as a result and waits for a retry.
You don’t have to rewrite everything at once. A server on Python SDK 2.x answers both new and old clients at one address. What breaks is code that calls back to the client from inside a tool, keeps data in the session, or imports FastMCP from the official SDK.
This article covers what changed, which client and server pairs are compatible, and how to move a server from mcp 1.x to 2.x. Observations marked “author’s measurement” were made on November 29, 2026 on macOS with Python 3.13 and mcp 2.3.0, with mcp 1.30.0 for comparison; each scenario was run once. Everything else follows the specification and documentation as of the same date. What MCP is and how the exchange works is described in MCP servers explained.
What changed in MCP 2026-07-28
The previous revision was 2025-11-25. The changelog lists nine major and twelve minor changes. The table has the ones that affect server and client code; the “Breaks” column is the author’s assessment and isn’t in the changelog.
| Was in 2025-11-25 | Now in 2026-07-28 | Breaks |
|---|---|---|
initialize and notifications/initialized | Version and capabilities in the _meta of every request (SEP-2575) | Server and client |
Mcp-Session-Id | No sessions, state through explicit identifiers (SEP-2567) | Server, client, gateway |
Server capabilities in the initialize response | server/discover method: required for the server, optional for the client to call | Hand-written server |
| Server requests: elicitation, sampling, roots | Multi Round-Trip Requests (SEP-2322) | Tools that ask the client questions |
GET stream, resources/subscribe | One subscriptions/listen stream | Server and client with notifications |
ping, logging/setLevel | Removed, log level in the request’s _meta | Code that calls them |
SSE resumption through Last-Event-ID | Removed, the client repeats the request with a new id | Long calls |
| Experimental tasks in the core | io.modelcontextprotocol/tasks extension (SEP-2663) | Anyone who used tasks |
| Request body | Plus required Mcp-Method and Mcp-Name headers (SEP-2243) | Hand-written HTTP client |
| Result without service fields | resultType is required; server/discover, lists and resources/read also need ttlMs and cacheScope | Hand-written server |
”Resource not found” is -32002 | -32602 | Client that expects the old code |
A separate group of changes concerns OAuth: the client validates iss in the authorization response if it’s present, and binds its credentials to the authorization server that issued them. The general threat model is covered in MCP security.
Sessions were removed because clients understood them differently. The authors of SEP-2567 write that some created a session per tool call, others per application launch, others per page load, and “almost none resume them”. A server author couldn’t predict how long the data inside would live.
What a request without a handshake looks like
A tool can be called with one POST. The convert server from the author’s measurement (mcp 2.3.0) answered this request with no prior connection:
curl -s http://127.0.0.1:8931/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H 'MCP-Protocol-Version: 2026-07-28' \
-H 'Mcp-Method: tools/call' \
-H 'Mcp-Name: convert' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{
"name":"convert","arguments":{"amount":10,"currency":"EUR"},
"_meta":{
"io.modelcontextprotocol/protocolVersion":"2026-07-28",
"io.modelcontextprotocol/clientInfo":{"name":"curl","version":"0"},
"io.modelcontextprotocol/clientCapabilities":{}}}}'
The response is HTTP 200 and application/json with resultType: complete, and the server name is in _meta. The method and tool name are duplicated in headers so a load balancer or gateway can route the request without parsing the body. The server must check the headers against the body and reject a mismatch.
How the server answers bad requests (author’s measurement, mcp 2.3.0):
| Request | Response | JSON-RPC code |
|---|---|---|
Mcp-Name doesn’t match the body | HTTP 400 | -32020, HeaderMismatch |
No Mcp-Method or Mcp-Name | HTTP 400 | -32020 |
Version differs between the header and _meta | HTTP 400 | -32020 |
Unknown version 2099-01-01 | HTTP 400 | -32022, list of versions in data.supported |
No _meta | HTTP 400 | -32602 |
ping | HTTP 404 | -32601 |
| GET or DELETE | HTTP 405 | none |
No version header, but a new-style _meta | HTTP 400 | -32600, “Missing session ID” |
The last row is confusing when you debug. The SDK picks a processing branch by the MCP-Protocol-Version header, so a request without it lands in the old branch, and the server demands a session that doesn’t exist in the new revision. If you see “Missing session ID”, start with the client’s headers and proxy rules.
Compatibility of old and new clients
The specification divides implementations into modern, legacy and dual-era: only 2026-07-28 and newer, only 2025-11-25 and older, or both. The matrix from the specification:
| Client | Modern server | Legacy server | Dual-era server |
|---|---|---|---|
| modern | Works | Fails | Works |
| legacy | Fails | Works | Works |
| dual-era | Works | Works, falls back to initialize | Works |
Old clients have no way to move forward, so a server on the new revision only loses them. For a public server, dual-era is the sensible option.
Author’s measurement, mcp 2.3.0 and 1.30.0:
- Client 1.30.0 to server 2.3.0:
initialize, version 2025-11-25, session id issued, the call went through. - Client 2.3.0 in
automode to server 1.30.0: the first request got a 400, the client fell back toinitialize, the call went through. - Client 2.3.0 with the version pinned to
2026-07-28to server 1.30.0: connected without an error, failed on the first request with -32600 “Missing session ID”.
The third case has an explanation: a pinned version sends neither a probe nor a handshake, the client takes your word for it. If the servers aren’t yours, leave auto.
One more detail: on server/discover, the dual-era server returned supportedVersions: ["2026-07-28"] without the old versions, although it serves them too. You can’t tell from this field whether it will accept a 2025 client.
What’s deprecated and when it can be removed
Features can now be removed only after a deprecation period: at least twelve months, shorter if there’s an active security risk. The deprecated registry as of November 29, 2026:
| Feature | Replacement | Earliest removal |
|---|---|---|
| Roots | Tool parameters, resource URIs, server configuration | First revision released on or after 2027-07-28 |
| Sampling | Direct calls to the model API | Same |
| Logging | stderr on stdio, OpenTelemetry | Same |
| Dynamic Client Registration | Client ID Metadata Documents | Same |
includeContext: "thisServer" and "allServers" | Omit the field or use "none" | Together with Sampling |
| HTTP+SSE | Streamable HTTP | Sources disagree |
The date means removal becomes possible; maintainers decide when preparing a release. For HTTP+SSE there’s no exact date: the registry says “Three months after SEP-2596 reaches Final”, while the release announcement promises “a year-long offramp”. Don’t start a new server on this transport.
Which SDK version to install
All four tier 1 SDKs (TypeScript, Python, Go, C#) supported the revision on release day. Snapshot as of November 29, 2026:
| Package | Current version | New revision |
|---|---|---|
Python mcp 2.x | 2.3.0 (2026-10-02) | On from the start, both eras |
Python mcp 1.x | 1.30.0 (2026-09-07) | Only 2025-11-25 in the author’s measurement |
TypeScript @modelcontextprotocol/server, client | 2.4.0 (2026-10-23) | Enabled explicitly |
TypeScript @modelcontextprotocol/sdk (v1) | 1.32.2 (2026-10-23) | No support stated |
| FastMCP (standalone framework) | 4.2.6 | Since version 4.0 |
pip install mcp now installs 2.x. If your code is still on 1.x, pin mcp>=1.28,<2. The documentation requires Python 3.11+, although the package metadata on PyPI allows 3.10. FastMCP is a separate project, with a tutorial in MCP server in Python; below is the official SDK.
Migrating a Python server from mcp 1.x to 2.x
The code in this section was run on mcp 1.30.0 (“before”) and 2.3.0 (“after”). The full list of changes is in the migration guide.
Step 1. Import and transport parameters
# before: mcp 1.30.0
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("rates", port=8932)
# ... tools ...
mcp.run(transport="streamable-http")
# after: mcp 2.3.0
from mcp.server import MCPServer
mcp = MCPServer("rates", version="1.0.0")
# ... the same tools ...
mcp.run(transport="streamable-http", port=8931)
The @mcp.tool(), @mcp.resource() and @mcp.prompt() decorators haven’t changed. The old import on 2.3.0 fails with ModuleNotFoundError and the hint “FastMCP was renamed to MCPServer”, and MCPServer("x", port=1) raises TypeError (author’s measurement).
Step 2. Client and field names
# before: mcp 1.30.0
async with streamablehttp_client(url) as (read, write, get_session_id):
async with ClientSession(read, write) as session:
await session.initialize()
tools = (await session.list_tools()).tools
print(tools[0].inputSchema)
# after: mcp 2.3.0
from mcp import Client
async with Client(url) as client:
tools = (await client.list_tools()).tools
print(client.protocol_version, tools[0].input_schema)
Python fields are now snake_case, while JSON on the wire stays camelCase. Add by_alias=True to your own model_dump() calls, or the JSON will contain input_schema instead of inputSchema. The error class is renamed too: McpError is now MCPError. The SDK moved from httpx to httpx2, so check any httpx exception handling around the client as well.
Step 3. Asking the user: ctx.elicit → Resolve
# before: mcp 1.30.0
@mcp.tool()
async def book_table(date: str, ctx: Context) -> str:
"""Book a table after the user confirms."""
answer = await ctx.elicit(f"Book a table for {date}?", schema=Confirmation)
if answer.action == "accept" and answer.data.confirm:
return f"Booked for {date}."
return "No booking made."
# after: mcp 2.3.0
from typing import Annotated
from mcp.server.mcpserver import Elicit, Resolve
async def ask_to_confirm(date: str) -> Elicit[Confirmation]:
return Elicit(f"Book a table for {date}?", Confirmation)
@mcp.tool()
async def book_table(
date: str, answer: Annotated[Confirmation, Resolve(ask_to_confirm)]
) -> str:
"""Book a table after the user confirms."""
return f"Booked for {date}." if answer.confirm else "No booking made."
Confirmation is a Pydantic model with a confirm: bool field. Author’s measurement, mcp 2.3.0:
| Client | ctx.elicit() | Resolve |
|---|---|---|
mode="legacy" (2025-11-25) | Works | Works |
mode="auto" (2026-07-28) | -32600, no back-channel | Works |
| Client 1.30.0 | Not tested | Works |
auto, without elicitation_callback | Not tested | -32021, missing capability |
The ctx.elicit() error is easy to miss before a release: if your tests go through an old client, they stay green. The in-memory client Client(mcp) speaks 2026-07-28 by default, so tests need both modes. How to check each era is described in testing MCP servers.
Step 4. State: explicit identifier and ToolError
import secrets
from mcp.server.mcpserver.exceptions import ToolError
BASKETS: dict[str, list[str]] = {} # single process only; otherwise use shared storage
@mcp.tool()
def create_basket() -> str:
"""Create a basket and return its id."""
basket_id = secrets.token_urlsafe(8)
BASKETS[basket_id] = []
return basket_id
@mcp.tool()
def add_item(basket_id: str, item: str) -> list[str]:
"""Add an item to the basket and return its contents."""
if basket_id not in BASKETS:
raise ToolError(f"unknown basket_id: {basket_id}")
BASKETS[basket_id].append(item)
return BASKETS[basket_id]
The model sees the identifier, and it can end up in logs. Don’t treat it as proof of permission: on a server with users, check that the basket belongs to the caller.
ToolError is mandatory here. Since 2.1.0, the SDK hides the text of unexpected exceptions. In the author’s measurement, raise ValueError("unknown basket_id: zzz") gave the model the full text on 1.30.0, while on 2.3.0 it sees only “Error executing tool a”. If your agent corrected itself from the exception text, after the upgrade it loses that hint without a single failure in tests that check is_error.
Step 5. Logs, notifications, cache
- Logs.
ctx.info()on a 2026-07-28 connection didn’t reach the client; withClient(..., log_level="info")it did. On 2025-11-25 it arrives with no configuration (author’s measurement). For new code use plainlogging, which writes tostderron stdio. - Notifications.
ctx.session.send_tool_list_changed()and similar calls are dropped on the new revision. The replacement isawait ctx.notify_tools_changed(). - List cache. By default the SDK returns
ttlMs: 0andcacheScope: private. For a tool list that doesn’t change, set a hint inMCPServer("rates", cache_hints={"tools/list": CacheHint(ttl_ms=60_000, scope="public")}). Thepublicvalue allows a response to be served to another user, so use it only for responses that are the same for everyone. - Sync tools.
deffunctions run on a worker thread; they used to run in the event loop. Check shared objects without locks for concurrent access.async defbehaves as before. - Body size. Streamable HTTP rejects POSTs larger than 4 MiB with HTTP 413;
max_request_body_sizechanges the limit.
TypeScript: you have to enable the new revision
This section follows the documentation; the author didn’t run the code. In TypeScript SDK 2.x, a manually assembled McpServer keeps speaking the old way: updating the package alone changes nothing on the wire. The createMcpHandler (HTTP) and serveStdio (stdio) entry points turn on both eras:
// per the SDK documentation, not run by the author
import { createMcpHandler, McpServer } from '@modelcontextprotocol/server';
const handler = createMcpHandler(() => {
const server = new McpServer(
{ name: 'my-server', version: '1.0.0' },
{ capabilities: { tools: {} } }
);
// register tools
return server;
});
export default handler; // Node: app.all('/mcp', toNodeHandler(handler))
A codemod handles the mechanical part of moving from v1: npx @modelcontextprotocol/codemod@latest v1-to-v2 ., then a search for @mcp-codemod-error markers and a type check. You need Node.js 20+. On the client, the versionNegotiation: { mode: 'auto' } option enables the new revision.
Deploying behind a load balancer: what stateless doesn’t solve
A 2026-07-28 client doesn’t need sticky sessions. But a dual-era server also accepts old clients, and the application still keeps data. The author started two processes of one server and manually sent related requests to different ones (author’s measurement, mcp 2.3.0):
| Scenario: first request to A, second to B | Result |
|---|---|
Question through Resolve, the answer arrives at B | 400, -32602 “Invalid or expired requestState” |
Same, with a shared RequestStateSecurity key | Works |
| Basket in a dictionary of process A | Tool error: unknown basket_id |
| Session of a 2025-11-25 client | 404 “Session not found” |
The settings that follow from this, per the deployment documentation:
- Multi-round tools: the same
RequestStateSecurity(keys=[...])and the same server name in all processes. The key must be at least 32 bytes, and by default each process has its own. - 2025-11-25 clients: sticky sessions or
stateless_http=True. The second option turns off server requests to such clients. - Application state: a shared database or Redis.
- A real domain:
TransportSecuritySettings(allowed_hosts=[...]). Without it, a foreignHostgot 421 and a foreignOrigingot 403 in the author’s measurement. - Notifications between processes: your own
SubscriptionBusimplementation; the SDK ships only an in-memory one.
Other operational questions are covered in MCP servers in production.
Which clients speak the new revision
Claude Code. Per the documentation, the v2 client runtime supports the new revision. It works from 2.1.232 in sessions that receive feature flags, and from 2.1.274 (September 17, 2026) in the rest. Local stdio servers negotiate 2026-07-28 by default on all installs from 2.1.292 (October 6). The MCP_PROTOCOL_NEGOTIATION=legacy variable turns negotiation off.
Author’s measurement: claude mcp list version 2.1.322 with a separate config directory sent an HTTP server server/discover, subscriptions/listen and tools/list, all with 2026-07-28. With MCP_PROTOCOL_NEGOTIATION=legacy it sent initialize, a session id and a GET stream. The convert tool through claude -p returned the right answer over stdio and over HTTP; that run didn’t record the protocol version of the call itself.
Before 2.1.302 (October 16), Claude Code didn’t show tools or couldn’t call them if the server negotiated the new revision but didn’t send resultType, ttlMs or cacheScope. A hand-written server needs these fields anyway: they’re required.
Codex. Support was added on July 28 as opt-in. In codex features list version 0.172.0, the mcp_2026_07_28 flag is off and marked under development (author’s measurement), and the request to enable it by default is open. The author didn’t test Codex connecting on the new revision.
MCP Inspector. It runs in legacy mode by default. Without --protocol-era modern or auto, it checks only the old branch.
Checks after migration
import asyncio
from mcp import Client
async def check(url: str, mode: str) -> None:
async with Client(url, mode=mode) as client:
tools = (await client.list_tools()).tools
print(mode, client.protocol_version, [t.name for t in tools])
for mode in ("auto", "legacy"):
asyncio.run(check("http://127.0.0.1:8931/mcp", mode))
On the measured server this printed auto 2026-07-28 and legacy 2025-11-25 with the same tool list. Then go through the list:
- Call every tool in both modes, starting with those that ask questions.
- Check that errors meant for the model go through
ToolErrorand not through ordinary exceptions. - Send
curlthrough the proxy and make sureMCP-Protocol-Version,Mcp-MethodandMcp-Nameget through. - Start two processes and split related requests between them.
- Run the tests with
-W default: calls to deprecated methods showMCPDeprecationWarning.
When to postpone the migration
- You need tasks. The tasks extension isn’t implemented in release 2.0.0, and the experimental API from v1 is removed. In FastMCP 4, background tasks moved to the
fastmcp-taskspackage. - The server relies on sampling. On the new revision, a direct
create_message()call ends inNoBackChannelError. The feature is deprecated, so plan for a direct model API call from the start. - You need only the new protocol. In the Python SDK the old era can’t be turned off: 2.x always serves both.
- A local stdio server without questions or sessions. Stateless gives it almost nothing (author’s assessment), so the move comes down to an SDK update.
For everyone else the order is: pin mcp<2, move imports and fields, replace ctx.elicit() and session state, run both eras, and only then lift the pin. How much context tool definitions take up is covered in MCP for AI agents, and choosing between the protocol and a regular API in MCP vs API.