← Back to Blog
AI Tools12 min read

How to Set Up MCP in VS Code: Complete Guide

By AI Tools Atlas Team
Share:

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

  1. Open the Copilot Chat panel (Ctrl+Shift+I / Cmd+Shift+I)
  2. Switch to Agent mode using the mode picker at the top of the chat
  3. Click the Tools button to see available MCP tools
  4. 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:

  1. Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
  2. Search for "Preferences: Open User Settings (JSON)"
  3. 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

  1. Open VS Code Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  2. Search for "Continue"
  3. Install the Continue extension
  4. 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"

  1. Make sure you're in Agent mode, not regular chat
  2. Check that the config file is in the right location (.vscode/mcp.json or user settings)
  3. Verify JSON syntax — use the built-in JSON validator in VS Code
  4. Restart VS Code after config changes

"Server failed to start"

  1. Test the server manually in terminal:
bash
npx -y @modelcontextprotocol/server-github
  1. Check that Node.js is installed and version 18+
  2. 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

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.

No spam. Unsubscribe anytime.

10,000+
Downloads
⭐ 4.8/5
Rating
🔒 Secure
No spam
#mcp#vs-code#github-copilot#ide-setup#model-context-protocol

📖 Related Reading

🔧

Discover 155+ AI tools

Reviewed and compared for your projects

🦞

New to AI tools?

Learn how to run your first agent with OpenClaw

🔄

Not sure which tool to pick?

Compare options or take our quiz

Enjoyed this article?

Get weekly deep dives on AI agent tools, frameworks, and strategies delivered to your inbox.

No spam. Unsubscribe anytime.