GrepBoard/Manuals
605 manuals ·

Fix MCP error -32022 "Unsupported protocol version"

·Tested on MCP specification 2026-07-28 official docs · 2026-10·Test scope ↓·7 steps

MCP error -32022 "Unsupported protocol version": the server rejects the version the request names. Resend with a version from data.supported.

json
{  "jsonrpc": "2.0",  "id": 1,  "error": {    "code": -32022,    "message": "Unsupported protocol version",    "data": {      "supported": ["2026-07-28", "2025-11-25"],      "requested": "1900-01-01"    }  }}

The server does not accept the protocol version the request names, so resend the same request with a version from data.supported. This is the UnsupportedProtocolVersionError example (code -32022) from MCP specification 2026-07-28; data.supported lists the versions the server does accept. Revisions up to 2025-11-25 had no such response, so you tend to meet it for the first time while upgrading an SDK or client.

This post is for people building MCP servers or clients. It is based on reading the spec, not on running anything. If the server simply drops the connection, that is a different problem; start with Telling a Python print apart from MCP "Connection closed".

[1] Know what changed. Three items in the changelog (relative to 2025-11-25) matter here.

ChangeDetail
Handshake removedinitialize / notifications/initialized are gone. Every request carries io.modelcontextprotocol/protocolVersion and io.modelcontextprotocol/clientCapabilities in _meta
Version mismatchThe server returns UnsupportedProtocolVersionError
server/discoverAn RPC every server MUST implement; it advertises supported versions, capabilities, and identity

Over HTTP the version also travels in the MCP-Protocol-Version header. Sessions and the Mcp-Session-Id header were removed in the same revision.

[2] Work out which side speaks which era. The spec calls revisions up to 2025-11-25, which open with initialize, legacy; 2026-07-28 and later, which put version data in _meta, modern; and implementations that do both dual-era. Its compatibility matrix, condensed:

ClientServerOutcome
modernmodernWorks. On a mismatch, retry with a supported version
modernlegacyFails. The server may return an arbitrary error, stay silent, or process an era-ambiguous method with legacy semantics. On stdio the client SHOULD send server/discover first to fail deterministically, then show the user an actionable error
dual-eramodernWorks
dual-eralegacyWorks, falling back to initialize
legacymodernFails. On stdio the server rejects initialize with a JSON-RPC error (code varies); on HTTP it answers 400 Bad Request
legacydual-eraWorks

A modern client is the one that sees UnsupportedProtocolVersionError. A legacy client facing a modern server sees an initialize rejection or a 400 instead, and the spec says legacy clients have no way to move forward.

[3] If you are the client that received the error, read data.supported, pick a version you share, and resend the same request with it. If nothing overlaps, the spec says to surface an error to the user. Look for hardcoded version strings first.

[4] To learn up front what a server accepts, send server/discover first. The spec makes this optional for clients; you may send any request inline and handle the error. The response field layout was not checked here, so read the spec's server/discover page for it.

[5] If you are building the server, check two things.

  • server/discover is implemented. The spec says servers MUST.
  • A modern-only server that answers initialize with an error SHOULD name the protocol versions it supports in that error, because it may be the only diagnostic a legacy client can show.

To serve legacy clients too, build a dual-era server. Per the spec, a request carrying modern _meta is served statelessly, and a connection opened with initialize gets legacy semantics.

[6] If you write compatibility code in a client, follow the spec's detection rules. On stdio, probe with server/discover and fall back if the error is not a recognized modern error. On HTTP, send a modern request and inspect the body of a 400 Bad Request before falling back. If you got a recognized modern error such as UnsupportedProtocolVersionError, do not fall back; retry with a supported version. Clients SHOULD cache the result for the server process lifetime (stdio) or per origin (HTTP), MAY persist it across restarts of the same server configuration, and should probe again if the cached assumption fails.

[7] If your code compares error codes, renumber them. The same changelog reassigns them: -32000 to -32019 stay implementation-defined, and -32020 to -32099 are reserved for the MCP spec.

ErrorEarlier draftNow
HeaderMismatch-32001-32020
MissingRequiredClientCapability-32003-32021
UnsupportedProtocolVersion-32004-32022

The code for a resource not found also changed, from -32002 to -32602 (Invalid Params).

#mcp#protocol#server-discover#troubleshooting