Skip to content

Add --mcp-version flag to pin MCP protocol version - #320

Merged
jancurn merged 1 commit into
draftfrom
claude/mcp-protocol-version-select-crvv7b
Jul 26, 2026
Merged

Add --mcp-version flag to pin MCP protocol version#320
jancurn merged 1 commit into
draftfrom
claude/mcp-protocol-version-select-crvv7b

Conversation

@jancurn

@jancurn jancurn commented Jul 26, 2026

Copy link
Copy Markdown
Member

Adds --mcp-version <version> to mcpc connect (and an mcpVersion field 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.

  • Modern pin (2026-07-28) maps to the SDK's { pin } mode; legacy pins run the plain initialize handshake offering only the pinned version
  • Pin persists in sessions.json (survives restart) and shows as (pinned) in mcpc @session
  • Supported versions live in a dependency-free src/core/protocol.ts (CLI startup never loads the SDK); a unit test guards drift against the SDK's list
  • New e2e suite runs in both eras of the protocol matrix; docs/help/skill updated

Refs #314

https://claude.ai/code/session_01DCJziR1mQfJk9XynQCwsFx

… 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
@jancurn
jancurn merged commit 7119c13 into draft Jul 26, 2026
6 checks passed
@jancurn
jancurn deleted the claude/mcp-protocol-version-select-crvv7b branch July 26, 2026 09:08
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>
jancurn added a commit that referenced this pull request Jul 31, 2026
Stacks the following PRs:

#314
#315
#318
#319
#320
#326
#327
#328
#329
#330
#331
#337
#336
#339
#340
#345
#347
#348
#349
#351

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants