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
Copy file name to clipboardExpand all lines: content/copilot/how-tos/copilot-cli/customize-copilot/add-mcp-servers.md
+110-2Lines changed: 110 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,10 +22,15 @@ The Model Context Protocol (MCP) is an open standard that defines how applicatio
22
22
23
23
If your organization or enterprise has configured a registry URL and allowlist policy, those settings apply to {% data variables.copilot.copilot_cli_short %}. The configured registry URL will appear as a discovery source, and only servers permitted by the allowlist policy can run.
24
24
25
-
You can add MCP servers using the interactive `/mcp add` command within the CLI, or by editing the configuration file directly.
25
+
You can add MCP servers in the following ways:
26
+
*[Using the `/mcp add` command](#using-the-mcp-add-command)
27
+
*[Using the `copilot mcp add` subcommand](#using-the-copilot-mcp-add-subcommand)
28
+
*[Editing the configuration file](#editing-the-configuration-file)
29
+
*[Searching and installing from the registry (experimental)](#searching-and-installing-from-the-registry)
26
30
27
31
For installation instructions, available tools, and URLs for specific MCP servers, see the [{% data variables.product.github %} MCP Registry](https://github.com/mcp).
28
32
33
+
29
34
### Using the `/mcp add` command
30
35
31
36
1. In interactive mode, enter `/mcp add`. A configuration form is displayed. Use <kbd>Tab</kbd> to navigate between fields.
@@ -50,6 +55,59 @@ For installation instructions, available tools, and URLs for specific MCP server
50
55
1. Next to **Tools**, specify which tools from the server should be available. Enter `*` to include all tools, or provide a comma-separated list of tool names (no quotes needed). The default is `*`.
51
56
1. Press <kbd>Ctrl</kbd>+<kbd>S</kbd> to save the configuration. The MCP server is added and available immediately without restarting the CLI.
52
57
58
+
### Using the `copilot mcp add` subcommand
59
+
60
+
You can add MCP servers from the terminal using the `copilot mcp add` subcommand, without entering interactive mode. The server is added to the user configuration at `~/.copilot/mcp-config.json`.
61
+
62
+
For local (stdio) servers, provide the command after `--`:
63
+
64
+
```shell copy
65
+
copilot mcp add SERVER-NAME -- COMMAND [ARGS...]
66
+
```
67
+
68
+
For remote (HTTP/SSE) servers, specify the transport and provide the URL:
69
+
70
+
```shell copy
71
+
copilot mcp add --transport http SERVER-NAME URL
72
+
```
73
+
74
+
You can also pass additional options:
75
+
76
+
*`--env KEY=VALUE`: Set environment variables for the server. Repeat for multiple variables.
77
+
*`--header "HEADER: VALUE"`: Set HTTP headers for remote servers. Repeat for multiple headers.
78
+
*`--transport TRANSPORT`: Set the transport type (`stdio`, `http`, or `sse`). The default is `stdio`.
79
+
*`--tools TOOLS`: Specify which tools to enable. Use `*` for all tools (default), a comma-separated list, or `""` for none.
You can also add MCP servers by editing the configuration file at `~/.copilot/mcp-config.json`. This is useful if you want to share configurations or add multiple servers at once.
@@ -80,9 +138,31 @@ The following example shows a configuration file with a local server and a remot
80
138
81
139
For more information on MCP server configuration, see [AUTOTITLE](/copilot/how-tos/use-copilot-agents/cloud-agent/extend-cloud-agent-with-mcp#writing-a-json-configuration-for-mcp-servers).
82
140
141
+
### Searching and installing from the registry
142
+
143
+
> [!NOTE]
144
+
> The `/mcp search` command is currently an experimental feature. To use it, start {% data variables.copilot.copilot_cli_short %} with the `--experimental` command line option, or enter `/experimental on` during a session.
145
+
146
+
You can discover and install MCP servers directly from the [{% data variables.product.github %} MCP Registry](https://github.com/mcp) using the `/mcp search` command in interactive mode. This lets you browse available servers, view their details, and install them without manually filling out the configuration form.
147
+
148
+
If your organization has configured a custom MCP registry URL, `/mcp search` connects to that registry instead of the default {% data variables.product.github %} registry.
149
+
150
+
1. In interactive mode, enter `/mcp search` to browse top servers by stars, or `/mcp search QUERY` to search for a specific server. For example:
151
+
152
+
```text
153
+
/mcp search context7
154
+
```
155
+
156
+
1. A keyboard-navigable list of matching servers is displayed. Use the arrow keys to browse the results.
157
+
1. Select a server to open its configuration form. The form is pre-populated with the server's configuration from the registry. Fill in any required fields, such as API keys or tokens.
158
+
1. Press <kbd>Ctrl</kbd>+<kbd>S</kbd> to save. The server is added to your `mcp-config.json` and started immediately.
159
+
160
+
83
161
## Managing MCP servers
84
162
85
-
You can manage your configured MCP servers using the following `/mcp` commands in {% data variables.copilot.copilot_cli_short %}.
163
+
You can manage your configured MCP servers using the `/mcp` commands in interactive mode or the `copilot mcp` subcommands from the terminal.
164
+
165
+
### Using `/mcp` commands in interactive mode
86
166
87
167
***List configured MCP servers:** Use the command `/mcp show`. This displays all configured MCP servers and their current status.
88
168
@@ -96,6 +176,34 @@ You can manage your configured MCP servers using the following `/mcp` commands i
96
176
97
177
***Enable a previously disabled server:** Use the command `/mcp enable SERVER-NAME`.
98
178
179
+
### Using `copilot mcp` subcommands from the terminal
180
+
181
+
You can also manage MCP servers from the terminal without entering interactive mode.
182
+
183
+
***List all configured servers:**
184
+
185
+
```shell copy
186
+
copilot mcp list
187
+
```
188
+
189
+
Lists servers from all configuration sources (user, workspace, and plugin). Add `--json` for JSON output.
190
+
191
+
***View server details:**
192
+
193
+
```shell copy
194
+
copilot mcp get SERVER-NAME
195
+
```
196
+
197
+
Shows a server's type, status, and available tools. Add `--json` for JSON output.
198
+
199
+
***Remove a server:**
200
+
201
+
```shell copy
202
+
copilot mcp remove SERVER-NAME
203
+
```
204
+
205
+
Removes the server from the user configuration.
206
+
99
207
## Using MCP servers
100
208
101
209
Once you have added an MCP server, {% data variables.product.prodname_copilot_short %} can automatically use the tools it provides when relevant to your prompt. You can also directly reference an MCP server and specific tools in a prompt to ensure they are used.
0 commit comments