Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

config: V2 silently ignores MCP servers defined directly under `mcp` instead of `mcp.servers`

已关闭 适合新手
#56,602 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
半天
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript

调研方向

首先根据文档中的 JSON schema 复现 V1 mcp 配置,然后跟踪配置加载过程和 opencode mcp list 命令。添加回归检查,以覆盖对现有结构的支持,或发出警告,指出无法识别的键和预期的 mcp.servers.<name> 路径。完成的标准是已定义的服务器不再被静默忽略,并且失败能够被看到。

由索引模型根据 Issue 内容生成。

描述

Summary

V2 config silently ignores an MCP server placed directly under mcp instead of mcp.servers, with no warning. opencode mcp list reports "No MCP servers configured" while the config file clearly contains one, so a broken integration looks like a working config.

Environment

  • opencode version: 2.0.32
  • OS: Windows_NT 10.0.26300 (win32 x64)
  • Terminal: desktop app (OpenCode.exe) + opencode-cli.exe
  • Shell: n/a (desktop app)
  • Install/channel: latest (desktop, @opencodedesktop)
  • Active plugins: none configured

Reproduction

  1. Put an MCP server under mcp (the V1 shape):
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "roam": {
      "type": "local",
      "command": ["node", "/path/to/server.mjs", "serve"]
    }
  }
}
  1. Restart OpenCode (or restart the service).
  2. Run opencode mcp list.

Expected Behavior

Either the server connects, or OpenCode tells me the key is wrong — for example a warning that mcp.roam is not a recognised shape and that V2 expects mcp.servers.roam. The V1-to-V2 migration guide notes V1 config files "are intended to remain compatible", so silently dropping an entire server definition leaves the user with a config file that looks correct and a tool that has been unavailable for weeks.

Actual Behavior

No error, no warning, no migration hint:

$ opencode mcp list
No MCP servers configured

The agent simply has no tools from that server. In my case this went unnoticed for a long time because the missing tool's absence looked like the agent choosing a different approach, rather than a config mistake.

For contrast, moving the identical block one level deeper made it appear immediately:

"mcp": { "servers": { "roam": { "type": "local", "command": [...] } } }

Additional Context

  • Reproducible every time; 100% deterministic.
  • Worth considering: when an object key sits directly under mcp and is not servers/timeout, log a warning naming the key and the expected mcp.servers.<name> path. A one-line warning at config load would have saved hours here.
  • Related: opencode mcp list returning "No MCP servers configured" while a config file visibly contains an mcp block could echo which files were loaded, which would also help when config is present but ignored for other reasons.
主要语言
TypeScript
星标
215k
派生
28.9k
平均合并
6 小时 8 分钟
30 天内合并 PR
411

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。