github / github/copilot-cli

/mcp search fails with 400 Bad Request in every repo with a non-GitHub (Azure DevOps) git remote

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

还没有人认领这个 Issue。

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

描述

Describe the bug

/mcp search (interactive MCP registry browser) consistently fails with:

Failed to load registry: Error: Failed to fetch MCP registry policy: 400 Bad Request

whenever Copilot CLI is started inside a trusted folder whose git remote points to Azure DevOps (dev.azure.com) instead of a GitHub-hosted remote. This affects our entire engineering org, since 100% of our repositories are hosted on Azure DevOps.

Environment
  • Enterprise: GitHub Enterprise Cloud with data residency / EMU tenant
  • OS: Windows
  • Enterprise MCP Registry: configured and verified working (Azure API Center-backed registry, "Registry only" policy) — confirmed via direct curl calls that the registry itself returns HTTP 200 with the expected servers.

Workaround: Run /mcp search from a non-git folder to add servers once; they then work from any repo afterward via the persisted ~/.copilot/mcp-config.json.

Affected version

GitHub Copilot CLI 1.0.78

Steps to reproduce the behavior
  1. Configure an enterprise MCP Registry URL + "Registry only" policy (per GitHub docs).
  2. cd into any local git repository whose origin remote is an Azure DevOps URL (e.g. https://org@dev.azure.com/org/project/_git/repo).
  3. Start copilot.
  4. Run /mcp search.
  5. Observe: Failed to load registry: Error: Failed to fetch MCP registry policy: 400 Bad Request.
  6. cd outside any git repository (e.g. home directory) and start a fresh copilot process.
  7. Run /mcp search again → succeeds, returns all registry servers.
Expected behavior

/mcp search should successfully fetch the registry policy regardless of the git remote host of the current working directory, or at minimum should not derive repo/org context from non-GitHub git remotes in a way that breaks the request.

Additional context
  • The failure is tied to process startup cwd/git-remote context, not conversation state: /new inside the same running process does not recover it — only a full process relaunch outside a git-remote folder works.
  • Once servers are added via the workaround below (outside a repo), they persist in ~/.copilot/mcp-config.json and connect fine from inside our Azure DevOps repos afterward — so the registry policy fetch specifically is what's broken, not general MCP connectivity.
  • Reproduces consistently; not a timing/cache issue; not related to our enterprise's registry configuration (independently verified correct).

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先,在具有 Azure DevOps remote 的存储库中以及非 git 文件夹中复现 /mcp search,然后跟踪用于获取 MCP registry policy 的启动上下文。当无论当前 git remote 如何,registry 搜索都能成功,且不会破坏 ~/.copilot/mcp-config.json 中现有的持久化配置时,该 issue 即完成。

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

评估

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

把新 issue 发到你的邮箱

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