How to Add MCP Servers to VS Code for GitHub Copilot
If you set up MCP servers in VS Code a year ago, you probably wrote a .vscode/mcp.json with a servers key and an inputs array for tokens. That still works for now, but it's no longer the recommended path. VS Code's MCP configuration reference says the Local harness is deprecated and will be removed in February 2027, and that new Copilot configurations should use the native destinations instead of .vscode/mcp.json or the profile mcp.json. This walkthrough covers the current setup for GitHub Copilot, with two real servers, GitHub's official MCP server and Microsoft's Playwright MCP, then explains what to do with the old files. Everything here is checked against the VS Code docs and each server's README as they read in November 2026.
For how this compares with Claude Code and Cursor, see our post on configuring MCP servers in all three clients.
Where Copilot reads MCP servers now
The reference lists two native destinations:
- User-wide:
~/.copilot/mcp-config.json, or$COPILOT_HOME/mcp-config.jsonif you've setCOPILOT_HOME. In the guided setup this is Global, then Copilot Global. - Workspace, shared with the team:
.mcp.jsonat the workspace root. The guided setup offers it when the experimentalchat.mcp.workspaceRootConfig.enabledsetting is on.
Both files use a top-level mcpServers object. If you've used Claude Code or Cursor, that will look familiar, and it's the opposite of the old VS Code format, which used servers.
You can add servers without touching JSON: run MCP: Add Server from the Command Palette for the guided flow, or open Chat: Open Customizations and go to MCP Servers to add, edit or manage them.
Fields and secrets in the native format
Each server entry accepts type (stdio, http or sse), command, args, env, cwd, url, headers, tools and oauthClientId. The tools field picks which of the server's tools are exposed; ["*"] means all of them.
Secrets are where the native format differs most from the old one. Input prompts aren't supported, and neither is envFile. Instead you reference environment variables with ${NAME}, or ${NAME:-default} for a non-secret default. Stdio servers can use these in command, args and env; HTTP servers can use them in header values. The reference is blunt about the rest: don't commit tokens or populated auth headers, and don't treat a personal config file as a secret store.
Worked example 1: Playwright over stdio
The reference itself uses the Playwright MCP server as its example. In a workspace-root .mcp.json:
{
"mcpServers": {
"playwright": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@playwright/mcp@latest"],
"tools": ["*"]
}
}
}
The Playwright README lists flags you can append to args. --headless runs the browser without a window (it's headed by default), --browser picks chrome, firefox, webkit or msedge, and --isolated keeps the profile in memory.
A word on the README's one-liner, code --add-mcp '{"name":"playwright",...}'. The VS Code reference notes that code --add-mcp writes to the editor-managed format, not the native Copilot file. So it lands you in the deprecated setup. Write the entry yourself, or use our MCP config generator to produce the JSON.
Worked example 2: GitHub's remote server
The GitHub MCP server runs a hosted endpoint at https://api.githubcopilot.com/mcp/. Its README's VS Code snippets are still written in the older servers and inputs format, so here's the same connection in the native shape, using only fields the reference lists. Because a GitHub token is personal, put this in ~/.copilot/mcp-config.json rather than the shared workspace file:
{
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
"headers": {
"Authorization": "Bearer ${GITHUB_PAT}"
},
"tools": ["*"]
}
}
}
Export GITHUB_PAT in the environment VS Code starts from. The README also describes an OAuth configuration with no header at all; if the server needs sign-in, the manage-servers guide says an Authenticate action appears for it. Pick one method, not both.
If you'd rather run GitHub's server locally, the README's Docker route uses the image ghcr.io/github/github-mcp-server with GITHUB_PERSONAL_ACCESS_TOKEN passed through. In native form that's a stdio entry with "command": "docker", the run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server arguments, and "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PAT}" }. The defaults load the context, repos, issues, pull_requests and users toolsets; GITHUB_TOOLSETS changes that.
Before you reload, paste either file into our MCP config validator to catch structural mistakes.
Trust, approval and checking it works
VS Code treats four things separately: trusting a server to start, authenticating it, which tools are available, and approving each tool call. The manage-servers guide says resolving one doesn't resolve the others, and the reference adds that the tools field doesn't bypass approvals. Expect to approve tool calls even for a server you've configured yourself. That's a good thing; our post on MCP tool poisoning and prompt-injection defenses explains why a page Playwright reads could try to steer the next call.
The reference also warns that adding a config doesn't prove a session can use the server. Run a real tool call (ask Copilot to list your open pull requests, or open a page in Playwright) and read the output.
To turn a server off, use enablement rather than stopping it. Stopping ends the current run; disabling makes it unavailable in the scope you choose.
The old .vscode/mcp.json format
You'll still see the deprecated format in tutorials and READMEs: .vscode/mcp.json or a profile mcp.json, a root key of servers, and an inputs array whose values you reference as ${input:id}. It belongs to the Local harness, which the reference says is removed in February 2027. Don't start new projects with it.
To move existing configs, open Chat: Open Customizations, select Migrations, review what it found, and run Migrate. The move-to-Copilot guide warns that input prompts and stored editor secrets don't transfer automatically, and that original and migrated files don't stay in sync. Replace each ${input:...} with a ${NAME} environment reference, never with the literal token, and delete the old file once the new one works.
Five errors and how to fix them
1. The server loads in the wrong harness. You used code --add-mcp or edited .vscode/mcp.json, so the server went into the deprecated editor-managed setup. Recreate it in .mcp.json or ~/.copilot/mcp-config.json.
2. ${input:...} or envFile copied into the native file. Neither is supported there. Switch to ${NAME} and set the variable in your environment.
3. Workspace .mcp.json ignored. The guided flow only offers it when chat.mcp.workspaceRootConfig.enabled is on, and the reference marks that setting experimental. Check it, or put the server in the user file.
4. The server won't start. Open its output: MCP: List Servers, pick the server, then Show Output. The guide's checklist is the command, arguments, runtime installation and PATH. For Docker stdio servers, don't run detached, because the client needs the stdio connection. If the GitHub image won't pull, the README's fix is docker logout ghcr.io and a retry.
5. Running, but Copilot never calls it. Confirm the server is enabled, works with the harness you've selected, and exposes the tools you expect. The docs point to the chat debug view's section on an MCP tool not being invoked for the next step.
Next steps
Browse the MCP server directory, see our GitHub Copilot profile for plans, and compare it with a terminal agent in Claude Code vs GitHub Copilot. For debugging a server outside the editor, MCP Inspector is the tool.
Written by AIDToolStack Editorial
Researched from official documentation, specifications and vendor pages, listed under Sources below. Last checked November 2026.