Add --mcp-version flag to pin MCP protocol version - #320
Merged
Conversation
… version Adds a strict protocol version pin: mcpc connect --mcp-version <version> (also an mcpVersion field in mcp.json config entries) connects with exactly the requested MCP revision instead of auto-negotiating, failing loudly when the server does not support it. Modern revisions (2026-07-28) map to the SDK's pin mode; legacy revisions run the plain initialize handshake offering only the pinned version. The pin is persisted in sessions.json, survives restarts, and is shown as "(pinned)" in session info. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DCJziR1mQfJk9XynQCwsFx
This was referenced Jul 26, 2026
jancurn
added a commit
that referenced
this pull request
Jul 27, 2026
The MCP spec and TypeScript SDK use `protocolVersion` as the canonical term, so this renames the `mcpc connect --mcp-version` flag to `--protocol-version` and the mcp.json config field `mcpVersion` to `protocolVersion`. No deprecation alias — the flag was added in unreleased #320, so nothing shipped under the old name. - Internal option fields, `protocol.ts` constants/helpers, docs (README, SKILL.md, CLAUDE.md), and the changelog entry renamed to match - E2E suite renamed to `protocol-version.test.sh`; the JSON pin now appears as `_mcpc.server.protocolVersion` Refs #320 https://claude.ai/code/session_01TpJ2kbEL9zSS4baM3CGU5E Co-authored-by: Claude <noreply@anthropic.com>
jancurn
added a commit
that referenced
this pull request
Jul 27, 2026
A `protocolVersion` field in an mcp.json entry never reached the client, so `mcpc connect cfg.json:entry` auto-negotiated instead of pinning, with no error or warning — only the `--protocol-version` flag worked. `substituteEnvVars()` rebuilt each entry from a per-field allowlist and simply forgot the field. - The config copier now passes every field through and rewrites only those needing env-var substitution or URL normalization, so future `ServerConfig` fields can't be dropped the same way. - An unsupported pin from a config entry is now rejected up front with the same error as the flag, instead of failing later inside the bridge. - Unit tests for the preserved pin and unknown-field pass-through, plus e2e coverage in `basic/protocol-version.test.sh` (both protocol eras). No changelog entry: config-entry `protocolVersion` is still in `[Unreleased]` (#320), so the existing "Added" line already describes the working behaviour. Fixes #323 Refs #320 https://claude.ai/code/session_01D4Y47mxUVcz73X13R5f4sJ Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
--mcp-version <version>tomcpc connect(and anmcpVersionfield in mcp.json entries) to pin the MCP protocol version instead of auto-negotiating. The pin is strict: the connection fails with an actionable error unless the server agrees to exactly the requested version.{ pin }mode; legacy pins run the plaininitializehandshake offering only the pinned versionrestart) and shows as(pinned)inmcpc @sessionsrc/core/protocol.ts(CLI startup never loads the SDK); a unit test guards drift against the SDK's listRefs #314
https://claude.ai/code/session_01DCJziR1mQfJk9XynQCwsFx