Setup Guide8 min readMay 5, 2026

Best MCPs for VS Code in 2026 (Agent Mode + .vscode/mcp.json)

VS Code now ships MCP support inside its built-in chat — no extension required, just a .vscode/mcp.json at the workspace root. The right stack turns Agent mode from a smart autocomplete into a real coding agent that can read repos, run queries, and pull current docs. Here are the six worth installing first.

Why VS Code + MCPs?

VS Code's built-in chat and agent mode are powerful on their own — they understand the open file, the terminal, and basic refactors. What they cannot do without MCP is reach outside the workspace: query a database, look up current third-party docs, run a real browser, or operate on a repo via the GitHub API.

MCP servers fill those gaps with a workspace-scoped config (.vscode/mcp.json) that travels with the repo. Commit it once and every contributor — on macOS, Linux, or Windows — gets the same setup. VS Code adds two niceties on top of the standard MCP shape: ${workspaceFolder} expansion so paths follow the open project, and a password-type inputs system so tokens stay in the OS secret store, never in cleartext.

Setup time

15–25 min for all 6 MCPs

Impact

Same MCPs across every contributor and OS

Cost

All 6 are free or open source

The 6 MCPs every VS Code user should install

Picked for VS Code's mix of editor-driven and agent-mode workflows. Each one is workspace-friendly — pass ${workspaceFolder} where it matters and the MCP scopes itself to the open project automatically.

#1

Filesystem

2 min setup

Most AI workflows involve reading or modifying files. This MCP is the standard way to give models that access without exposing the full system.

npx -y @modelcontextprotocol/server-filesystem /path/to/allowed/dir

Reading and editing local codeGenerating files from AI outputNavigating project structures
Full details and install guide
#2

Context7

3 min setup

Models hallucinate outdated APIs constantly. Context7 eliminates this by grounding every answer in real, current documentation.

npx -y @upstash/context7-mcp

Library API lookupFramework usage patternsVersion-specific code examples
Full details and install guide
#3

GitHub

5 min setup

GitHub is where most code lives. This MCP lets agents interact with that code directly, without copy-pasting between interfaces.

npx @github/github-mcp-server

Automated issue creationPR review and managementCode search across repos
Full details and install guide
#4

Git

2 min setup

Developers need Git context to understand code history and changes. This MCP gives models that context directly, improving code assistance quality.

uvx mcp-server-git --repository /path/to/repo

Commit message generationDiff summarizationBranch management
Full details and install guide
#5

PostgreSQL

3 min setup

Database access is one of the most requested AI capabilities. This MCP provides it safely, with schema context that improves query quality.

npx -y @modelcontextprotocol/server-postgres postgresql://user:pass@localhost/db

Database schema explorationSQL query generationData analysis
Full details and install guide
#6

Fetch

1 min setup

Reading web pages is a fundamental research task. This MCP makes any URL readable in a model context without browser overhead.

npx -y @modelcontextprotocol/server-fetch

Documentation readingArticle summarizationPublic web page extraction
Full details and install guide

Use ${'$'}{`{workspaceFolder}`}, not absolute paths

Hardcoding /Users/you/projects in .vscode/mcp.json works on your machine and breaks for every teammate. Use ${workspaceFolder} so the Filesystem MCP scopes to the currently open project, regardless of where it is checked out. Same idea for ${userHome} when the path is genuinely user-specific.

How to configure MCPs in VS Code

VS Code reads MCP configuration from .vscode/mcp.json (workspace) or settings.json (user-wide). The four-step setup, focused on the workspace path most teams use:

1

Create .vscode/mcp.json at the repo root

VS Code looks for an mcp.json under .vscode in every workspace. Create the file at your repo root if it does not exist — VS Code picks it up the next time you open the workspace. Commit it to share the same MCPs with every contributor.

.vscode/mcp.json
2

Add servers under the "servers" key

VS Code uses "servers" instead of Claude Desktop's "mcpServers" — that is the only structural difference. Use ${workspaceFolder} to scope filesystem access to the currently open project so the MCP follows the workspace.

{
  "servers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "${workspaceFolder}"
      ]
    }
  }
}
3

Use inputs for tokens (not raw env values)

Declare a password-type input, reference it via ${input:id} in env, and VS Code prompts once on first use and stores the value in its encrypted secret storage. The committed mcp.json never contains the token, even in cleartext.

{
  "inputs": [
    {
      "type": "promptString",
      "id": "github_pat",
      "description": "GitHub personal access token",
      "password": true
    }
  ],
  "servers": {
    "github": {
      "command": "npx",
      "args": ["@github/github-mcp-server"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_pat}"
      }
    }
  }
}
4

Enable + verify from the Command Palette

Open the Command Palette, run "MCP: List Servers", and toggle each server on. VS Code launches the process and surfaces any startup error inline. Then open the Chat view, switch to Agent mode, and the MCP tools appear in the Tools picker.

Cmd/Ctrl+Shift+P → "MCP: List Servers"

Full .vscode/mcp.json with all 6 MCPs

Copy this into your repo's .vscode/mcp.json. It uses the inputs feature for tokens (so secrets stay in VS Code's secret storage) and ${workspaceFolder} expansion so paths follow the open project.

.vscode/mcp.json (committed at repo root)
{
  "inputs": [
    {
      "type": "promptString",
      "id": "github_pat",
      "description": "GitHub personal access token",
      "password": true
    },
    {
      "type": "promptString",
      "id": "database_url",
      "description": "Postgres connection string",
      "password": true
    }
  ],
  "servers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "${workspaceFolder}"
      ]
    },
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"]
    },
    "github": {
      "command": "npx",
      "args": ["@github/github-mcp-server"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_pat}"
      }
    },
    "git": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-git",
        "--repository",
        "${workspaceFolder}"
      ]
    },
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-postgres",
        "${input:database_url}"
      ]
    },
    "fetch": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-fetch"]
    }
  }
}

Inputs prompt once, then live in OS secret storage

The first time VS Code launches an MCP that references an input, it prompts for the value and stores it in the OS keychain (Keychain on macOS, Credential Manager on Windows, Secret Service on Linux). The committed .vscode/mcp.json holds only ${input:id} placeholders — no cleartext secrets, even on machines you do not control.

Quick comparison

MCPPrimary use in VS CodeSetupAuth
FilesystemRead/write files outside the open file2 minNone
Context7Up-to-date library documentation2 minNone
GitHubPRs, issues, code search across repos5 minGitHub PAT (input)
GitLocal git status, diff, stage, commit2 minNone
PostgreSQLRead-only schema + queries3 minConnection string (input)
FetchPull a URL as clean Markdown1 minNone

Common gotchas

"servers" vs "mcpServers"

VS Code uses "servers" as the top-level key. Claude Desktop, Cursor, and Windsurf use "mcpServers". Copy-pasting between configs is otherwise identical, but the rename is the most common silent failure when migrating.

Workspace config wins over user config

If both .vscode/mcp.json and settings.json define a server with the same name, the workspace file wins. That is usually what you want — but be deliberate when you mix them, especially around tokens.

Inputs are only re-prompted on cache invalidation

Once you enter a token via an input, VS Code remembers it. Use the Command Palette → "MCP: Reset Cached Inputs" to force a re-prompt, for example after rotating a GitHub PAT.

${`{`}workspaceFolder{`}`} is empty without a workspace

If you open a single file in VS Code without opening its parent folder as a workspace, ${`{`}workspaceFolder{`}`} expands to an empty string and the Filesystem MCP launches with no allowlisted directory. Always open the folder, not the file.

Frequently asked questions

Do I need an extension to use MCP in VS Code?

No. Modern VS Code includes MCP support in its built-in chat and agent-mode tooling. If MCP commands do not appear in your Command Palette, update to the latest VS Code release — MCP is part of the core agent features, not a separate extension.

Where does VS Code store its MCP config?

Two places. Workspace config lives at .vscode/mcp.json in your repo root and is the preferred location. User-wide config lives in your settings.json under "mcp.servers" — open it via Cmd/Ctrl+Shift+P → "Preferences: Open User Settings (JSON)".

What is the difference between .vscode/mcp.json and settings.json?

Scope. .vscode/mcp.json is committed with the repo so every contributor gets the same MCPs. settings.json is user-wide and applies across every workspace you open. Use the workspace file for project-shared servers (Postgres, internal APIs) and settings.json for personal tools.

Can I use workspace variables like ${workspaceFolder} in mcp.json?

Yes. VS Code expands variables like ${workspaceFolder}, ${userHome}, and ${env:VAR_NAME} inside args. The cleanest way to scope a Filesystem MCP to the open project is to pass ${workspaceFolder} as the directory argument.

Where do I store API tokens safely in VS Code?

Use the inputs feature: declare a password-type input in mcp.json, reference it in env, and VS Code prompts once and stores the value in its secure secret storage. The token is never written to disk in plain text — far safer than putting it directly in the env block.

Can VS Code and Cursor share the same MCP config?

Not directly — Cursor reads .cursor/mcp.json and VS Code reads .vscode/mcp.json. The JSON shape is nearly identical (Cursor uses "mcpServers", VS Code uses "servers"), so copy-paste works with one rename. Commit both files if your team uses both editors.

How do I see what MCPs are connected in VS Code?

Open the Command Palette → "MCP: List Servers". You see every configured server with its status, the JSON entry, and any errors. From the Chat view (Agent mode), the Tools picker shows every MCP tool currently available to the model.

More for VS Code

See the full VS Code client page for the complete config reference, the latest top picks, and the inputs feature in detail.

More guides