github / github/copilot-cli

feat: Explicit MCP tool triggering via @mcp or #mcp- syntax in Copilot CLI

Đang mở
#2,690 2 bình luận 3 reaction 0 người được giao Xem trên GitHub
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

When multiple MCP servers are configured in Copilot CLI, there is no way to explicitly trigger a specific MCP tool from a prompt. The model decides autonomously whether and which MCP to invoke — and often doesn't, even when the user has a clear intent. Even with local or global MCP setups, it is sometimes random if -- or which -- MCP is used in response to a user query.

VS Code Copilot Chat has a more reliable, user-triggered tool interface (e.g., @tool selectors), making it easier to guarantee the right tool is used at the right time. The CLI currently lacks this precision.

This leads to two compounding problems:

1. **MCPs are frequently not used** even when they would be the best tool for the job (e.g. a code analysis MCP, a memory/context MCP like Serena, or a domain-specific search MCP).
2. **All configured MCPs consume tokens at session start** regardless of whether they are ever invoked, increasing cost with every prompt turn.

### Proposed solution

Introduce an explicit invocation syntax — similar to @mention in IDEs or # references — that allows users to directly target a specific MCP server or tool from their prompt:

```
@mcp-zen-of-languages analyze this file for code quality
#mcp-serena remember that we use conventional commits in this project
@github-mcp search for open issues labeled "bug"
```

This syntax would:
- **Force** the named MCP to be invoked for that turn, bypassing model-side tool selection uncertainty
- Allow **lazy loading** of MCPs that are not in the autoConnect pool until explicitly called (complementing #1938)
- Give users **cost control** — only paying token costs for MCPs they deliberately invoke

### Example prompts or workflows

```
# Trigger a specific MCP for code review
@Anselmoo/mcp-zen-of-languages review src/parser.ts

# Explicitly write to a memory MCP
@serena remember: this repo uses trunk-based development

# Force a GitHub MCP search instead of a generic web search
@github-mcp list open PRs in github/copilot-cli
```

### Additional context

- Related to #212 — interactive MCP selector per prompt
- Related to #1938 — deferred/lazy MCP loading to reduce token cost
- Related to #2235 — MCP profiles for context-based activation
- Cross-repo reference: cli/cli#12522 — making `gh` better for agents
- Example MCP that would benefit from explicit triggering: [Anselmoo/mcp-zen-of-languages](https://github.com/Anselmoo/mcp-zen-of-languages) for quick per-file code analysis

This is the terminal equivalent of the @tool selector in VS Code Copilot Chat's agent mode. Other CLI tools (Claude Code, Gemini CLI) are moving toward explicit tool invocation surfaces — Copilot CLI should have parity.

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

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

Hướng nghiên cứu

Start by reviewing the related issues #212, #1938, and #2235, along with the referenced cross-repo issue cli/cli#12522. Done means users can explicitly target an MCP server or tool from a prompt, with the requested invocation and lazy-loading behavior defined and covered by the project’s relevant checks.

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

Đánh giá

Lĩnh vực
ai, cli
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
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
35/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.