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, configuration examples, and troubleshooting.

August 10, 2026
implementationguidesetupCopilotMCPmcp.json

Prerequisites

  • GitHub Copilot enabled (VS Code, Visual Studio, JetBrains, or Copilot CLI)
  • VS Code 1.99+ for the in-editor MCP support
  • 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 supports MCP in two environments:

  1. VS Code (and other JetBrains/Visual Studio IDEs with the Copilot extension) — via .vscode/mcp.json
  2. Copilot CLI — via its own configuration in ~/.claude.json-style settings or command-line flags

Method 1: VS Code (mcp.json)

Copilot in VS Code uses the same MCP configuration as VS Code's built-in MCP support. Create .vscode/mcp.json in your workspace:

{
  "servers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "./"],
      "env": {}
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "${GITHUB_TOKEN}"
      }
    }
  }
}
  1. Open the file in VS Code — it auto-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, add them to your User Settings (mcp.servers) instead:

{
  "mcp.servers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost:5432/mydb"]
    }
  }
}

Method 2: Copilot CLI

Copilot CLI is a terminal-first agent. It supports MCP servers through its settings — typically defined in the same format as other CLI agents:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "./"]
    }
  }
}

Once configured, run Copilot CLI and reference the server's tools directly:

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

Check copilot --help or your CLI's settings file location — the exact path varies by version.

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

  • Use environment interpolation (${VAR_NAME}) for API keys so secrets stay out of the committed mcp.json
  • 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