[Bug] 远程SSH工作区: node_repl MCP 连接失败 (Version negotiation failed, pin 2026-07-28) + 远程会话无浏览器后端
Nobody has claimed this yet.
- 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
SSH 远程工作区中,browser-use 插件的 node_repl MCP 服务器每次会话启动即握手失败,mcp__node_repl__js 工具无法注册,内置浏览器在远程会话完全不可用。同一客户端在本地模式一切正常。
根因(已在远端主机完整实证):
- 远程运行时
~/.zcode/server/zcode-server.cjs(v3.7.7)不包含 modern MCP 握手实现(全文件无io.modelcontextprotocolenvelope 相关代码),只能发起经典 MCP 握手; - agent 运行时
agents/glm/zcode.cjs(0.16.3)的resolveBuiltInNodeReplMcpServers硬编码protocolVersion:"2026-07-28"(pin 模式),且内置注册优先级高于用户级~/.zcode/cli/config.json覆盖(配置可被读取但 protocolVersion 不生效); - browser-use 插件 0.2.1 的 node_repl 服务器是 modern-only strict(入口选项
{ legacy:"reject" }),拒绝一切不带 modern envelope 的请求(包括旧协议版本号),协商必然失败; - 即使让服务器按 modern 格式正确应答
server/discover(返回supportedVersions:["2026-07-28"],已通过 stdio 捕获确认客户端收到该应答),远程侧 0.16.3 运行时的应答校验器仍判为无效(桌面端同链路正常,疑似两端校验器实现不配套)。
复现步骤 · Steps to reproduce
- 桌面客户端 v3.7.7 连接 SSH 远程工作区(任意 Linux 远端,本例为 aarch64);
- 打开/新建任意任务窗口(会话启动时自动连接 node_repl MCP);
- 观察内置浏览器不可用、
mcp__node_repl__js未注册; - 远端执行
grep mcp.startup.completed ~/.zcode/cli/log/zcode-$(date +%F).jsonl | tail -1,可见statusCounts {"failed":1}, toolCount 0。
无需客户端的最小复现(在远端主机执行):
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"t","version":"1"}}}' | ~/.zcode/server/node ~/.zcode/cli/plugins/cache/zcode-plugins-official/browser-use/0.2.1/dist/mcp/server.js
返回 {"code":-32022,"message":"Unsupported protocol version: 2025-06-18","data":{"supported":["2026-07-28"],"requested":"2025-06-18"}} —— supported 列表包含所请求的版本却仍拒绝,说明其拒绝的是经典握手本身。
对照:同一客户端本地模式(「不在项目目录中工作」)内置浏览器一切正常。
期望表现 · Expected behavior
- SSH 远程工作区中 node_repl MCP 正常连接,
mcp__node_repl__js等工具正常注册,browser-use 技能可用; - 进一步希望远程会话能提供浏览器后端:目前
agent.browsers.list()为空列表(iab仅存在于桌面端、未代理到远程;cdp无头后端仅本地 CLI--browser-use headless可启用),希望支持桌面 IAB 代理到远程、或允许远程启用 headless CDP。
实际表现 · Actual behavior
- 每次会话启动即失败:
mcp.server.failed — "Version negotiation failed: the server did not offer pinned protocol version 2026-07-28 via server/discover (no fallback in pin mode)"; toolCount: 0;且 MCP 连接池会缓存失败状态,后续新会话直接快速失败、不再重试(必须重启远程运行时进程才会再次尝试);- 已验证的旁证:给插件服务器打兼容补丁(
legacy:"serve"、initialize 版本回显、跳过每请求 envelope 校验)并将zcode.cjs中硬编码 pin 改为"legacy"后,远程 node_repl 完全恢复(initialize / tools_list / tools_call 全通,工具正常注册)——证明问题在协商两端不配套,而非服务器本身故障。
ZCode 版本 · ZCode version
桌面客户端:v3.7.7(已是最新)
设备 / 系统 / 浏览器 · Device / OS / Browser
远程端:Orange Pi(aarch64),Linux 6.1.31-sun50iw9,SSH 远程工作区连接
截图 / 录屏 / 日志 · Screenshots / Recordings / Logs
关键日志摘录(远端 ~/.zcode/cli/log/zcode-2026-08-18.jsonl):
{"timestamp":"2026-08-17T18:38:35.799Z","level":"warn","event":"mcp.server.failed","message":"MCP server connection failed","context":{"mcpServerName":"node_repl","error":"Version negotiation failed: the server did not offer pinned protocol version 2026-07-28 via server/discover (no fallback in pin mode)","transport":"stdio"}}
{"timestamp":"2026-08-17T18:38:35.834Z","level":"info","event":"mcp.startup.completed","message":"MCP startup completed","context":{"serverCount":1,"statusCounts":{"failed":1},"toolCount":0}}
另可提供:插件服务器与客户端的双向 stdio 通信捕获(逐字节证明 discover 探测与应答全过程)、完整日志包,如需要请告知。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with agents/glm/zcode.cjs, especially resolveBuiltInNodeReplMcpServers, and compare it with the remote ~/.zcode/server/zcode-server.cjs. Reproduce the failure using the node_repl server at the documented plugin path and inspect the cited MCP logs and stdio exchange. Done means the remote session registers mcp__node_repl__js successfully and the browser backend behavior matches one of the requested remote options.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend-api-design, devtools, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100