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.
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:
- VS Code (and other JetBrains/Visual Studio IDEs with the Copilot extension) — via
.vscode/mcp.json - 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}"
}
}
}
}
- Open the file in VS Code — it auto-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, 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
- 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
- Use environment interpolation (
${VAR_NAME}) for API keys so secrets stay out of the committedmcp.json - 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
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 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.
How to Set Up MCP Servers in Antigravity CLI (Step-by-Step)
Connect Antigravity CLI to external tools with MCP servers. Complete setup guide covering agy mcp add/list/remove commands, settings.json configuration, verification, and troubleshooting.