How to Set Up MCP Servers in GitHub Copilot (Step-by-Step)

Connect GitHub Copilot to external tools with MCP servers. Complete Copilot MCP setup guide covering VS Code mcp.json, Copilot CLI mcp-config.json, configuration examples, and troubleshooting.

October 19, 2026
implementationguidesetupCopilotMCPmcp.jsonmcp-config.json

Prerequisites

  • GitHub Copilot enabled (VS Code, Visual Studio, JetBrains, or Copilot CLI)
  • VS Code 1.101+ for remote MCP with OAuth (1.99+ for local MCP)
  • Node.js 18+ or Docker for npx- and Docker-based servers

What is MCP?

MCP (Model Context Protocol) lets Copilot connect to external tools, databases, and services. An MCP server exposes a standard set of tools that Copilot can call — from database queries to web searches — without you pasting data into the chat.

Enabling MCP in Copilot

Copilot uses different configuration files depending on where it runs:

  1. VS Code — .vscode/mcp.json for the workspace, or the profile mcp.json for the user
  2. Copilot CLI — ~/.copilot/mcp-config.json for the user, plus .mcp.json or .github/mcp.json per repository
  3. JetBrains, Visual Studio, Eclipse, Xcode — their own MCP settings; .vscode/mcp.json is VS Code-specific and is not read by Copilot CLI

Method 1: VS Code (mcp.json)

VS Code uses a top-level servers object. Create .vscode/mcp.json in your workspace:

{
  "servers": {
    "filesystem": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "./"]
    },
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/"
    }
  }
}
  1. Open the file in VS Code — it detects mcp.json and shows a Start Server button
  2. Click Start Server next to each server (or start all)
  3. Copilot Chat can then use the server's tools

For servers used across all workspaces, run MCP: Open User Configuration and add them to the profile mcp.json with the same top-level servers object. There is no mcp.servers setting.

The GitHub server above uses OAuth on first connection. To authenticate with a PAT instead, add an Authorization header and a VS Code input:

{
  "inputs": [
    {
      "type": "promptString",
      "id": "github_mcp_pat",
      "description": "GitHub Personal Access Token",
      "password": true
    }
  ],
  "servers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "Authorization": "Bearer ${input:github_mcp_pat}"
      }
    }
  }
}

Method 2: Copilot CLI

Copilot CLI reads the user configuration at ~/.copilot/mcp-config.json. It uses a top-level mcpServers object, and does not read .vscode/mcp.json:

{
  "mcpServers": {
    "filesystem": {
      "type": "local",
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "."],
      "env": {},
      "tools": ["*"]
    },
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "Authorization": "Bearer YOUR_GITHUB_PAT"
      },
      "tools": ["*"]
    }
  }
}

You can also add servers from the terminal:

copilot mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem .
copilot mcp add --transport http github https://api.githubcopilot.com/mcp/

Then use prompt mode with -p:

copilot -p "Query the filesystem server for all markdown files in docs/"

Verifying Your Servers

  1. In VS Code, open the Copilot status/chat panel
  2. Look for the MCP server indicator — connected servers are listed
  3. Ask Copilot: "Use the github server to list my recent issues"

If a server is not listed, check the server process started without errors (see Troubleshooting).

Using MCP Tools in Copilot

Once connected, Copilot Chat can call the server's tools in context:

You: "Use the postgres server to show the schema of the orders table."

Copilot: [calls the postgres tool, returns the schema and summarizes it]

Copilot treats MCP tools as first-class capabilities — you can chain multiple servers in one request (e.g., read from a database, then search the web, then draft a summary).

Security Considerations

  • Keep secrets out of committed files — use VS Code ${input:...} variables for VS Code servers, and keep credentials in the user-level Copilot CLI file
  • Scope servers per workspace — prefer project mcp.json over user-level settings unless the server is genuinely global
  • Review server tools before enabling — an MCP server runs arbitrary commands on your machine
  • Least privilege — give servers the minimum credentials for their task

Troubleshooting

Further Resources

Sources