New PolicyLayer is now the system of record for AI agent authority. Never answer your agent twice
Home / Integrations / VS Code

VS Code MCP setup: the complete config reference

Where VS Code’s MCP config lives, the servers + inputs format, which transports it supports, and how to fix the common failures — plus how to put a policy gate in front of every tool call.

QUICK ANSWERQuick answer: workspace config in .vscode/mcp.json, user-level config in the profile’s mcp.json. Top-level key is servers — not mcpServers.

Where VS Code keeps its MCP config.

ScopePathNotes
Workspace .vscode/mcp.json At the workspace root. Commit it to share servers with the team.
User profile mcp.json (in your VS Code profile) Open it with MCP: Open User Configuration from the Command Palette; servers here load in every workspace.

MCP servers no longer live in settings.json — VS Code moved them to a dedicated mcp.json. The file gets full IntelliSense when edited in VS Code.

The config format, key by key.

Two top-level keys: servers (the server entries) and optional inputs (prompted variables, so secrets never sit in the file). Reference inputs as ${input:id}.

KeyWhat it does
type stdio, http, or sse.
command Executable for a stdio server.
args Array of arguments passed to the command.
env Environment variables. Supports ${input:id}, ${env:VAR} and ${workspaceFolder}.
cwd Working directory for a stdio server.
url Endpoint for an http or sse server.
headers HTTP headers sent with every request — where auth tokens go.
inputs Top-level array of prompted variables (promptString, optional password: true); VS Code asks once on first start and stores the value securely.
.vscode/mcp.json
{
  "inputs": [
    {
      "type": "promptString",
      "id": "github-token",
      "description": "GitHub PAT",
      "password": true
    }
  ],
  "servers": {
    "github": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github-token}"
      }
    }
  }
}

REMOTE SERVER (HTTP):

.vscode/mcp.json
{
  "servers": {
    "my-remote": {
      "type": "http",
      "url": "https://example.com/mcp",
      "headers": {
        "Authorization": "Bearer ${input:token}"
      }
    }
  }
}

What VS Code speaks.

TransportStatusHow to declare it
stdio Supported "type": "stdio" with command + args.
Streamable HTTP Supported "type": "http" with url. VS Code tries streamable HTTP first for remote URLs.
SSE Supported "type": "sse"; also the automatic fallback when a remote server doesn’t speak streamable HTTP.

Adding a server, three ways.

01 Command Palette

MCP: Add Server walks you through the setup and asks whether to target the workspace or your user profile.

02 Edit mcp.json

Create .vscode/mcp.json (or open the user file via MCP: Open User Configuration) and add entries under servers — with full IntelliSense.

03 MCP server gallery

Search @mcp in the Extensions view, or browse the curated gallery at code.visualstudio.com/mcp; install to the user profile or right-click → Install in Workspace.

Check it's actually connected.

  1. Run MCP: List Servers from the Command Palette — select a server and choose Show Output for its logs.
  2. Confirm the trust dialog the first time a server starts; it won’t run until you do.
  3. Open Copilot Chat in agent mode — the tools picker shows each server’s tools, with an error indicator if a server failed.

When it doesn't work.

Tools missing from a chat request

VS Code caps a chat request at 128 enabled tools. Open the tools picker and deselect tools or whole servers you don’t need.

Server won’t start at all

Check for the trust dialog — a server is blocked until you confirm trust, and the prompt reappears after config changes.

Config edits not picked up

Restart the server from MCP: List Servers, or enable chat.mcp.autoStart (experimental) to auto-restart on config change.

stdio server fails on Windows

Shell-based commands may need wrapping (e.g. cmd /c). Use MCP: List Servers → Show Output to see the spawn error.

MCP options missing entirely

If your Copilot org policy disables MCP, servers are silently unavailable — an admin must enable the MCP policy in GitHub Copilot settings.

Put a policy gate in front of it.

A standard GitHub MCP wired into VS Code Copilot. Every call hits GitHub directly with no policy gate.

.vscode/mcp.json
{
  "servers": {
    "github": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..."
      }
    }
  }
}

VS Code supports streamable HTTP natively. Register GitHub in PolicyLayer, mint a grant, point VS Code at the proxy URL. PolicyLayer evaluates every call against the grant’s policy before it reaches GitHub.

.vscode/mcp.json
{
  "servers": {
    "github": {
      "type": "http",
      "url": "https://proxy.policylayer.com/mcp/<server-uuid>/",
      "headers": {
        "Authorization": "Bearer <grant-token>"
      }
    }
  }
}

The <server-uuid> appears on each server's detail page. The <grant-token> shows once at mint time. See the Quick start for the full setup walk-through — and if you operate under SOC 2, HIPAA, GDPR or similar, the compliance hub maps how gateway-mediated MCP traffic evidences each framework.

What the gateway adds.

Rate limits
Cap tool calls per minute, hour, or day, per grant or shared across the team.
Access controls
Allow, deny, or conditionally gate any tool against the call's arguments.
Spend caps
Increment a counter by the call's amount; deny when the daily total exceeds your budget.
Audit logs
Every call records the grant, tool, argument keys, and the rule that decided.

A policy in practice.

Allow listing and issue creation. Deny merges into main. Deny everything else by default.

policy.json
{
  "version": "1",
  "default": "deny",
  "tools": {
    "list_repositories": {},
    "create_issue": {},
    "merge_pull_request": {
      "deny_if": [
        {
          "conditions": [
            { "path": "args.base", "op": "eq", "value": "main" }
          ]
        }
      ]
    }
  }
}

See Writing policies for the policy format, operators, and quota shapes.

VS Code MCP questions.

Where is the VS Code MCP config file?+

Workspace servers go in .vscode/mcp.json at the workspace root. User-level servers live in a dedicated mcp.json in your VS Code profile — open it with MCP: Open User Configuration. MCP config no longer lives in settings.json.

Why does VS Code use "servers" instead of "mcpServers"?+

VS Code’s mcp.json schema uses servers as the top-level key, plus an optional inputs array for prompted secrets. Configs copied from clients that use mcpServers need the key renamed.

How do I keep API keys out of .vscode/mcp.json?+

Define an input in the inputs array with password: true and reference it as ${input:id} in env or headers. VS Code prompts once on first server start and stores the value securely — so the committed file contains no secrets.

What is the VS Code MCP tool limit?+

A single chat request can use at most 128 enabled tools. With several MCP servers enabled it is easy to exceed this — deselect tools or servers in the tools picker, or route through a gateway that exposes a curated subset.

Why can’t I add MCP servers in my company’s VS Code?+

MCP availability in Copilot is controlled by a GitHub Copilot organisation policy, and enterprises can also restrict it via VS Code device settings. If the options are missing, an admin has it switched off.

Take your agents live. Without losing control.

Route your MCP traffic through PolicyLayer. Every tool call is checked against your policy before it runs: allow, deny, or require approval. Per-identity grants. Full audit log. Live in minutes.

Instant setup, no code required.

46,500+ MCP servers and 515,000+ tools scanned and risk-classified.

// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.