Skip to content

fix(server): reject unsupported protocol versions on pinned stdio - #3206

Draft
harmenx wants to merge 1 commit into
modelcontextprotocol:mainfrom
harmenx:fix/stdio-pinned-unsupported-protocol-version
Draft

harmenx wants to merge 1 commit into
modelcontextprotocol:mainfrom
harmenx:fix/stdio-pinned-unsupported-protocol-version

Conversation

@harmenx

@harmenx harmenx commented Nov 18, 2026

Copy link
Copy Markdown

Fixes #3179

Once serveStdio pins a connection to 2026-07-28, a later request whose envelope names another revision was still dispatched. It's now answered with -32022 before the method runs. Unknown methods stay -32601 and a malformed envelope stays -32602.

Motivation and Context

After the pin, tools/list and server/discover returned normal results for a request naming an unsupported revision, and tools/call actually ran the tool. The HTTP entry already rejects these with -32022 (UnsupportedProtocolVersionError), so stdio was inconsistent with it.

How Has This Been Tested?

Added cases to packages/server/test/server/serveStdio.test.ts:

  • a future revision and 2025-11-25 sent after the pin both get -32022 with data.supported and data.requested
  • a tools/call naming a bad revision doesn't run the tool
  • a normal 2026-07-28 call on the same connection still works and stays pinned to the same instance
  • -32601 / -32602 precedence is unchanged

Server package build, lint and tests all pass (727 tests).

Breaking Changes

None. Requests naming 2026-07-28 behave as before; only requests that were wrongly dispatched now get -32022.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

subscriptions/listen keeps the version check it already had. Patch changeset included for @modelcontextprotocol/server.

Once serveStdio pins a connection to 2026-07-28, a later request whose
envelope names another revision was still dispatched. Answer it with
-32022 before the method runs. Unknown methods stay -32601 and a
malformed envelope stays -32602.
@changeset-bot

changeset-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f393e61

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@modelcontextprotocol/server Patch
@modelcontextprotocol/client Patch
@modelcontextprotocol/codemod Patch
@modelcontextprotocol/core Patch
@modelcontextprotocol/server-legacy Patch
@modelcontextprotocol/core-internal Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Nov 18, 2026

Copy link
Copy Markdown

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@3206

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/@modelcontextprotocol/codemod@3206

@modelcontextprotocol/core

npm i https://pkg.pr.new/@modelcontextprotocol/core@3206

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@3206

@modelcontextprotocol/server-legacy

npm i https://pkg.pr.new/@modelcontextprotocol/server-legacy@3206

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@3206

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@3206

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@3206

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@3206

commit: f393e61

@claude claude Bot added the v2 Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes label Nov 19, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v2] serveStdio stops checking the protocol version once a connection is pinned to 2026-07-28

1 participant