Skip to content

feat: allow overriding protocol versions in Client, Server, and Transport#1448

Merged
mattzcarey merged 5 commits intomainfrom
feat/protocol-version-override
Feb 3, 2026
Merged

feat: allow overriding protocol versions in Client, Server, and Transport#1448
mattzcarey merged 5 commits intomainfrom
feat/protocol-version-override

Conversation

@mattzcarey
Copy link
Contributor

@mattzcarey mattzcarey commented Feb 2, 2026

Summary

Adds supportedProtocolVersions option to ProtocolOptions for custom protocol version support.

  • First version in list is preferred (sent by client, fallback by server)
  • Passed to transport automatically during connect()
  • Inherited by both Client and Server

Usage

import { McpServer, SUPPORTED_PROTOCOL_VERSIONS } from '@modelcontextprotocol/server';

const server = new McpServer(
    { name: 'my-server', version: '1.0.0' },
    {
        supportedProtocolVersions: ['2026-01-01', ...SUPPORTED_PROTOCOL_VERSIONS]
    }
);

Test plan

  • pnpm typecheck:all passes
  • pnpm test:all passes

🤖 Generated with Claude Code

@mattzcarey mattzcarey requested a review from a team as a code owner February 2, 2026 17:21
@changeset-bot
Copy link

changeset-bot bot commented Feb 2, 2026

⚠️ No Changeset found

Latest commit: fc89b4a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 2, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@1448

@modelcontextprotocol/server

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@1448

@modelcontextprotocol/express

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@1448

@modelcontextprotocol/hono

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@1448

@modelcontextprotocol/node

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@1448

commit: 8aaee7e

@mattzcarey mattzcarey force-pushed the feat/protocol-version-override branch 2 times, most recently from b3b05d2 to 304ca3c Compare February 2, 2026 17:36
mattzcarey and others added 2 commits February 3, 2026 10:57
…port

Adds options to configure protocol versions for cases where the SDK's
default version list doesn't include versions needed by clients or servers.

- Add `protocolVersion` and `supportedProtocolVersions` options to ClientOptions
- Add `protocolVersion` and `supportedProtocolVersions` options to ServerOptions
- Add `supportedProtocolVersions` option to WebStandardStreamableHTTPServerTransportOptions
- Add example showing custom protocol version configuration with Hono

This enables servers using older SDK versions to support newer protocol
versions (like 2025-11-25) without waiting for SDK updates.
Server now passes supportedProtocolVersions to transport during connect(),
eliminating the need to configure versions in both places.

- Add setSupportedProtocolVersions to Transport interface
- Server.connect() calls transport.setSupportedProtocolVersions()
- Replace Hono example with simpler Node.js http example

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@mattzcarey mattzcarey force-pushed the feat/protocol-version-override branch from 9220666 to 74d938f Compare February 3, 2026 10:58
mattzcarey and others added 3 commits February 3, 2026 11:08
Remove protocolVersion option from both Client and Server.
First version in supportedProtocolVersions is now used as:
- Server: fallback when client requests unsupported version
- Client: version sent to server during initialization

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidate the option in ProtocolOptions and handle transport version
passing in Protocol.connect(). Client and Server inherit the protected
_supportedProtocolVersions field.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@mattzcarey mattzcarey merged commit 160902e into main Feb 3, 2026
14 checks passed
@mattzcarey mattzcarey deleted the feat/protocol-version-override branch February 3, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants