How to Set Up MCP in VS Code: Complete Guide
Table of Contents
- Method 1: GitHub Copilot + MCP (Built-In)
- Prerequisites
- Step 1: Create the MCP Config File
- Step 2: Add MCP Servers
- Step 3: Activate MCP Tools
- Step 4: Test Your Setup
- Adding MCP to User Settings (Global)
- Method 2: Continue.dev Extension
- Step 1: Install Continue
- Step 2: Configure MCP Servers
- Step 3: Use MCP Tools
- Recommended Servers for VS Code Users
- Using Docker-Based MCP Servers
- Remote MCP Servers (Streamable HTTP)
- Troubleshooting
- "MCP tools not showing up"
- "Server failed to start"
- "Tool confirmation keeps appearing"
- "Environment variables not working"
- VS Code vs Cursor for MCP
- What's Next
How to Set Up MCP in VS Code: Complete Guide
VS Code now supports MCP (Model Context Protocol) natively through GitHub Copilot's agent mode. This means you can connect VS Code to databases, GitHub, Docker, and hundreds of other tools — all through the same standard that powers Claude Desktop and Cursor.
This guide covers both methods: the built-in Copilot integration and the Continue.dev extension.
Method 1: GitHub Copilot + MCP (Built-In)
This is the recommended approach if you're already using GitHub Copilot.
Prerequisites
- VS Code 1.99 or later
- GitHub Copilot extension installed and activated
- Node.js 18+ installed
Step 1: Create the MCP Config File
VS Code looks for MCP configuration in your workspace settings. Create a .vscode/mcp.json file in your project root:
bash
mkdir -p .vscode
touch .vscode/mcp.json
Alternatively, add MCP config to your user-level settings.json for global servers.
Step 2: Add MCP Servers
Open .vscode/mcp.json and add your servers:
json
{
"servers": {
"github": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github"
],
"env": {
"GITHUBPERSONALACCESSTOKEN": "ghpyourtokenhere"
}
},
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/path/to/your/projects"
]
}
}
}
Note: VS Code uses servers as the key, while Claude Desktop and Cursor use mcpServers. The structure inside is the same.
Step 3: Activate MCP Tools
- Open the Copilot Chat panel (Ctrl+Shift+I / Cmd+Shift+I)
- Switch to Agent mode using the mode picker at the top of the chat
- Click the Tools button to see available MCP tools
- Enable the tools you want to use
MCP tools only work in Agent mode. They won't appear in the standard chat or inline suggestions.
Step 4: Test Your Setup
In the Copilot chat (Agent mode), try:
> "List the open issues in this GitHub repository"
Copilot will show a confirmation dialog before running any MCP tool. You can review the parameters and approve or deny the action.
Adding MCP to User Settings (Global)
For servers you want available across all projects, add them to your user settings:
- Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
- Search for "Preferences: Open User Settings (JSON)"
- Add the MCP config:
json
{
"mcp": {
"servers": {
"brave-search": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-server-brave-search"],
"env": {
"BRAVEAPIKEY": "your-key"
}
}
}
}
}
Method 2: Continue.dev Extension
Continue is an open-source AI coding assistant that supports MCP. Use this if you don't have GitHub Copilot or prefer open-source tools.
Step 1: Install Continue
- Open VS Code Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "Continue"
- Install the Continue extension
- Complete the initial setup wizard
Step 2: Configure MCP Servers
Continue stores its config at ~/.continue/config.yaml (or config.json). Add MCP servers in the experimental section:
yaml
models:
- name: claude-sonnet
provider: anthropic
model: claude-sonnet-4-20250514
mcpServers:
- name: filesystem
command: npx
args:
- "-y"
- "@modelcontextprotocol/server-filesystem"
- "/path/to/projects"
- name: github
command: npx
args:
- "-y"
- "@modelcontextprotocol/server-github"
env:
GITHUBPERSONALACCESSTOKEN: ghpyour_token
Step 3: Use MCP Tools
Open the Continue chat panel and use the @tools context provider to access MCP tools. Continue will show which tools are available and ask for confirmation before running them.
Recommended Servers for VS Code Users
Here's a practical setup for common VS Code workflows:
json
{
"servers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUBPERSONALACCESSTOKEN": "ghpyour_token"
}
},
"postgres": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-postgres",
"postgresql://user:pass@localhost:5432/mydb"
]
},
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
},
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/path/to/projects"
]
}
}
}
Why these servers:
- GitHub — Manage PRs, issues, and code reviews without leaving the editor
- PostgreSQL — Query your database while writing backend code
- Context7 — Get up-to-date library documentation (prevents outdated API suggestions)
- Filesystem — Read/write files outside your current workspace
Using Docker-Based MCP Servers
Some servers are distributed as Docker containers for better security and isolation:
json
{
"servers": {
"github-docker": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "GITHUBPERSONALACCESSTOKEN=ghpyour_token",
"ghcr.io/github/github-mcp-server"
]
}
}
}
Docker-based servers run in isolation, which is more secure than npx — especially for servers that access sensitive data.
Remote MCP Servers (Streamable HTTP)
For servers running on remote machines or cloud services:
json
{
"servers": {
"remote-server": {
"url": "https://mcp.yourcompany.com/v1/mcp",
"headers": {
"Authorization": "Bearer your-token"
}
}
}
}
Streamable HTTP is the modern transport for remote MCP servers. It replaced the older SSE (Server-Sent Events) protocol. If you see old guides mentioning SSE endpoints, switch to the Streamable HTTP URL instead.
Troubleshooting
"MCP tools not showing up"
- Make sure you're in Agent mode, not regular chat
- Check that the config file is in the right location (
.vscode/mcp.jsonor user settings) - Verify JSON syntax — use the built-in JSON validator in VS Code
- Restart VS Code after config changes
"Server failed to start"
- Test the server manually in terminal:
bash
npx -y @modelcontextprotocol/server-github
- Check that Node.js is installed and version 18+
- Look for error details in VS Code's Output panel (select "GitHub Copilot" or "MCP" from the dropdown)
"Tool confirmation keeps appearing"
This is by design — VS Code requires explicit approval for each MCP tool call for security reasons. You can configure auto-approval for trusted tools in settings, but we recommend keeping confirmations enabled, especially for tools that modify data.
"Environment variables not working"
VS Code supports input variables for secrets. Instead of hardcoding tokens:
json
{
"servers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUBPERSONALACCESS_TOKEN": "${input:github-token}"
}
}
},
"inputs": [
{
"id": "github-token",
"type": "promptString",
"description": "GitHub Personal Access Token",
"password": true
}
]
}
This prompts you for the token when the server starts, keeping it out of your config files.
VS Code vs Cursor for MCP
Both editors support MCP, but there are differences:
| Feature | VS Code + Copilot | Cursor |
|---|---|---|
| MCP Support | Native (v1.99+) | Native (v0.45+) |
| Config File | .vscode/mcp.json | .cursor/mcp.json |
| Agent Mode | Copilot Agent | Composer Agent |
| Tool Approval | Per-tool confirmation | Per-tool confirmation |
| Pricing | Check official website for current pricing | Check official website for current pricing |
| Transport | stdio + Streamable HTTP | stdio + Streamable HTTP |
Both work well. Choose based on your existing editor preference and AI subscription.
See our MCP clients comparison for a deeper breakdown across all clients.
What's Next
- Explore the best MCP servers for developers for more tool ideas
- Read our MCP security guide before connecting production systems
- Check the MCP beginner's guide if you're new to the protocol
We track MCP support across 500+ AI tools in our directory. Browse MCP-compatible tools to find servers for your stack.
Master AI Agent Building
Get our comprehensive guide to building, deploying, and scaling AI agents for your business.
What you'll get:
- 📖Step-by-step setup instructions for 10+ agent platforms
- 📖Pre-built templates for sales, support, and research agents
- 📖Cost optimization strategies to reduce API spend by 50%
Get Instant Access
Join our newsletter and get this guide delivered to your inbox immediately.
We'll send you the download link instantly. Unsubscribe anytime.
📖 Related Reading
Best AI Tools for Lawyers in 2026: Complete Guide to Legal AI Software (Ranked by Practice Area)
What Is A2A Protocol? Complete Guide for 2026
Top MCP Clients Compared: Claude vs Cursor vs VS Code vs Windsurf
MCP vs API: Which Should You Use for AI Agent Integration?
Enjoyed this article?
Get weekly deep dives on AI agent tools, frameworks, and strategies delivered to your inbox.