Guide coding-agents/
VS Code MCP config: mcp.json, Copilot agents and policies
VS Code now reads MCP servers for Copilot agent sessions from two native files, keeps .vscode/mcp.json only for a deprecated harness, and lets admins allowlist servers centrally.
Short answer
As of December 6, 2026, VS Code's Copilot agent sessions read MCP servers from a top-level mcpServers object in two files: ~/.copilot/mcp-config.json (or $COPILOT_HOME/mcp-config.json) for personal servers, and .mcp.json at the workspace root for shared ones. The older .vscode/mcp.json and profile mcp.json use a servers object and belong to the deprecated Local harness, due for removal in February 2027. Run **MCP: Add Server** to add one.
Checked against: MCP configuration reference, Add and use MCP servers, Manage and troubleshoot MCP servers, Choose an agent harness and Manage AI settings in enterprise environments, December 6, 2026 (VS Code 1.149).
Run by us: no. Commands are copied from Microsoft’s VS Code docs.
Which mcp.json file does VS Code read?
It depends on the agent harness: Copilot sessions read two native files, and the deprecated Local harness reads the older editor-managed ones.
| File | Top-level key | Read by | Use it for |
|---|---|---|---|
$COPILOT_HOME/mcp-config.json, or ~/.copilot/mcp-config.json when COPILOT_HOME is unset |
mcpServers |
Copilot harness | Personal servers across workspaces, shared with Copilot CLI on the same host |
.mcp.json at the workspace root |
mcpServers |
Copilot harness | Servers the team shares through source control |
.vscode/mcp.json |
servers |
Local harness (deprecated) | Existing setups only |
Profile mcp.json |
servers |
Local harness (deprecated) | Existing setups only |
As of VS Code 1.149 (released December 2, 2026), the reference tells you to use the native files for new Copilot configurations, “not .vscode/mcp.json or profile mcp.json.” The Copilot harness doesn’t read those legacy files directly, though VS Code can forward eligible entries from them.
For remote hosts and Dev Containers, the native user file is read on the host where the harness runs. Your local copy isn’t forwarded.
How do I add a server?
Use the guided flow, which writes the file for you.
- Select Copilot in the Session Target dropdown.
- Run Chat: Open Customizations, select MCP Servers, then select Add Server (+) in the User group. MCP: Add Server starts the same flow.
- Choose HTTP (HTTP or Server-Sent Events) or Command (stdio), and enter the endpoint or launch command.
- Enter a server ID, then select Global > Copilot Global for a personal server.
- Review any trust prompt, then send a low-impact request that should call one of the server’s tools.
To write the file yourself, this is the reference’s stdio example:
{
"mcpServers": {
"playwright": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@playwright/mcp@latest"],
"tools": ["*"]
}
}
}
For an HTTP server, replace the entry:
{
"mcpServers": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
"tools": ["*"]
}
}
}
MCP: Add Server can also import a config from another application, or draft an entry from an NPM Package, Pip Package or Docker Image name. Review the generated command before accepting it.
What fields can a server entry have?
The portable format keeps to a short list of fields.
| Field | Applies to | Purpose |
|---|---|---|
type |
All | stdio, http for Streamable HTTP, or sse for legacy SSE |
command, args |
stdio | Executable and arguments, installed where the harness runs |
env |
stdio | Environment variable values or references |
cwd |
stdio | Working directory. Only the user-file form shows it |
url, headers |
HTTP, SSE | Endpoint and optional request headers |
tools |
All | Tool names to expose; ["*"] exposes all. Doesn’t bypass approvals |
oauthClientId |
HTTP, SSE | Client ID for a pre-registered OAuth client |
Reference secrets as ${NAME}, or ${NAME:-default} for a non-secret default. Stdio servers accept references in command, args and env; HTTP servers accept them in header values. Use the braced form, because VS Code’s MCP client treats a bare $NAME as literal text.
Don’t copy editor-only fields (inputs, envFile, dev, sandboxEnabled) into these files.
Should I use the workspace file or the user file?
Use workspace-root .mcp.json for servers the repo needs, and Copilot Global for your own.
- Workspace
.mcp.jsonand.vscode/mcp.jsoninherit Workspace Trust. In Restricted Mode they don’t start; in a trusted workspace they start without a separate MCP trust prompt. Read the file before trusting a repo, because a stdio server runs code. - Don’t commit tokens or filled-in auth headers. The workspace form rejects
${...}expressions, so add references through Other Properties in the source file. - The guided flow offers workspace-root
.mcp.jsononly when the experimentalchat.mcp.workspaceRootConfig.enabledsetting is on. Existing.mcp.jsonfiles load either way. - Settings Sync syncs the profile
mcp.json, not.mcp.jsonor the Copilot user file.
What happened to agent mode and .vscode/mcp.json?
Agent mode is now the Agent choice inside a harness, and .vscode/mcp.json belongs to the harness being retired.
The chat input has four controls: Session Target (the harness: Copilot, Local, Claude, Codex, or the Cloud target), Agent (Ask, Agent or Plan), the language model, and Permissions. VS Code’s quickstart uses Copilot, Agent, Auto and Manual permissions. The docs say the Local harness “is deprecated and will be removed in February 2027.”
In Copilot sessions, VS Code can forward eligible entries from .vscode/mcp.json, profile config and extension-provided definitions. Check what doesn’t carry over:
| Capability | Native Copilot files | Editor-managed files |
|---|---|---|
| Server object | mcpServers |
servers |
| Env references | ${NAME} or ${NAME:-default} |
${env:NAME} |
| Input prompts, env files | Not supported | ${input:...}, envFile |
| Per-server sandbox, dev mode | Not supported | sandboxEnabled, sandbox, dev |
Entries that need ${input:...} or ${command:...} are rejected before resolution, so a server that prompts for an API key won’t reach Copilot. code --add-mcp and the MCP: Open User Configuration command still target the editor-managed format.
How are MCP tool calls approved?
The session’s permission level decides, not the config file.
Copilot sessions offer Manual permissions (the default), Assisted permissions and Allow all. A server’s tools list limits what’s available but doesn’t skip approvals. Run Chat: Manage Tool Approval to review saved approvals, including those for an MCP server or its tools. How coding agents ask permission lists these levels next to other agents’ modes.
What can an admin enforce?
Admins restrict servers through Copilot enterprise-managed settings and editor behavior through VS Code device policies.
{
"allowedMcpServers": [
{
"serverUrl": "https://mcp.example.com/*"
}
],
"deniedMcpServers": [
{
"serverUrl": "https://mcp.example.com/blocked"
}
]
}
- Each rule uses one matcher:
serverUrl(wildcards allowed),serverCommand(exact command plus arguments) orserverName. The docs warn that a name rule doesn’t verify the command, endpoint or publisher. - Deliver these keys as
copilot/managed-settings.jsonin the enterprise’s.github-privaterepository, through MDM, or as a localmanaged-settings.jsonfile. They don’t belong in a developer’s settings ormcp.json. - An explicit
allowedMcpServers: []blocks every server. - The
ChatMCPdevice policy enforceschat.mcp.access.ChatAgentModecontrolschat.agent.enabled;falsehides the Agent option and the Agents window but doesn’t remove the Copilot harness from Session Target. - Precedence runs GitHub organization and enterprise settings, then enterprise-managed settings, then device policies, then user and workspace settings.
- When enterprise-managed settings apply, the Claude and Codex harnesses are off unless
vscode.allowedHarnessespermits them (VS Code 1.147 or later).
Device policies ship as ADMX templates on Windows, a sample .mobileconfig on macOS, and /etc/vscode/policy.json on Linux. Run Developer: Policy Diagnostics to see each effective value and its source. Servers developers add outside these controls are shadow MCP servers.
What breaks, and how do I fix it?
Open the server’s … menu under MCP Servers and choose Show Output, or run MCP: List Servers, pick the server, and choose Show Output.
| Symptom | What to check |
|---|---|
| Server missing, or edits don’t appear | The selected harness, workspace and config source; legacy entries may not be forwarded |
| Stdio server won’t start | Command, arguments, runtime and PATH where the harness runs |
| Start blocked by trust | Workspace Trust. Don’t bypass Restricted Mode for a repo you haven’t reviewed |
| Docker server exits | Remove the detached flag (-d); the client needs the stdio connection |
| Enterprise restriction blocks a server | The managed allowlist. Local config can’t override it |
| Server runs, but no tool is called | Enabled state, harness support and tool selection, then the chat debug view |
Setting chat.mcp.autostart to never doesn’t stop the Copilot harness from starting its own servers; disable the server instead. Restart Server applies to editor-managed connections, so for Copilot runtime servers, stop the server and start it again.
What to read next
Sources
Changelog
- First published.
Cite this page
Agents for Devs. "VS Code MCP config: mcp.json, Copilot agents and policies." Published Dec 6, 2026. https://agentsfordevs.com/guides/vscode-mcp - Page: https://agentsfordevs.com/guides/vscode-mcp
- Markdown version: https://agentsfordevs.com/guides/vscode-mcp.md
- Reuse: quote or summarize with a link to this page. Reuse terms
Cite one section
- Which mcp.json file does VS Code read?
- How do I add a server?
- What fields can a server entry have?
- Should I use the workspace file or the user file?
- What happened to agent mode and .vscode/mcp.json?
- How are MCP tool calls approved?
- What can an admin enforce?
- What breaks, and how do I fix it?
- What to read next