How to Add MCP Servers in VS Code (2026)
VS Code (with Copilot Chat) runs MCP servers in agent mode. Servers are declared in mcp.json files — per workspace or in your user profile — and can also be installed from a gallery with the @mcp filter.
1. Use the guided command
Open the Command Palette (Ctrl/Cmd+Shift+P) and run MCP: Add Server. Choose Command (stdio) for a local process or HTTP for a remote server, give it an ID, and pick which configuration file to write it into.
2. Know the config file locations
Workspace, portable: .mcp.json at the repo root (top-level mcpServers key) — committed and shared with the team.
Workspace, VS Code-specific: .vscode/mcp.json (top-level servers key) — supports VS Code extras like input variables and per-server sandboxing.
User profile: open with MCP: Open User Configuration (mcp.json in your profile, servers key).
3. Declare a server by hand
Example mixing a remote HTTP server and a local stdio server:
{
"servers": {
"github": { "type": "http", "url": "https://api.githubcopilot.com/mcp/" },
"playwright": { "command": "npx", "args": ["-y", "@microsoft/mcp-server-playwright"] }
}
}4. Start it in Chat
Open Copilot Chat in agent mode (the tools picker shows your MCP servers and their tools). Confirm the trust prompt on first start. The Extensions view filter @mcp lists gallery servers you can install with one click.
Remote servers and secrets
Remote servers use type http (or sse) with a url. For API keys prefer input variables or env files over plaintext:
{
"servers": {
"notion": {
"type": "http",
"url": "https://mcp.notion.com/mcp",
"headers": { "NOTION_TOKEN": "${input:notion_token}" }
}
},
"inputs": [
{ "id": "notion_token", "type": "promptString", "password": true }
]
}Skip the JSON
The MCPNav config generator builds a ready-to-paste config for VS Code from any servers you pick — including optional version pinning. Or start from our curated shortlists: Best MCP servers (all clients).