Skip to content

test(mcp): pin the legacy-fallback contract Claude Code's v2 runtime relies on - #13

Merged
luiscota99 merged 1 commit into
mainfrom
test/mcp-v2-runtime-preflight
Oct 15, 2026
Merged

luiscota99 merged 1 commit into
mainfrom
test/mcp-v2-runtime-preflight

Conversation

@luiscota99

Copy link
Copy Markdown
Owner

Summary

ADR-0009 Phase 1 pre-flight (#12): verify engram-mcp, which declares protocol 2024-11-05, under Claude Code's v2 MCP runtime (spec 2026-07-28).

Verified on the wire (Claude Code 2.1.226, MCP_SDK_GENERATION=v2, every JSON-RPC request the client sent captured through a tee wrapper):

  1. The client spawns a throwaway server process and sends server/discover with 2026-07-28 _meta.
  2. Engram answers -32601 Method not found. Per the SDK docs, anything that is not definitive modern evidence is treated as a legacy server.
  3. The client spawns the real server and runs the 2025-era handshake: initialize with protocolVersion: 2025-11-25, capabilities elicitation + roots, then notifications/initialized, tools/list. Engram replies 2024-11-05; the client accepts and lists all 39 tools.
  4. Connect time: ~1.2 s under v2 (probe process + real process) vs ~0.2 s legacy. Once per session.

With MCP_PROTOCOL_NEGOTIATION=legacy there is no probe; one process, same handshake.

Not verified: the tool-call round trip inside a live session, because the local CLI's OAuth session is expired (claude auth login needed). The handshake and tools/list are the parts that differ between runtimes; tools/call goes through the same legacy codec once the era is chosen.

Tests added (tests/test_mcp_protocol.py)

  • server/discover → clean -32601, no crash, no hang
  • initialize with 2025-11-25 or 2026-07-28 → reply carries our version; elicitation capability still recorded (ADR-0007 gate keeps its signal)
  • _meta in params ignored on tools/list and ping

Verification

  • ruff clean, pyright 0 errors, Cloak 0 errors
  • tests/test_mcp_protocol.py passes on a scratch DB

🤖 Generated with Claude Code

…relies on

ADR-0009 Phase 1 pre-flight (issue #12). Verified on the wire with
MCP_SDK_GENERATION=v2 on Claude Code 2.1.226: the client spawns a
throwaway server process, sends `server/discover`, treats our -32601 as
"not modern", then connects the real process with the 2025-era
`initialize` (protocolVersion 2025-11-25, capabilities elicitation +
roots). Three tests pin what that fallback depends on: a clean
method-not-found on the probe (no crash, no hang), an `initialize` reply
carrying our own version whatever the client requests while still
recording the elicitation capability, and `_meta` in params being
ignored on tools/list and ping.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@luiscota99
luiscota99 merged commit a330f0b into main Oct 15, 2026
5 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.

1 participant