Skip to content

Fix fast-time-server modern wire shape for mcp SDK 2.0.0b2 interop - #12

Merged
jonpspri merged 1 commit into
mainfrom
fast-time-server-sdk-compat
Jul 22, 2026
Merged

Fix fast-time-server modern wire shape for mcp SDK 2.0.0b2 interop#12
jonpspri merged 1 commit into
mainfrom
fast-time-server-sdk-compat

Conversation

@jonpspri

Copy link
Copy Markdown
Collaborator

Summary

Fixes #11. The strict 2026-07-28 mode was not interoperable with mcp==2.0.0b2 (mcp_types/v2026_07_28 wire models) in any negotiation mode, due to two wire-shape gaps in modern responses:

  • Gap 1server/discover: serverInfo was nested under _meta only, but DiscoverResult requires it as a top-level field. The unparseable discover result made auto mode fall back to legacy initialize, which strict mode then rejected — so auto could not connect at all.
  • Gap 2 — modern tools/list: CacheableResult requires cacheScope and ttlMs on the wire (no defaults), and the server emitted neither, so pinned 2026-07-28 mode failed validation on list_tools.

Changes

  • server/discover result now includes top-level "serverInfo": {"name", "version"}, "cacheScope": "private", and "ttlMs": 0. The _meta["io.modelcontextprotocol/serverInfo"] entry is kept, since the spec text marks it SHOULD.
  • Modern tools/list results now include "cacheScope": "private" and "ttlMs": 0 — the SDK's own conservative defaults (immediately stale, no shared caching).
  • Legacy (2025-11-25) responses are untouched; tools/call already satisfied CallToolResult (only resultType + content required).

Field requirements were confirmed against the installed mcp-types 2.0.0b2 models (v2026_07_28.DiscoverResult, .CacheableResult, .ListToolsResult), not just the issue text.

Verification

  • cargo test: 36/36 passing (new assertions lock top-level serverInfo/cacheScope/ttlMs on discover and cacheScope/ttlMs on modern tools/list)
  • cargo clippy --all-targets: clean
  • Real SDK end-to-end (mcp==2.0.0b2 against a live --protocol 2026-07-28 --strict server):
Mode Before After
auto FAIL (serverInfo validation → legacy fallback → -32602) OK — discovers, lists 7 tools, echo round-trip
2026-07-28 pin FAIL (cacheScope/ttlMs required) OK — lists 7 tools, echo round-trip
legacy FAIL FAIL with MCPError: Unsupported protocol version — the intended strict-mode rejection

mcp_types 2.0.0b2 (v2026_07_28 wire models) marks serverInfo, cacheScope, and ttlMs as required top-level DiscoverResult fields, and cacheScope/ttlMs as required on every CacheableResult list response. The modern server/discover response now carries top-level serverInfo and cacheScope/ttlMs (the _meta serverInfo entry is kept per the spec text), and modern tools/list results include cacheScope "private" and ttlMs 0, matching the SDK's conservative defaults. Verified end-to-end with mcp==2.0.0b2: auto and pinned 2026-07-28 modes now complete list_tools and tools/call against a strict server; legacy mode fails cleanly with the intended strict -32602 rejection. Fixes #11.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Signed-off-by: Jonathan Springer <jps@s390x.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant