github / github/copilot-cli

Add a stable environment variable for local MCP servers to detect Copilot CLI as their host

Đang mở
#2,107 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
area:configuration 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 feature or problem you'd like to solve

MCP servers launched by Copilot CLI currently have no reliable, intentional way to detect they're running under the CLI - COPILOT_CLI_BINARY_VERSION only works in SEA mode and COPILOT_RUN_APP is an internal loader implementation detail. Adding a deliberate env var like COPILOT_CLI=true in setupProcess.ts would provide a stable, documented signal that works across both SEA and source modes, enabling MCP servers to adapt behavior or log appropriate details based on their host without requiring special arguments in the server configuration. This also layers cleanly with existing env vars like MSFT_AGENCY to let consumers infer the full orchestration stack.

### Proposed solution

Defining the name of the env var is probably one of the hardest parts. Assuming for the moment that we pick something like COPILOT_CLI, then one option for implementation would be to set process.env.COPILOT_CLI = "true" in setupProcess.ts, which runs early in the CLI entry point across all modes (interactive, server, ACP) and in both SEA and source builds. Since this env var isn't in the filter list, it naturally propagates to MCP server child processes via the existing environment inheritance.

### Example prompts or workflows

N/A

### Additional context

1. The MCP initialize handshake already sends clientInfo.name: "github-copilot-developer", but that value is shared with CCA and other hosts, so it only tells you "some Copilot client" — not specifically the CLI.
2. The DO NOT CHANGE THE CLIENT NAME comments in the codebase confirm MCP servers already rely on client identification — this request aligns with that existing pattern but fills the CLI-specific gap.
3. Telemetry is a specific use-case here, but there are likely others.

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

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

Hướng nghiên cứu

Bắt đầu với setupProcess.ts và các điểm vào CLI cho các chế độ tương tác, máy chủ và ACP; xác minh cách việc kế thừa môi trường được truyền tới các tiến trình con MCP trong các bản build SEA và từ mã nguồn. Công việc được xem là hoàn tất khi có một tên biến ổn định đã được thống nhất, khả dụng trên các chế độ và kiểu build đó, đồng thời hành vi của nó được ghi lại.

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

Đánh giá

Công nghệ
typescript
Lĩnh vực
cli
Loại issue
Tính năng
Độ 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
45/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.