feat(mcp-server): MCP 2026-07-28 新纪元 dual-era 支持 - #13
Merged
Conversation
- server/discover 探针 (supportedVersions/capabilities/缓存提示), 任意时刻可答 - 纪元路由: initialize → legacy; 带 modern _meta 信封 → modern; 探针不定纪元; 首个无信封请求 → legacy (保留 zcode auto 探测的回落语义) - modern 路径: _meta 信封必填校验 (缺 -32602), 版本不符 -32022 带 supported/requested; 所有 result 盖 resultType:complete + serverInfo 戳; list 类结果带 ttlMs/cacheScope (静态清单 1h/public) - legacy 路径零变化 (initialize 协商/tools/list 旧形状) - 互操作实测: 官方 Python SDK v2.0.0 client session.discover() 协商出 2026-07-28, tools/list + tools/call 全程新协议通过 - 新增 9 个 modern 纪元用例 (test_mcp_protocol.py 共 22 个); README/agent-help 同步
- P0-1: 纪元路由从会话级状态机改为逐请求判定 (无会话态) — 修掉 'legacy 请求偶发带 _meta 毒死会话'与双轨横跳; 与新协议无状态哲学一致 - P0-2: server/discover 作 notification 时不应答 (不再发 id:null 伪响应) - P1: 信封校验报错拆分 (缺 pv/缺 caps 分别精确文案); _modern_result 的 _meta 浅拷贝不就地改调用方对象; discover 统一为中立探针 (main 先行应答, handle_modern_request 不再重复分支); legacy handler 对未知 notification 静默 (JSON-RPC 合规) - P2: resultType/缓存提示注释约束; discover 版本列表两纪元混列保持 spec 形状并注释; 新增 SDK v2 真实抓包序列回放契约测试 (DE9) - 测试 26 全绿; 官方 Python SDK v2.0.0 互操作复测通过 (discover 协商出 2026-07-28, list/call 全程新协议)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
动机
升级路线图第二步:实现 MCP 2026-07-28 新纪元 dual-era 支持。zcode 0.16.1 是目前唯一的双纪元 client(连 server 先发
server/discover探测),本 PR 合并后它会自动走新协议;Claude Code / Kimi / Cursor 走 legacy 路径零感知。改动
server/discover中立探针:任意时刻可答(supportedVersions 五版本全列 + capabilities + 缓存提示),不定纪元、不校验信封initialize→ legacy;带io.modelcontextprotocol/protocolVersion信封 → modern;其余 → legacy(保留 zcode auto 探测的回落语义)_meta信封必填校验(缺 protocolVersion/clientCapabilities 分别-32602精确文案)、版本不符-32022带 supported/requested、所有 result 盖resultType:"complete"+ serverInfo 戳、list 类结果带ttlMs/cacheScope验证
session.discover()协商出2026-07-28,tools/list、tools/call 全程新协议通过(抓包逐字节核对);修复后复测仍通过明确不做(调研结论)
MRTR/elicitation(新形态可待需要时按扩展做)、tasks、subscriptions/listen、HTTP transport、OAuth;官方 conformance 工具不支持 stdio(issue #258 open),验收走自有 wire 级测试 + 官方 SDK 互操作。