Document per-repo .mcp.json for Copilot CLI#44236
Conversation
Adds a 'Adding per-repository MCP servers' subsection to the Copilot CLI MCP how-to page, covering: - The .mcp.json (project root) and .github/mcp.json file locations - Lookup behavior (walk from cwd up to the git root; closer files win) - Folder trust gating - Prompt mode (-p) opt-out and the GITHUB_COPILOT_PROMPT_MODE_WORKSPACE_MCP environment variable - Pointer to the existing .vscode/mcp.json migration recipe Refs: github#44234
How to review these changes 👓Thank you for your contribution. To review these changes, choose one of the following options: A Hubber will need to deploy your changes internally to review. Table of review linksNote: Please update the URL for your staging server or codespace. The table shows the files in the
Key: fpt: Free, Pro, Team; ghec: GitHub Enterprise Cloud; ghes: GitHub Enterprise Server 🤖 This comment is automatically generated. |
There was a problem hiding this comment.
Pull request overview
Adds documentation to the Copilot CLI MCP how-to explaining how to configure MCP servers per-repository using .mcp.json / .github/mcp.json, including precedence rules and prompt-mode / trust-related behavior.
Changes:
- Documented per-repository MCP configuration file locations (
.mcp.jsonand.github/mcp.json) and precedence over user config. - Added an example per-repo MCP JSON config and notes about folder trust and prompt mode (
copilot -p) behavior. - Clarified that VS Code’s
.vscode/mcp.jsonis not consumed by Copilot CLI and linked to migration guidance.
- Clarify .mcp.json discovery is not limited to project root - Use prodname_vscode_shortname variable instead of hardcoding 'VS Code'
Why:
Closes #44234
The Copilot CLI MCP how-to (
add-mcp-servers.md) only documents the user-level~/.copilot/mcp-config.jsonand the interactive/mcp addflow. The CLI also reads per-repository configuration from.mcp.jsonand.github/mcp.json, but neither this how-to nor the "Add an MCP server" section ofuse-copilot-cli.mdmentions those files at all. The relevant trust and prompt-mode behaviours live only in the reference pages and are not linked from the how-to.This has produced several related bug reports in
github/copilot-cliwhose root cause is partly documentation — see #44234 for the list.What's being changed:
Adds a new
### Adding per-repository MCP serverssubsection tocontent/copilot/how-tos/copilot-cli/customize-copilot/add-mcp-servers.mdcovering:.mcp.json(project root) and.github/mcp.jsonfile locations, with their recommended uses..mcp.jsonit finds; closer-to-cwd wins on name conflicts; project-level definitions take precedence over~/.copilot/mcp-config.json.copilot -p) workspace MCP servers are not loaded by default, and require settingGITHUB_COPILOT_PROMPT_MODE_WORKSPACE_MCP=true. This connects the env var (already in the reference) back to.mcp.jsonfor the first time..vscode/mcp.jsonis not read, pointing to the existing migration recipe.All claims were verified against Copilot CLI v1.0.44-2 (the bundled JS) and confirmed by running
copilot mcp listandcopilot -pin both modes.Check off the following: