github / github/copilot-cli

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

Đang mở
#4,374 0 bình luận 6 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

area:enterprise area:mcp
Ngôn ngữ chính
Shell
Star
11.2k
Fork
1.9k
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
6

Mô tả

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).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện /mcp search từ một repository có remote Azure DevOps và từ một thư mục không phải là thư mục git, sau đó lần theo context khởi động được sử dụng để lấy MCP registry policy. Issue hoàn tất khi tìm kiếm trong registry thành công bất kể git remote hiện tại là gì, mà không làm hỏng cấu hình đã được lưu persistent hiện có trong ~/.copilot/mcp-config.json.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
github, shell
Lĩnh vực
api, cli
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.