Skip to content

fix: negotiate supported MCP handshake revisions - #77

Merged
alexshapalov merged 1 commit into
pgrundev:mainfrom
DivyamTalwar:fix/negotiate-supported-protocols
Sep 27, 2026
Merged

alexshapalov merged 1 commit into
pgrundev:mainfrom
DivyamTalwar:fix/negotiate-supported-protocols

Conversation

@DivyamTalwar

Copy link
Copy Markdown
Contributor

What and why

Closes #76.

The initialize handler acknowledged arbitrary client-provided protocol revisions. Negotiate the compatible stable handshake revisions explicitly and counter-offer the existing default for unsupported values. In particular, do not pretend the modern 2026-07-28 lifecycle is implemented.

This follows the MCP version-negotiation contract. Successful existing handshake revisions retain their requested value; malformed-parameter fallback and ordinary tools, prompts and resources remain unchanged.

Verification

Verified commit: 69248627df377e8808ea43af495d20b8bbfc3464.

  • Real Server.Serve regressions fail on upstream 282ffe8fdd7acdd7b6e1dbd8cf04c155401d3a92 for unknown, malformed and unsupported modern revisions.
  • go test -race ./internal/mcp -count=20: passed the full package suite.
  • bash scripts/gate.sh: passed on committed HEAD, including build, vet, pinned lint, unit tests and all six release-target builds.
  • go test -race ./...: passed; formatting and git diff --check clean.

Scope and risk

No dependencies, collector SQL, database migrations or model JSON fields change. Protocol tests drive pgbot's actual wire loop. No third-party SDK interoperability process was run, and no modern stateless support is claimed. Clients requesting an unknown revision now receive an honest counter-offer rather than false agreement. Revert the commit to restore the previous negotiation behavior.

Checklist

  • Committed-HEAD gate and full race suite pass.
  • Read-only, privacy and deterministic-finding invariants preserved.
  • No new finding or model JSON field; catalog and model schema unchanged.

Initialize echoed any requested protocol revision, including malformed or
future values and the newer lifecycle this server does not implement.

Accept the four compatible initialize-era revisions and counter-offer the
existing default otherwise. Preserve malformed-parameter fallback and the
ordinary tool, prompt and resource request surfaces.

Verification: real Serve regressions fail on 282ffe8 for unknown, malformed
and unsupported modern revisions; the complete MCP race suite passes
20 repetitions. No dependencies, SQL or database schema changes.
@alexshapalov
alexshapalov merged commit c85ee46 into pgrundev:main Sep 27, 2026
19 checks passed
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.

MCP initialize advertises client protocol revisions the server does not implement

2 participants