You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Searching and installing from the registry (experimental)](#searching-and-installing-from-the-registry)
30
31
31
32
For installation instructions, available tools, and URLs for specific MCP servers, see the [{% data variables.product.github %} MCP Registry](https://github.com/mcp).
@@ -138,6 +139,52 @@ The following example shows a configuration file with a local server and a remot
138
139
139
140
For more information on MCP server configuration, see [AUTOTITLE](/copilot/how-tos/copilot-on-github/customize-copilot/configure-mcp-servers#writing-a-json-configuration-for-mcp-servers).
140
141
142
+
### Adding per-repository MCP servers
143
+
144
+
You can configure MCP servers for a specific project by adding a JSON file to the repository. This is useful when you want servers to be available only when working in that project, or when you want to share an MCP setup with collaborators by committing it to the repository.
145
+
146
+
{% data variables.copilot.copilot_cli_short %} looks for project-level configuration in the following locations:
147
+
148
+
| Path | Recommended use |
149
+
|------|-----------------|
150
+
|`.mcp.json` (in any directory from your working directory up to the repository root) | Local or per-checkout configuration; commonly placed at the project root |
151
+
|`.github/mcp.json`| Shared configuration that is committed to the repository |
152
+
153
+
When you start {% data variables.copilot.copilot_cli_short %} inside a Git repository, the CLI walks from your current working directory up to the repository root, loading MCP configuration files along the way. If both `.mcp.json` and `.github/mcp.json` exist in the same directory, `.mcp.json` takes precedence. When server names conflict, definitions in files closer to your working directory take precedence. Project-level definitions also take precedence over those in `~/.copilot/mcp-config.json`. For more information on relative trust, see [AUTOTITLE](/copilot/reference/copilot-cli-reference/cli-command-reference#mcp-server-trust-levels).
154
+
155
+
Project-level files can use either the `mcpServers` top-level object shown in `~/.copilot/mcp-config.json`, or the bare top-level format where each key is an MCP server name. For example, this configuration uses the `mcpServers` object:
156
+
157
+
```json copy
158
+
{
159
+
"mcpServers": {
160
+
"playwright": {
161
+
"type": "local",
162
+
"command": "npx",
163
+
"args": ["@playwright/mcp@latest"]
164
+
}
165
+
}
166
+
}
167
+
```
168
+
169
+
The same server can also be configured with the bare top-level format:
170
+
171
+
```json copy
172
+
{
173
+
"playwright": {
174
+
"type": "local",
175
+
"command": "npx",
176
+
"args": ["@playwright/mcp@latest"]
177
+
}
178
+
}
179
+
```
180
+
181
+
> [!NOTE]
182
+
> Project-level MCP servers are loaded only after you confirm folder trust on first launch. They are silently skipped in untrusted directories. For more information on folder trust, see [AUTOTITLE](/copilot/concepts/agents/copilot-cli/about-copilot-cli#trusted-directories).
183
+
184
+
In prompt mode (`copilot -p`), project-level MCP servers are loaded automatically if the current directory is already trusted. If the directory is not trusted, project-level MCP servers are skipped by default. To load them anyway, set the `GITHUB_COPILOT_PROMPT_MODE_WORKSPACE_MCP` environment variable to `true`, since prompt mode cannot show an interactive trust prompt. For more information, see [AUTOTITLE](/copilot/reference/copilot-cli-reference/cli-command-reference#environment-variables).
185
+
186
+
The `.vscode/mcp.json` file for {% data variables.product.prodname_vscode_shortname %} is not read by {% data variables.copilot.copilot_cli_short %}. It uses the unsupported top-level key `servers`. To migrate an existing `.vscode/mcp.json` to a format the CLI accepts, see [AUTOTITLE](/copilot/reference/copilot-cli-reference/cli-command-reference#migrating-from-vscodemcpjson).
Copy file name to clipboardExpand all lines: content/copilot/reference/copilot-cli-reference/cli-config-dir-reference.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -480,8 +480,11 @@ These settings apply across all your sessions and repositories. You can use the
480
480
|`renderMarkdown`|`boolean`|`true`| Render Markdown in terminal output. |
481
481
|`remoteExport`|`boolean`|`true`| Export sessions remotely when session sync is available. Set to `false` to opt out of remote export by default. The `remoteSessions` setting when set to `true`, or the `--remote` flag, still enables export and steering regardless of this setting. |
482
482
|`respectGitignore`|`boolean`|`true`| Exclude gitignored files from the `@` file mention picker. When `false`, the picker includes files normally excluded by `.gitignore`. |
483
-
|`sandbox.gitAuth`|`boolean`|`false`| Inject Git credentials into the sandbox so commands running inside it can authenticate with Git. |
484
-
|`sandbox.ghAuth`|`boolean`|`false`| Inject {% data variables.product.prodname_cli %} (`gh`) credentials into the sandbox so commands running inside it can authenticate with the {% data variables.product.prodname_cli %}. |
483
+
|`sandbox.allowBypass`|`boolean`|`true`| Allow sandboxed commands to request a bypass for specific operations (surfaces a permission prompt) so tools like `grep` and `glob` keep working when the sandbox would otherwise block them. Set to `false` to opt out. |
484
+
|`sandbox.enabled`|`boolean`|`false`| Restrict shell commands, MCP/LSP servers, and built-in file/web tools to a sandboxed environment with limited file system and network access. Enable it from the `/sandbox` dialog or with `/sandbox enable`. |
485
+
|`sandbox.gitAuth`|`boolean`|`true`| Inject Git credentials into the sandbox so commands running inside it can authenticate with Git. Set to `false` to opt out. |
486
+
|`sandbox.ghAuth`|`boolean`|`true`| Inject {% data variables.product.prodname_cli %} (`gh`) credentials into the sandbox so commands running inside it can authenticate with the {% data variables.product.prodname_cli %}. Set to `false` to opt out. |
487
+
|`sandbox.userPolicy.network.allowLocalNetwork`|`boolean`|`true`| Allow sandboxed commands to reach local network addresses (for example, local dev servers). Set to `false` to opt out. |
485
488
|`sandbox.userPolicy.seatbelt.keychainAccess`|`boolean`|`false`| macOS only. Grant sandboxed commands access to the system keychain. Can also be toggled from the `/sandbox` dialog. |
0 commit comments