zai-org / zai-org/feedback

[Bug] MCP 服务器定义被配置校验器丢弃,导致"已连接但工具不可见

Open
#710 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2 status: 待评估 type: Bug
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

提交前确认 · Pre-submission checklist
  • 我已搜索过现有 issue,确认这不是重复 / I searched existing issues and confirmed this isn't a duplicate.
  • 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category

工具调用 / MCP · Tool use / MCP

涉及的 Agent 框架 · Agent framework

ZCode Agent(自研)

严重程度 · Severity

阻塞使用 · Blocking (无法使用核心功能 / core function unusable)

复现频率 · Reproducibility

必现 · Always

问题描述 · Description

环境

  • ZCode 桌面版(MCP client: zcode 0.16.5
  • macOS 14.1 (darwin 23.1.0) arm64
  • 日期:2026-09-18
  • 配置文件:~/.zcode/cli/config.json(user scope)

问题摘要

MCP HTTP 服务器条目中包含 protocolVersion 字段时(该字段来自桌面端 设置 → MCP 的"协议版本"选项,选 legacy 时写入),出现同一份配置两种解读互相矛盾

  • MCP 连接层认这个字段:按 mcpVersionNegotiationMode: "legacy" 正常协商,连接成功、成功列出 26 个工具(mcp.server.connected);
  • 配置校验层拒这个字段:schema 严格校验视其为未知键,丢弃整个服务器定义config.mcp_server.skipped);
  • 最终结果:会话工具注册层拿不到定义,mcp__<server>__* 工具从未进入模型请求。用户侧症状为:服务显示已连接、日志里 toolCount=26,但无论怎么提问模型都不会调用其中的任何工具。

即:客户端自己写出的字段,被客户端自己的校验器拒绝(疑似对应已知模式:server 名出现在日志但模型请求中无 mcp__ 工具)。

复现步骤

  1. 在 设置 → MCP 添加 HTTP 类型服务器,协议版本选择 legacy(App 将 protocolVersion: "legacy" 写入 ~/.zcode/cli/config.json);
  2. 重启会话;
  3. 打开 Settings → MCP:服务显示已连接;
  4. 但任意会话中均无该服务器的 mcp__ 工具;日志出现大量 config.mcp_server.skipped
复现步骤 · Steps to reproduce

打开zcode 设置,配置MCP服务器,类型“HTTP”,协议版本”兼容旧版“,在输入框发送正常能触发调用MCP服务器的问题,结果:不调用MCP服务

期望表现 · Expected behavior

1.schema 将 protocolVersion 纳入白名单(既然 设置 → MCP 的协议版本选择器会写出该字段,文件解析器就应认识它);
2.或校验器对未知键降级为 warning 并保留定义(连接层已经证明定义可用);
3.或 App 侧不再把协议版本选择落盘为裸字段,改由 App 自管理存储。

实际表现 · Actual behavior

显示MCP服务器已连接,但是会话工具列表未注入

ZCode 版本 · ZCode version

v3.12.3

设备 / 系统 / 浏览器 · Device / OS / Browser

zcode客户端

截图 / 录屏 / 日志 · Screenshots / Recordings / Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ~/.zcode/cli/config.json and trace how the MCP configuration validator handles the protocolVersion field, using config.mcp_server.skipped and mcp.server.connected logs as entry points. Confirm that a server configured with protocolVersion: "legacy" remains available to session tool registration, and verify that its mcp__ tools appear in model requests.

Written by the indexing model from the issue text.

Assessment

Domain
desktop, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.