{"meta":{"title":"Adding MCP servers for GitHub Copilot CLI","intro":"Extend Copilot's capabilities by connecting Model Context Protocol (MCP) servers to provide additional tools and context.","product":"GitHub Copilot","breadcrumbs":[{"href":"/en/enterprise-cloud@latest/copilot","title":"GitHub Copilot"},{"href":"/en/enterprise-cloud@latest/copilot/how-tos","title":"How-tos"},{"href":"/en/enterprise-cloud@latest/copilot/how-tos/copilot-cli","title":"Copilot CLI"},{"href":"/en/enterprise-cloud@latest/copilot/how-tos/copilot-cli/customize-copilot","title":"Customize Copilot CLI"},{"href":"/en/enterprise-cloud@latest/copilot/how-tos/copilot-cli/customize-copilot/add-mcp-servers","title":"Add MCP servers"}],"documentType":"article"},"body":"# Adding MCP servers for GitHub Copilot CLI\n\nExtend Copilot's capabilities by connecting Model Context Protocol (MCP) servers to provide additional tools and context.\n\nThe 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)](/en/enterprise-cloud@latest/copilot/concepts/context/mcp).\n\n## Adding an MCP server\n\n> \\[!NOTE]\n> 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.\n\nIf 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.\n\nYou can add MCP servers in the following ways:\n\n* [Using the `/mcp add` command](#using-the-mcp-add-command)\n* [Using the `copilot mcp add` subcommand](#using-the-copilot-mcp-add-subcommand)\n* [Editing the configuration file](#editing-the-configuration-file)\n* [Adding per-repository MCP servers](#adding-per-repository-mcp-servers)\n* [Searching and installing from the registry (experimental)](#searching-and-installing-from-the-registry)\n\nFor installation instructions, available tools, and URLs for specific MCP servers, see the [GitHub MCP Registry](https://github.com/mcp).\n\n### Using the `/mcp add` command\n\n1. In interactive mode, enter `/mcp add`. A configuration form is displayed. Use <kbd>Tab</kbd> to navigate between fields.\n\n2. Next to **Server Name**, enter a unique name for the MCP server. This is the name you will use to refer to the server.\n\n3. Next to **Server Type**, select a type by pressing the corresponding number. The following types are available:\n\n   * **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.\n   * **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. <!-- markdownlint-disable-line GHD046 -->\n\n4. The remaining fields depend on the server type you selected:\n\n   * If you chose **Local** or **STDIO**:\n\n     * Next to **Command**, enter the command to start the server, including any arguments. For example, `npx @playwright/mcp@latest`. This corresponds to both the `command` and `args` properties in the JSON configuration file.\n     * 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\"}`. The `PATH` variable is automatically inherited from your environment. All other environment variables must be configured here.\n\n   * If you chose **HTTP** or **SSE**:\n\n     * Next to **URL**, paste the remote server URL. For example, `https://mcp.context7.com/mcp`.\n     * Next to **HTTP Headers**, optionally specify HTTP headers as JSON. For example, `{\"CONTEXT7_API_KEY\": \"YOUR-API-KEY\"}`.\n\n5. 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 `*`.\n\n6. Press <kbd>Ctrl</kbd>+<kbd>S</kbd> to save the configuration. The MCP server is added and available immediately without restarting the CLI.\n\n### Using the `copilot mcp add` subcommand\n\nYou 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`.\n\nFor local (stdio) servers, provide the command after `--`:\n\n```shell copy\ncopilot mcp add SERVER-NAME -- COMMAND [ARGS...]\n```\n\nFor remote (HTTP/SSE) servers, specify the transport and provide the URL:\n\n```shell copy\ncopilot mcp add --transport http SERVER-NAME URL\n```\n\nYou can also pass additional options:\n\n* `--env KEY=VALUE`: Set environment variables for the server. Repeat for multiple variables.\n* `--header \"HEADER: VALUE\"`: Set HTTP headers for remote servers. Repeat for multiple headers.\n* `--transport TRANSPORT`: Set the transport type (`stdio`, `http`, or `sse`). The default is `stdio`.\n* `--tools TOOLS`: Specify which tools to enable. Use `*` for all tools (default), a comma-separated list, or `\"\"` for none.\n* `--timeout MS`: Set a timeout in milliseconds.\n\n#### Examples\n\nAdd a local stdio server:\n\n```shell copy\ncopilot mcp add context7 -- npx -y @upstash/context7-mcp\n```\n\nAdd a local server with environment variables:\n\n```shell copy\ncopilot 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\n```\n\nAdd a remote HTTP server:\n\n```shell copy\ncopilot mcp add --transport http notion \\\n  https://mcp.notion.com/mcp\n```\n\nAdd a remote server with an authorization header:\n\n```shell copy\ncopilot mcp add --transport http \\\n  --header \"Authorization: Bearer YOUR-TOKEN\" \\\n  stripe https://mcp.stripe.com\n```\n\n### Editing the configuration file\n\nYou 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.\n\nThe following example shows a configuration file with a local server and a remote HTTP server:\n\n```json copy\n{\n  \"mcpServers\": {\n    \"playwright\": {\n      \"type\": \"local\",\n      \"command\": \"npx\",\n      \"args\": [\"@playwright/mcp@latest\"],\n      \"env\": {},\n      \"tools\": [\"*\"]\n    },\n    \"context7\": {\n      \"type\": \"http\",\n      \"url\": \"https://mcp.context7.com/mcp\",\n      \"headers\": {\n        \"CONTEXT7_API_KEY\": \"YOUR-API-KEY\"\n      },\n      \"tools\": [\"*\"]\n    }\n  }\n}\n```\n\nFor more information on MCP server configuration, see [Configure MCP servers for your repository](/en/enterprise-cloud@latest/copilot/how-tos/copilot-on-github/customize-copilot/configure-mcp-servers#writing-a-json-configuration-for-mcp-servers).\n\n### Adding per-repository MCP servers\n\nYou 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.\n\nCopilot CLI looks for project-level configuration in the following locations:\n\n| Path                                                                                 | Recommended use                                                          |\n| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |\n| `.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 |\n| `.github/mcp.json`                                                                   | Shared configuration that is committed to the repository                 |\n\nWhen you start Copilot CLI 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 [GitHub Copilot CLI command reference](/en/enterprise-cloud@latest/copilot/reference/copilot-cli-reference/cli-command-reference#mcp-server-trust-levels).\n\nProject-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:\n\n```json copy\n{\n  \"mcpServers\": {\n    \"playwright\": {\n      \"type\": \"local\",\n      \"command\": \"npx\",\n      \"args\": [\"@playwright/mcp@latest\"]\n    }\n  }\n}\n```\n\nThe same server can also be configured with the bare top-level format:\n\n```json copy\n{\n  \"playwright\": {\n    \"type\": \"local\",\n    \"command\": \"npx\",\n    \"args\": [\"@playwright/mcp@latest\"]\n  }\n}\n```\n\n> \\[!NOTE]\n> 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 [About GitHub Copilot CLI](/en/enterprise-cloud@latest/copilot/concepts/agents/copilot-cli/about-copilot-cli#trusted-directories).\n\nIn 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 [GitHub Copilot CLI command reference](/en/enterprise-cloud@latest/copilot/reference/copilot-cli-reference/cli-command-reference#environment-variables).\n\nThe `.vscode/mcp.json` file for VS Code is not read by Copilot CLI. It uses the unsupported top-level key `servers`. To migrate an existing `.vscode/mcp.json` to a format the CLI accepts, see [GitHub Copilot CLI command reference](/en/enterprise-cloud@latest/copilot/reference/copilot-cli-reference/cli-command-reference#migrating-from-vscodemcpjson).\n\n### Searching and installing from the registry\n\n> \\[!NOTE]\n> 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.\n\nYou can discover and install MCP servers directly from the [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.\n\nIf your organization has configured a custom MCP registry URL, `/mcp search` connects to that registry instead of the default GitHub registry.\n\n1. In interactive mode, enter `/mcp search` to browse top servers by stars, or `/mcp search QUERY` to search for a specific server. For example:\n\n   ```text\n   /mcp search context7\n   ```\n\n2. A keyboard-navigable list of matching servers is displayed. Use the arrow keys to browse the results.\n\n3. 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.\n\n4. Press <kbd>Ctrl</kbd>+<kbd>S</kbd> to save. The server is added to your `mcp-config.json` and started immediately.\n\n## Managing MCP servers\n\nYou can manage your configured MCP servers using the `/mcp` commands in interactive mode or the `copilot mcp` subcommands from the terminal.\n\n### Using `/mcp` commands in interactive mode\n\n* **List configured MCP servers:** Use the command `/mcp`. This opens the plugins dashboard showing all configured MCP servers and their current status. Use `/mcp list` to print the same information as plain text.\n\n* **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.\n\n* **Edit a server's configuration:** Use the command `/mcp edit SERVER-NAME`.\n\n* **Delete a server:** Use the command `/mcp delete SERVER-NAME`.\n\n* **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.\n\n* **Enable a previously disabled server:** Use the command `/mcp enable SERVER-NAME`.\n\n### Using `copilot mcp` subcommands from the terminal\n\nYou can also manage MCP servers from the terminal without entering interactive mode.\n\n* **List all configured servers:**\n\n  ```shell copy\n  copilot mcp list\n  ```\n\n  Lists servers from all configuration sources (user, workspace, and plugin). Add `--json` for JSON output.\n\n* **View server details:**\n\n  ```shell copy\n  copilot mcp get SERVER-NAME\n  ```\n\n  Shows a server's type, status, and available tools. Add `--json` for JSON output.\n\n* **Remove a server:**\n\n  ```shell copy\n  copilot mcp remove SERVER-NAME\n  ```\n\n  Removes the server from the user configuration.\n\n## Using MCP servers\n\nOnce 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.\n\n## Further reading\n\n* [About Model Context Protocol (MCP)](/en/enterprise-cloud@latest/copilot/concepts/context/mcp)\n* [Extending GitHub Copilot Chat with Model Context Protocol (MCP) servers](/en/enterprise-cloud@latest/copilot/how-tos/provide-context/use-mcp-in-your-ide/extend-copilot-chat-with-mcp)\n* [Configure MCP servers for your repository](/en/enterprise-cloud@latest/copilot/how-tos/copilot-on-github/customize-copilot/configure-mcp-servers)"}