The Model Context Protocol (MCP) is an open standard that defines how applications share context with large language models (LLMs). You can connect MCP servers to GitHub Copilot CLI to give Copilot access to external tools, data sources, and services. For an overview of MCP, see About Model Context Protocol (MCP).
Adding an MCP server
Note
The GitHub MCP server is built into Copilot CLI and is already available without any additional configuration. The steps below are for adding other MCP servers.
If your organization or enterprise has configured a registry URL and allowlist policy, those settings apply to Copilot CLI. The configured registry URL will appear as a discovery source, and only servers permitted by the allowlist policy can run.
You can add MCP servers in the following ways:
- Using the
/mcp addcommand - Using the
copilot mcp addsubcommand - Editing the configuration file
- Searching and installing from the registry (experimental)
For installation instructions, available tools, and URLs for specific MCP servers, see the GitHub MCP Registry.
Using the /mcp add command
-
In interactive mode, enter
/mcp add. A configuration form is displayed. Use Tab to navigate between fields. -
Next to Server Name, enter a unique name for the MCP server. This is the name you will use to refer to the server.
-
Next to Server Type, select a type by pressing the corresponding number. The following types are available:
- Local or STDIO: starts a local process and communicates over standard input/output (
stdin/stdout). Both options work the same way. STDIO is the standard MCP protocol type name, so choose this if you want your configuration to be compatible with VS Code, the Copilot cloud agent, and other MCP clients. - HTTP or SSE: connects to a remote MCP server. HTTP uses the Streamable HTTP transport. SSE uses the legacy HTTP with Server-Sent Events transport, which is deprecated in the MCP specification but still supported for backwards compatibility.
- Local or STDIO: starts a local process and communicates over standard input/output (
-
The remaining fields depend on the server type you selected:
-
If you chose Local or STDIO:
- Next to Command, enter the command to start the server, including any arguments. For example,
npx @playwright/mcp@latest. This corresponds to both thecommandandargsproperties in the JSON configuration file. - Next to Environment Variables, optionally specify environment variables the server needs, such as API keys or tokens, as JSON key-value pairs. For example,
{"API_KEY": "YOUR-API-KEY"}. ThePATHvariable is automatically inherited from your environment. All other environment variables must be configured here.
- Next to Command, enter the command to start the server, including any arguments. For example,
-
If you chose HTTP or SSE:
- Next to URL, paste the remote server URL. For example,
https://mcp.context7.com/mcp. - Next to HTTP Headers, optionally specify HTTP headers as JSON. For example,
{"CONTEXT7_API_KEY": "YOUR-API-KEY"}.
- Next to URL, paste the remote server URL. For example,
-
-
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*. -
Press Ctrl+S to save the configuration. The MCP server is added and available immediately without restarting the CLI.
Using the copilot mcp add subcommand
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.
For local (stdio) servers, provide the command after --:
copilot mcp add SERVER-NAME -- COMMAND [ARGS...]
copilot mcp add SERVER-NAME -- COMMAND [ARGS...]
For remote (HTTP/SSE) servers, specify the transport and provide the URL:
copilot mcp add --transport http SERVER-NAME URL
copilot mcp add --transport http SERVER-NAME URL
You can also pass additional options:
--env KEY=VALUE: Set environment variables for the server. Repeat for multiple variables.--header "HEADER: VALUE": Set HTTP headers for remote servers. Repeat for multiple headers.--transport TRANSPORT: Set the transport type (stdio,http, orsse). The default isstdio.--tools TOOLS: Specify which tools to enable. Use*for all tools (default), a comma-separated list, or""for none.--timeout MS: Set a timeout in milliseconds.
Examples
Add a local stdio server:
copilot mcp add context7 -- npx -y @upstash/context7-mcp
copilot mcp add context7 -- npx -y @upstash/context7-mcp
Add a local server with environment variables:
copilot mcp add github -e GITHUB_PERSONAL_ACCESS_TOKEN=YOUR_GITHUB_PAT -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
copilot mcp add github -e GITHUB_PERSONAL_ACCESS_TOKEN=YOUR_GITHUB_PAT -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
Add a remote HTTP server:
copilot mcp add --transport http notion \ https://mcp.notion.com/mcp
copilot mcp add --transport http notion \
https://mcp.notion.com/mcp
Add a remote server with an authorization header:
copilot mcp add --transport http \ --header "Authorization: Bearer YOUR-TOKEN" \ stripe https://mcp.stripe.com
copilot mcp add --transport http \
--header "Authorization: Bearer YOUR-TOKEN" \
stripe https://mcp.stripe.com
Editing the configuration file
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.
The following example shows a configuration file with a local server and a remote HTTP server:
{
"mcpServers": {
"playwright": {
"type": "local",
"command": "npx",
"args": ["@playwright/mcp@latest"],
"env": {},
"tools": ["*"]
},
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
"headers": {
"CONTEXT7_API_KEY": "YOUR-API-KEY"
},
"tools": ["*"]
}
}
}
{
"mcpServers": {
"playwright": {
"type": "local",
"command": "npx",
"args": ["@playwright/mcp@latest"],
"env": {},
"tools": ["*"]
},
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
"headers": {
"CONTEXT7_API_KEY": "YOUR-API-KEY"
},
"tools": ["*"]
}
}
}
For more information on MCP server configuration, see Configure MCP servers for your repository.
Searching and installing from the registry
Note
The /mcp search command is currently an experimental feature. To use it, start Copilot CLI with the --experimental command line option, or enter /experimental on during a session.
You can discover and install MCP servers directly from the GitHub MCP Registry 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.
If your organization has configured a custom MCP registry URL, /mcp search connects to that registry instead of the default GitHub registry.
-
In interactive mode, enter
/mcp searchto browse top servers by stars, or/mcp search QUERYto search for a specific server. For example:/mcp search context7 -
A keyboard-navigable list of matching servers is displayed. Use the arrow keys to browse the results.
-
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.
-
Press Ctrl+S to save. The server is added to your
mcp-config.jsonand started immediately.
Managing MCP servers
You can manage your configured MCP servers using the /mcp commands in interactive mode or the copilot mcp subcommands from the terminal.
Using /mcp commands in interactive mode
-
List configured MCP servers: Use the command
/mcp show. This displays all configured MCP servers and their current status. -
View details about a specific server: Use the command
/mcp show SERVER-NAME. This displays the status of the specified server and the list of tools it provides. -
Edit a server's configuration: Use the command
/mcp edit SERVER-NAME. -
Delete a server: Use the command
/mcp delete SERVER-NAME. -
Disable a server: Use the command
/mcp disable SERVER-NAME. A disabled server remains configured but is not used by Copilot for the current session. -
Enable a previously disabled server: Use the command
/mcp enable SERVER-NAME.
Using copilot mcp subcommands from the terminal
You can also manage MCP servers from the terminal without entering interactive mode.
-
List all configured servers:
Shell copilot mcp list
copilot mcp listLists servers from all configuration sources (user, workspace, and plugin). Add
--jsonfor JSON output. -
View server details:
Shell copilot mcp get SERVER-NAME
copilot mcp get SERVER-NAMEShows a server's type, status, and available tools. Add
--jsonfor JSON output. -
Remove a server:
Shell copilot mcp remove SERVER-NAME
copilot mcp remove SERVER-NAMERemoves the server from the user configuration.
Using MCP servers
Once you have added an MCP server, Copilot 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.