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.
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:
- VS Code —
.vscode/mcp.jsonfor the workspace, or the profilemcp.jsonfor the user - Copilot CLI —
~/.copilot/mcp-config.jsonfor the user, plus.mcp.jsonor.github/mcp.jsonper repository - JetBrains, Visual Studio, Eclipse, Xcode — their own MCP settings;
.vscode/mcp.jsonis 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/"
}
}
}
- Open the file in VS Code — it detects
mcp.jsonand shows a Start Server button - Click Start Server next to each server (or start all)
- 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
- In VS Code, open the Copilot status/chat panel
- Look for the MCP server indicator — connected servers are listed
- 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.jsonover 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
- MCP Servers directory — pick servers that match your tools
- MCP Setup in VS Code — detailed VS Code MCP walkthrough
- MCP Setup in Cursor — the same concepts in Cursor
- GitHub Copilot Configuration — copilot-instructions.md and settings
Sources
Related Articles & Guides
How to Set Up MCP Servers in Cursor (Step-by-Step)
Connect Cursor to external tools with MCP servers. Complete Cursor MCP setup guide with .cursor/mcp.json configuration, the MCP UI, troubleshooting, and security best practices.
How to Set Up MCP Servers in Pi (Step-by-Step)
Connect Pi to external tools with its built-in MCP support. Covers pi mcp add/list/remove, mcp.json configuration, remote servers, and troubleshooting.
How to Set Up MCP Servers in Jcode (Step-by-Step)
Connect Jcode to external tools with MCP servers. Complete Jcode MCP setup guide with ~/.jcode/mcp.json and .jcode/mcp.json configuration, importing Claude Code servers, and troubleshooting.