How to use MCP servers in VS Code with GitHub Copilot
Set up MCP servers in VS Code with .mcp.json or mcp-config.json, the MCP: Add Server command and Copilot Agent mode.
Requirements
A recent version of VS Code with GitHub Copilot. MCP tools are used from Copilot Chat in Agent mode.
1. Pick a config file
VS Code reads several files. For new setups it recommends .mcp.json at the workspace root (to share with your team) or ~/.copilot/mcp-config.json for personal servers; both use the mcpServers key, like Claude Desktop. The older .vscode/mcp.json still works and uses a servers key with a type for each server:
{
"servers": {
"fetch": {
"type": "stdio",
"command": "uvx",
"args": ["mcp-server-fetch"]
}
}
}2. Or use the command
Run MCP: Add Server from the Command Palette, or Chat: Open Customizations → MCP Servers, to add a server through a guided flow. You can also type @mcp in the Extensions view to install from the MCP server gallery.
3. Start and use it
Open Copilot Chat in Agent mode, confirm the trust prompt, and use the Configure Tools button to enable the server’s tools. MCP: List Servers shows whether it is running.
Secrets
Do not hard-code API keys. In .vscode/mcp.json you can use input variables (VS Code asks once and stores the value securely) or an environment file; the portable .mcp.json and mcp-config.json files do not support input variables, so reference environment variables there.