github / github/copilot-cli

MCP reload reuses startup workspace config after .github/mcp.json changes

未关闭
#4,562 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

area:configuration area:mcp
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

Describe the bug

Copilot CLI keeps using the MCP configuration snapshot loaded when the session started. If a workspace MCP server fails to initialize and .github/mcp.json is corrected while the session remains open, reloading/restarting MCP servers retries the old command instead of reading the updated file.

The on-disk file contains the corrected command, but reload diagnostics report that the configuration signature is unchanged and launch the original command again.

Affected version

  • Copilot CLI: 1.0.81-7
  • Platform: Windows
  • MCP transport: stdio

Steps to reproduce

  1. Create .github/mcp.json in a workspace with a deliberately observable failing server:

    {
      "mcpServers": {
        "config-probe": {
          "type": "stdio",
          "command": "python",
          "args": [
            "-c",
            "import sys; print('OLD_CONFIG', file=sys.stderr)"
          ],
          "tools": ["*"]
        }
      }
    }
    
  2. Start Copilot CLI in that workspace. The server exits during initialization and its stderr contains OLD_CONFIG.

  3. Without exiting Copilot CLI, change only OLD_CONFIG to NEW_CONFIG in .github/mcp.json.

  4. Open /mcp and reload/restart the MCP servers.

  5. Inspect the MCP status and session log.

Expected behavior

Reload should reread .github/mcp.json, compute a new configuration signature, and launch the command containing NEW_CONFIG.

Actual behavior

Reload keeps the startup signature and launches the original command containing OLD_CONFIG. In the observed session, the equivalent diagnostics were:

mcp discover_and_start_root {
  "signature_matches": true,
  "previous_signature": "...old command...",
  "signature": "...old command..."
}
mcp unchanged reload reuses live graph
MCP server stderr: ...old command output...
Recorded failure for server config-probe

The file on disk already contained the new command when these messages were recorded.

This also occurs when replacing a nonexistent relative launcher path with a valid absolute path and adding an environment override: subsequent reloads continue retrying the original relative path.

Impact

A user cannot repair a failed workspace MCP server without terminating and relaunching Copilot CLI. The reload/restart action appears to run, but it retries stale settings, which makes configuration troubleshooting confusing.

Workaround

Exit Copilot CLI completely and start a new process after editing the workspace MCP configuration.

Related issues

  • #2198 covered workspace MCP configuration not loading at startup; that issue was fixed by making reload discover the config. This report is the inverse: startup discovers the config, but reload does not observe later edits.
  • #4542 covers workspace configuration being detected but not wired into newly started sessions. This report concerns in-session configuration refresh after the server was already discovered.

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先使用 .github/mcp.json、/mcp reload/restart 操作和会话日志重现该问题。比较将 OLD_CONFIG 更改为 NEW_CONFIG 前后的配置签名和启动命令;完成的标准是 reload 能检测到已编辑的文件,并使用新命令启动服务器,而无需重启 Copilot CLI。

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

评估

技术栈
python, shell
领域
cli, tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

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