Skip to content

fix(mcp): allow SSE servers for OpenCode - #987

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
Yong-yuan-X:fix/984-opencode-sse
Oct 7, 2026
Merged

jeff-r2026 merged 1 commit into
Tencent:mainfrom
Yong-yuan-X:fix/984-opencode-sse

Conversation

@Yong-yuan-X

@Yong-yuan-X Yong-yuan-X commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

团队 MCP 配置声明 transport: sse 时,TeamAI 会错误地以 opencode does not support sse transport 为由跳过 OpenCode,导致服务器未安装。

本次将 SSE 加入 OpenCode 的传输支持列表,复用现有远程服务器渲染逻辑,将其写入 opencode.json 的 mcp 键下,使用 type: "remote"。同步更新中英文使用指南。OpenCode 的 type: "remote" 连接逻辑按 Streamable HTTP、SSE 的顺序尝试传输,因此 TeamAI 的 http 和 sse 均可复用现有远程配置形态。参见 OpenCode 上游实现。

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Test Plan

  • 类型检查通过:node node_modules/typescript/bin/tsc --noEmit
  • npm run lint 通过
  • npm run build 通过
  • git diff --check 通过
  • 更新回归测试,覆盖 HTTP/SSE 的远程配置、成功添加记录和重复执行的幂等性

针对性回归命令:

node node_modules/vitest/vitest.mjs run src/__tests__/mcp-reconcile.test.ts -t 'OpenCode|sse' --maxWorkers=1 --reporter=dot

结果:8 项通过,236 项未匹配筛选条件而跳过。修复前,新增的 SSE 用例能够复现错误跳过的问题。

构建后 CLI 验证

环境:Windows、Node.js v26.1.0。使用隔离的 HOME/USERPROFILE、本地 git provider 配置和虚构凭据,声明一个 URL 与 header 含变量占位符的 SSE 服务器。

操作 实际结果
node dist/index.js mcp inject 退出码 0;写入 mcp.amap,类型为 remote,正确替换 URL/header 变量,保留个人服务器和 instructions
node dist/index.js mcp list 退出码 0;显示 installed: opencode
再次执行 mcp inject 退出码 0;提示已是最新状态,配置文件内容不变
node dist/index.js doctor --json 退出码 0;整体 ok: true,OpenCode MCP 交付检查通过
node dist/index.js mcp remove 退出码 0;仅移除团队服务器,保留个人配置

本次验证覆盖 TeamAI 的配置交付流程,未连接真实 SSE 服务,也未验证 OpenCode 客户端握手。

Related Issues

Fixes #984

Notes for Reviewers

运行时修改仅涉及 OpenCode 的传输支持列表,继续复用已有的远程配置渲染与归属管理逻辑,无新增命令或共享状态。

已检查 docs(含 designs)及 skill-data 中的相关描述;需要修正的限制说明仅出现在两份使用指南中。本次不改变工作流,因此未修改 skill 正文或 README。

@Yong-yuan-X Yong-yuan-X changed the title fix(mcp): support SSE transport for OpenCode fix(mcp): allow SSE servers for OpenCode Oct 6, 2026
@Yong-yuan-X
Yong-yuan-X marked this pull request as ready for review October 6, 2026 15:12
@Yong-yuan-X
Yong-yuan-X force-pushed the fix/984-opencode-sse branch from 18c9e9b to 9679827 Compare October 6, 2026 16:09
@jeff-r2026 jeff-r2026 self-assigned this Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

未发现需要报告的问题。

PR 描述已包含构建后的真实 CLI 端到端验证记录,满足运行时行为变更的测试要求。

@jeff-r2026
jeff-r2026 merged commit 7b2e091 into Tencent:main Oct 7, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] opencode 的支持集从 ['stdio','http'] 应该改为 ['stdio','http','sse']

2 participants