`resolveDiscoveredConfig` does not read workspace `.mcp.json` — `includeWorkspaceSources` never set
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- javascript
- 领域
- cli
调研方向
从 resolveDiscoveredConfig() 开始,使用提供的 workingDirectory 和 workspace .mcp.json 复现环境跟踪其对 jv() 的调用。验证配置发现包含 workspace 源,然后重新运行 SDK 会话场景,并确认 time MCP server 是从 .mcp.json 加载的。
由索引模型根据 Issue 内容生成。
描述
Summary
When the SDK creates a session with enableConfigDiscovery: true and a workingDirectory, the CLI's resolveDiscoveredConfig() calls the internal MCP config loader (jv()) without passing includeWorkspaceSources: true. That parameter defaults to false, so the workspace .mcp.json is never read — even though the intent of enableConfigDiscovery is clearly to discover it.
Version
@github/copilot v1.0.41-0 (commit 3f18c2c)
Steps to reproduce
- Place a valid
.mcp.jsonin a working directory:{ "mcpServers": { "time": { "command": "uvx", "args": ["mcp-server-time"] } } } - Create a session via the SDK with
enableConfigDiscovery: trueandworkingDirectorypointing to that directory. - Observe that no MCP servers from
.mcp.jsonare discovered.
Expected behaviour
The MCP servers defined in the workspace .mcp.json should be discovered and loaded into the session.
Actual behaviour
The CLI logs:
Loaded MCP config from installed plugins: 0 server(s):
No MCP config loaded from ODR (ODR unavailable or returned no usable servers)
No workspace .mcp.json is read. The flag triggers config resolution, but the resolution skips the workspace source.
Root cause
In resolveDiscoveredConfig(), the call to jv() omits includeWorkspaceSources:
async resolveDiscoveredConfig(e) {
if (!e.enableConfigDiscovery) return {};
let r = e.workingDirectory || process.cwd();
// ...
let c = await jv({
cwd: r,
repoRoot: l,
settings: this.options.settings,
installedPlugins: s
// ← missing: includeWorkspaceSources: true
});
}
Inside jv(), the parameter defaults to false. When false, the function skips the code path that reads .mcp.json from the working directory:
async function jv(t = {}) {
let { includeWorkspaceSources: s = false } = t;
// ...
if (!s) d = { ...c }; // ← only copies global config
else {
// reads .mcp.json from cwd/repoRoot — this path is never taken
}
}
Suggested fix
Pass includeWorkspaceSources: true in the jv() call within resolveDiscoveredConfig():
let c = await jv({
cwd: r,
repoRoot: l,
settings: this.options.settings,
installedPlugins: s,
includeWorkspaceSources: true // ← add this
});
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/copilot-cli 的其他 Issue
-
triage
难度 2/5 1-3 小时 新手友好度 72/100
github/copilot-cli#4848 ·
-
area:agents area:mcp
难度 2/5 1-3 小时 新手友好度 72/100
github/copilot-cli#4729 ·
-
area:sessions
难度 2/5 1-3 小时 新手友好度 72/100
github/copilot-cli#4712 ·
-
triage
难度 2/5 1-3 小时 新手友好度 75/100
github/copilot-cli#4638 ·
-
Expose large_output_file_path on TaskShellProgress so clients can read complete shell-task output 未关闭area:tools
难度 2/5 1-3 小时 新手友好度 78/100
github/copilot-cli#4630 · 1 条评论 ·
查看 github/copilot-cli 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 92/100
-
package-update
难度 2/5 1-3 小时 新手友好度 76/100
oSoWoSo/vOid_Community_repOsitory#148 · 1 条评论 ·
-
chore
难度 1/5 1 小时以内 新手友好度 91/100
alunduil/alunduil-chezmoi#792 ·
-
area: compat bug
难度 2/5 1-3 小时 新手友好度 72/100
-
zenhub-dev
难度 2/5 1-3 小时 新手友好度 68/100
OpenLiberty/ci.docker#747 ·