Text of docs.github.com › en › copilot › how-tos › copilot-cli › customize-copilot › add-mcp-servers as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Adding MCP servers for GitHub Copilot CLI - GitHub Docs

Skip to main content Skip to content Collapse sidebar Expand sidebar Adding MCP servers for GitHub Copilot CLI Extend Copilot's capabilities by connecting Model Context Protocol (MCP) servers to provide additional tools and context. In this article 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 Model Context Protocol (MCP) . Connecting services Note Copilot connectors are in public preview and are subject to change. Connect an external service once to give Copilot access to its tools and context. You can then use the connection across supported Copilot surfaces without repeating setup or signing in separately in each one. GitHub handles MCP server configuration and authentication for you.

If your organization or enterprise provides your Copilot subscription, an administrator may need to update its policies to allow connectors. See Copilot connectors . In an interactive CLI session, enter /mcp to open the MCP server dashboard. Use the ← and → keys to switch to the Connectors view. Select a connector, press Enter , then select Connect . Follow the prompts to sign in to the service and approve access.

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 add command Using the copilot mcp add subcommand Editing the configuration file Adding per-repository MCP servers Searching and installing from the registry 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: STDIO : starts a local process and communicates over standard input/output ( stdin / stdout ). This is the standard MCP protocol type name, so it's 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. The remaining fields depend on the server type you selected: If you chose STDIO : 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. 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 and a small set of platform-specific environment variables are automatically inherited from your environment. Other required environment variables must be configured here.

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 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...] For remote (HTTP/SSE) servers, specify the transport and provide the 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 , or sse ). The default is stdio . --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 Add a local server with environment variables: copilot mcp add github --env 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 Add a remote server with an authorization header: 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" : [ "*" ] } } } For more information on MCP server configuration, see Configure MCP servers for your repository .

Adding per-repository MCP servers 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. Copilot CLI looks for project-level configuration in the following locations: Path Recommended use .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 .github/mcp.json Shared configuration that is committed to the repository When 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 . 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: { "mcpServers" : { "playwright" : { "type" : "local" , "command" : "npx" , "args" : [ "@playwright/mcp@latest" ] } } } The same server can also be configured with the bare top-level format: { "playwright" : { "type" : "local"

The rest of this page is on the live site.