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.
Filesystem
2 min setupMost 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
Context7
3 min setupModels hallucinate outdated APIs constantly. Context7 eliminates this by grounding every answer in real, current documentation.
npx -y @upstash/context7-mcp
GitHub
5 min setupGitHub is where most code lives. This MCP lets agents interact with that code directly, without copy-pasting between interfaces.
npx @github/github-mcp-server
Git
2 min setupDevelopers 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
PostgreSQL
3 min setupDatabase 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
Fetch
1 min setupReading 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
Use ${'$'}{`{workspaceFolder}`}, not absolute paths
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:
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
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}"
]
}
}
}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}"
}
}
}
}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.
{
"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
Quick comparison
| MCP | Primary use in VS Code | Setup | Auth |
|---|---|---|---|
| Filesystem | Read/write files outside the open file | 2 min | None |
| Context7 | Up-to-date library documentation | 2 min | None |
| GitHub | PRs, issues, code search across repos | 5 min | GitHub PAT (input) |
| Git | Local git status, diff, stage, commit | 2 min | None |
| PostgreSQL | Read-only schema + queries | 3 min | Connection string (input) |
| Fetch | Pull a URL as clean Markdown | 1 min | None |
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
Fundamentals
What Is MCP? A Plain-English Guide to Model Context Protocol
6 min read
Setup Guide
Best MCPs for Cursor in 2026 (Ranked + Setup)
8 min read
Setup Guide
Best MCPs for Claude Desktop in 2026 (Ranked + Setup)
9 min read
Setup Guide
Best MCPs for Claude Code in 2026 (Ranked + Setup)
8 min read
Setup Guide
Best MCPs for Windsurf in 2026 (Cascade-Ready Setup)
8 min read
Strategy
MCP Registry vs Curated Directory: Which Should You Use?
5 min read
Setup Guide
Best MCPs for ChatGPT: The Apps and Connectors Worth Installing
9 min read
Tutorial
How to Add an MCP Server to ChatGPT (Developer Mode + Apps Directory)
7 min read