zai-org / zai-org/feedback

[Bug] 设置 → MCP:关闭同网关多个远程 MCP server 中任意一个,其余同源 server 的开关显示状态联动翻转

Open
#512 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

环境信息

  • ZCode 版本:3.10.2(macOS 客户端,Apple Silicon)
  • 系统版本:macOS 26.6.2
  • 配置位置:用户级 ~/.zcode/cli/config.jsonmcp.servers

问题描述

设置 → MCP 界面中,关闭同一远程网关(相同 host)下多个 MCP server 中的任意一个时,其余同源 server 的开关状态会在界面上一起翻转(全部显示为关闭)。

已验证磁盘存储层是正确的、逐 server 独立的:toggle 后检查 ~/.zcode/cli/config.json,只有被点击的那个 server 的 enabled 字段被修改。重启客户端后界面按配置文件恢复真实状态。因此判断为设置界面(渲染层)的显示状态联动,会误导用户以为批量关闭了所有 server。

复现步骤

  1. 在用户级配置中添加 2 个以上同一远程网关的 MCP server,例如多个钉钉开放平台 MCP(均指向 mcp-gw.dingtalk.com,路径/key 不同):
{
  "mcp": {
    "servers": {
      "钉钉机器人消息": { "type": "remote", "url": "https://mcp-gw.dingtalk.com/server/<id1>?key=<secret1>" },
      "钉钉AI表格":     { "type": "remote", "url": "https://mcp-gw.dingtalk.com/server/<id2>?key=<secret2>" },
      "钉钉表格":       { "type": "remote", "url": "https://mcp-gw.dingtalk.com/server/<id3>?key=<secret3>" },
      "钉钉文档":       { "type": "remote", "url": "https://mcp-gw.dingtalk.com/server/<id4>?key=<secret4>" }
    }
  }
}
  1. 打开 设置 → MCP
  2. 关闭其中任意一个 server
  3. 观察其余同网关 server 的开关同时显示为关闭

实际行为

界面上 4 个 server 的开关状态一起变为关闭(视觉上像被批量操作)。落盘实际只修改了被点击的那一个。

期望行为

每个 server 的开关独立显示、独立翻转。

供定位参考(基于 app.asar 逆向,版本 3.10.2)

  • 落盘路径正常saveMcpToUserDirectoryset-enabled 分支按 server 名逐个写入(w4e(u4e(i), i, e.name, e.enabled)),无组写入逻辑。
  • 渲染层疑似 id 复用mcpStoretoggleServer 通过 enabledStates[id]servers.map(e => e.id === n ? {...e, enabled} : e) 更新界面。同 source(zcodeagentmcp)、同配置文件、同网关 host 的多个 server 若生成的 id 不唯一(或在 UI 中被归并分组),就会出现本次观察到的联动。

临时规避

  • 直接编辑 ~/.zcode/cli/config.json 中对应 server 的 enabled 字段后重启;
  • 或接受界面联动显示,以配置文件为准。

影响

纯显示层问题,不影响 MCP 实际启停与配置持久化,但强烈误导用户操作结果(以为批量关闭/恢复了全部 server)。

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

Reproduce the issue in Settings → MCP with multiple remote servers sharing a host, then trace the renderer entry point around mcpStore.toggleServer, enabledStates[id], and the servers map. Compare this with saveMcpToUserDirectory’s set-enabled path; done means each server’s switch renders and flips independently while persistence remains per server.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.