Skip to content

Negotiate supported MCP protocol versions - #40

Draft
VrtxOmega wants to merge 1 commit into
mainfrom
fix/mcp-protocol-negotiation
Draft

VrtxOmega wants to merge 1 commit into
mainfrom
fix/mcp-protocol-negotiation

Conversation

@VrtxOmega

@VrtxOmega VrtxOmega commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Problem

PCF's initialize handler echoes the client's protocol version without checking support. On current main, unsupported strings are returned unchanged and truthy non-string values can become successful negotiated versions. Missing or falsy values silently default.

The MCP lifecycle requires selecting a supported version; the initialization schema requires a string.

Change

  • Declare 2025-06-18 as the wire version, separate from PCF implementation metadata.
  • Return that version for supported requests and as the fallback for other strings, including empty strings.
  • Return correlated JSON-RPC -32602 with no initialization result when the version is missing or non-string.
  • Document the unreleased contract and add 20 cases through the direct handler and fresh sessions in both framing modes.

Risk

Malformed callers that relied on silent defaults now receive an error. Clients must check the returned version and disconnect if they cannot support it. Existing supported-version responses, server metadata and capabilities are preserved.

Scope is version negotiation only: no full initialization-schema validation, session-order enforcement, notification changes or newer-version support. Drafts #36–39, package-verifier implementation/tests and frozen evaluation evidence are untouched.

Claim Integrity

  • Evidence surface: actual response versions/errors, request IDs, frame counts and process exits.
  • Negative control: the new suite on main ed87010 reports 6 passed, 56 failed, 0 skipped (54 failing behavior cases plus two failed framing groups).
  • Positive control: fixed source reports 62 passed, 0 failed, 0 skipped (60 behavior cases plus two groups).
  • Root cause: caller-controlled values went directly into the negotiated-version result; the fix validates the field type and selects a server-supported wire constant.
  • Routing refreshed October 8, 2026: no competing negotiation repair.
  • PCF claim-integrity self-assessment: REVIEW, exit 1, zero blockers. It flags the explicitly untested boundaries: external clients, full initialization schema, session ordering and other protocol editions. Those remain outside this PR's claim; this is synthetic self-evaluation, not outside adoption or interoperability certification.

Verification

node --test test/mcp-protocol-negotiation.test.mjs
npm run ci:gates
  • Full local Windows gates: 545 tests; 539 passed, 0 failed, 6 skipped (five POSIX study-storage tests and an account-restricted symlink test).
  • Benchmark 79/79; adversarial suite 47/47; maintainer demo and installed-tarball checks pass.
  • Independent code review: no material findings; 62 focused entries and 19 additional compatibility/recovery controls pass.
  • Actual offline-installed Windows command: 48 fresh sessions passed across both framing modes; 20 string-version sessions selected 2025-06-18, 28 malformed/missing sessions returned -32602, and all 48 following pings succeeded.
  • Exact-head hosted CI run 37803859237 PASS for 2335e373ec6f1551776b06a2c2f4ecfdf6a6f001: Linux 543 passed, 0 failed, 2 skipped; Windows 540 passed, 0 failed, 5 skipped (545 total each). The CI merge tree equals the head tree fde0f912a2fc983892cebf24aca7302d2f38b4ed.

Maintainer Checklist

  • One bounded protocol reliability defect.
  • Valid and malformed-input regression coverage with failing baseline controls.
  • Claims identify the tested surface and explicit limits.
  • No unrelated generated-proof refresh or frozen-evidence changes.
  • No runtime/private data, secrets or local absolute paths.
  • No AI-authorship, outside-adoption or external-client-success claim.
  • No new external-write behavior.

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.

1 participant