feat(mcp-server): MCP 协议 legacy 线对齐 2025-11-25 - #12
Merged
Conversation
- 版本协商: 支持 2024-11-05..2025-11-25 全段, client 请求在列表内回显, 列表外回最高版 (原来是写死回 2024-11-05) - 拒收 JSON-RPC batch 数组/裸值 (-32600; batch 2025-06-18 已从规范移除, conformance 要求 ≥2025-06-18 server 必须拒绝) - 四个 tool 补 title + annotations (readOnlyHint/destructiveHint/ idempotentHint/openWorldHint), 与只读管线一致 - 调 mimosa 的 client 侧版本钉 2024-11-05 (mimosa 1.0.3 实测讲该版) - 新增 test_mcp_protocol.py 13 用例 (协商/拒收/元数据/命名规范); README 协议兼容性节重写 + agent-help 生态条目同步
- batch 拒收 message 改中性措辞 (去版本史叙述) - initialize capabilities 显式声明 tools.listChanged=false (工具集静态) - 版本协商加 isinstance 防御 + set 查表 - TL2 确定性测试改走完整主循环 (原来测模块常量, 恒真空操作) - openWorldHint 注释补'结果不可复现'贴合规范本意
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 已发布(无状态化大改版),但实测四大 client(Claude Code 2.1.x / Kimi Code 0.34 / Cursor / zcode 0.16.1)中只有 zcode 是双纪元。本 PR 是升级路线图的第一步:legacy 线对齐 2025-11-25——对齐所有 client 发出的版本,零风险。
(调研依据:七路并行调研 MCP spec 各版本 changelog + 官方 schema diff + 本机四 client 二进制实测 + Python/TS SDK v2 评估;结论:继续手搓零依赖实现,SDK v2 的 13 个依赖对纯 stdio 单文件 server 得不偿失。)
改动
2024-11-05/2025-03-26/2025-06-18/2025-11-25全段,client 请求在列表内原样回显、列表外回最高版(原来写死回 2024-11-05)-32600(batch 2025-06-18 已从规范移除,conformance 要求 ≥2025-06-18 server 必须拒绝);未知 method 回-32601的行为特意保留——那是 zcode auto 探测依赖的 legacy 回落信号title+annotations(readOnlyHint/destructiveHint/idempotentHint/openWorldHint),与只读管线语义一致;initialize capabilities 显式tools.listChanged=false验证
test_mcp_protocol.py13 用例(协商回显/版本兜底/batch 拒收/notification 不受影响/元数据五要素/命名规范/确定性排序走完整主循环);全套件 + ruff 全绿路线图(第二步,不在本 PR)
2026-07-28 新纪元 dual-era:实现
server/discover+_meta信封校验 +resultType,保留 initialize 旧路径。zcode 0.16.1 可立即受益,其余三家 client 跟进后全面实施。