Skip to content

MCP client hardcodes protocol version 2024-11-05; cannot connect to newer servers (repro: GitLab MCP) #1217

In review

Description

@VictorLowther

Problem

The MCP client hardcodes protocol version 2024-11-05 in the initialize handshake (stdio, streamable-HTTP, and SSE transports). MCP servers implementing newer revisions (2025-03-26 / 2025-06-18 / 2025-11-25) reject the stale proposal outright, so those servers cannot connect at all.

Reproduced against the GitLab MCP provider: the streamable-HTTP endpoint answers our initialize with HTTP 400 and a JSON-RPC error whose data says Unsupported protocol version '2024-11-05'. Supported: 2026-07-28, 2025-11-25, 2025-06-18, 2025-03-26. Because the client also dropped the JSON-RPC error data member when rendering failures, the user only saw a bare "Invalid params" with no hint of what went wrong.

Two spec details made it worse than a version bump alone:

  • Newer revisions expect subsequent HTTP requests to carry the negotiated version in the MCP-Protocol-Version header (and to omit it on initialize itself).
  • The newest revision, 2026-07-28, retires the initialize handshake entirely, so it is not a version this handshake-based client can simply add to its proposal list.

Expected behavior

Protocol version negotiation per the spec: propose a current version, retry on version-shaped rejections using the versions the server lists, adopt a supported counter-offer, fail with an actionable error only when there is no overlap — and send the negotiated version in the MCP-Protocol-Version header afterward.

Fix

Fixed on main in 4c34126c (fix(mcp): negotiate the protocol version instead of hardcoding 2024-11-05):

  • New internal/mcp/negotiate.go: candidates 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05 (newest first); parses the server's supported list out of the rejection, retries with the newest mutually supported version, stops immediately when the server names only versions we don't speak; non-version failures (auth, bad params) are not retried.
  • rpcError now carries the JSON-RPC data member and it is appended to surfaced errors (that's where the rejection detail lives).
  • The streamable-HTTP client records the negotiated version and sends MCP-Protocol-Version on subsequent requests.
  • Regression tests include a GitLab-shaped HTTP 400 rejection round-trip (TestNetworkClientNegotiatesAfterHTTP400VersionRejection).

Environment

  • Tested against the GitLab MCP provider (streamable-HTTP transport), 2026-11.

Activity

  1. Vasanthdev2004 commented on Nov 11, 2026

    @Vasanthdev2004
    Collaborator

    Thanks for the detailed report. Confirmed on current main: initialize sends a fixed "protocolVersion": "2024-11-05" from all three clients (internal/mcp/client.go:245 for stdio, internal/mcp/network_client.go:98 and :115 for the network transports). Nothing sends MCP-Protocol-Version afterwards; the only header the network client carries forward is Mcp-Session-Id. So any server that refuses 2024-11-05 cannot connect at all.

    One note on the fix: 4c34126c is not in this repository, and GitHub cannot find it on your fork either, so I assume it is a local commit. CONTRIBUTING asks for the issue-approved label on the issue before a pull request is opened. I think this one should be approved and will flag it for @kevincodex1. Once the label is on, please open the PR against main with the negotiation tests you describe.

  2. Vasanthdev2004 commented on Nov 20, 2026

    @Vasanthdev2004
    Collaborator

    Nine days without an objection, and I verified the report on main myself, so I am marking this bug and issue-approved. @VictorLowther please open the PR against main with the negotiation tests you described: propose a current version, retry with what the server lists, send the negotiated version in MCP-Protocol-Version on later requests, and keep the JSON-RPC error data in what the user sees.

  3. added
    bug
    issue-approved
    on Nov 20, 2026
  4. gnanam1990 commented on Dec 1, 2026

    @gnanam1990
    Collaborator

    Recording the compatibility change requested in the maintainer review, since it differs from the original fix sketch above.

    #1246 makes one final 2024-11-05 proposal when a rejection supplies no usable advertised candidate, including bare Invalid params and empty/disjoint lists. This preserves servers that connect with main's old proposal. Explicit missing-field/authentication errors and HTTP 401/403 do not start that fallback. New untried version hints are followed; failed retries retain the first error.

    Missing protocolVersion in a successful response accepts the proposal. An explicit unsupported counteroffer remains rejected.

    These choices are documented in the PR and regression tests. Current head 2229cbb0 passes full CI and before/after proof. The PR is awaiting maintainer re-review.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugissue-approved

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions