github / github/copilot-cli

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

Open
#2,690 2 comments 3 reactions 0 assignees View on GitHub
area:mcp
Dominant language
Shell
Stars
11.2k
Forks
1.9k
Avg merge
14h 16m
Merged PRs (30d)
6

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.