← Back to Articles
VS CodeMCPGitHub Copilotsetup guideagent mode

VS Code MCP Server Setup Guide 2026: Add MCP Tools to GitHub Copilot Agent Mode

Step-by-step guide to connecting MCP servers in VS Code using GitHub Copilot's agent mode. Covers configuration, debugging, and the best MCP servers to add in 2026.

By WebMCPGuide TeamMarch 26, 202610 min read


VS Code has supported MCP servers since GitHub Copilot added agent mode in early 2025 — but most developers are still running Copilot without any MCP integrations at all. That's leaving a lot of capability on the table.

This guide walks you through exactly how to connect MCP servers to VS Code, how agent mode actually uses them, which servers are worth adding, and how to troubleshoot the things that inevitably go wrong.

What You Need Before Starting


  • VS Code 1.99 or later — MCP support was added in the 1.99 release. Run code --version to check yours.

  • GitHub Copilot subscription — Free tier (60 completions/month) works, but agent mode with MCP requires active Copilot Chat. The free tier includes 50 chat messages/month.

  • Node.js 18+ — Required for most MCP servers, which run as local Node processes.

  • A specific MCP server you want to connect (we'll use examples throughout this guide).
  • To verify your VS Code version supports MCP:

    code --version

    Should show 1.99.x or later


    If you're below 1.99, update via Help → Check for Updates or download from code.visualstudio.com.

    How MCP Works in VS Code

    VS Code's MCP implementation is built into the Copilot Chat extension's agent mode. When you activate agent mode (the @ symbol in Copilot Chat, or the agent toggle), Copilot can call MCP tools to take real actions — reading files, querying databases, searching the web, managing issues — rather than just generating text.

    The flow looks like this:

    1. You open Copilot Chat and activate agent mode
    2. VS Code reads your MCP server configuration from settings.json
    3. On startup, it launches your configured MCP servers as local processes
    4. When you send a message, Copilot decides which tools (if any) to call
    5. Tool calls go to your MCP server, results come back to Copilot, Copilot incorporates them into its response

    MCP servers run as local stdio processes by default — meaning VS Code spawns them as subprocesses and communicates via standard input/output. Some servers support HTTP transport instead, which is useful for remote or shared servers.

    Step 1: Open Your VS Code Settings JSON

    MCP servers are configured in VS Code's settings.json. Open it with:

  • Mac: Cmd + Shift + P → type "Open User Settings (JSON)"

  • Windows/Linux: Ctrl + Shift + P → type "Open User Settings (JSON)"
  • This opens your global user settings file. You can also configure MCP servers in a workspace's .vscode/settings.json to scope them to a specific project.

    Step 2: Add Your First MCP Server

    Inside settings.json, add a github.copilot.chat.mcp.servers key. Here's the structure:

    {
    "github.copilot.chat.mcp.servers": {
    "server-name": {
    "type": "stdio",
    "command": "node",
    "args": ["/path/to/server/build/index.js"],
    "env": {
    "API_KEY": "your-key-here"
    }
    }
    }
    }

    Example: Adding the Filesystem MCP Server

    The filesystem server from Anthropic's official MCP repo is the simplest one to test with — it lets Copilot read and write files outside your current workspace.

    First, install it:

    npm install -g @modelcontextprotocol/server-filesystem

    Then add it to settings.json:

    {
    "github.copilot.chat.mcp.servers": {
    "filesystem": {
    "type": "stdio",
    "command": "npx",
    "args": [
    "-y",
    "@modelcontextprotocol/server-filesystem",
    "/Users/yourname/Documents"
    ]
    }
    }
    }

    Replace /Users/yourname/Documents with the directory you want to expose. You can pass multiple directory paths as additional args.

    Example: Adding GitHub MCP Server

    For GitHub integration — reading issues, PRs, files from any repo:

    npm install -g @modelcontextprotocol/server-github

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

    Generate a GitHub token at github.com/settings/tokens with repo and read:org scopes.

    Example: Adding a Postgres MCP Server

    Query your database directly from Copilot:

    {
    "github.copilot.chat.mcp.servers": {
    "postgres": {
    "type": "stdio",
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-postgres"],
    "env": {
    "POSTGRES_CONNECTION_STRING": "postgresql://user:password@localhost:5432/mydb"
    }
    }
    }
    }

    Step 3: Activate Agent Mode in Copilot Chat

    Once your servers are configured, open Copilot Chat (Ctrl/Cmd + Alt + I) and switch to agent mode. Look for the agent toggle or use @ to address the agent directly.

    VS Code will launch your configured MCP servers on first use. You should see a brief loading indicator.

    To verify your servers are connected, ask Copilot:

    > "What MCP tools do you have available?"

    Copilot will list all connected tools from all your MCP servers. If a server failed to start, it won't appear here.

    Step 4: Using MCP Tools in Practice

    Once connected, you interact naturally — Copilot decides when to use tools based on your request. Examples:

    With filesystem server:
    > "Read the README in ~/projects/myapp and summarize the setup steps"

    With GitHub server:
    > "List all open issues in my repo labeled 'bug' and group them by priority"

    With Postgres server:
    > "Show me the 10 most recent orders from the orders table and flag any with a value over $1,000"

    You can also explicitly ask Copilot to use a specific tool if it's not picking it up automatically:
    > "Use the filesystem tool to read /etc/hosts and tell me what hosts are defined"

    Multiple Servers: The Full Configuration

    You can run as many MCP servers simultaneously as you want. Here's a realistic production configuration:

    {
    "github.copilot.chat.mcp.servers": {
    "filesystem": {
    "type": "stdio",
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/yourname"],
    "description": "Local filesystem access"
    },
    "github": {
    "type": "stdio",
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-github"],
    "env": {
    "GITHUB_PERSONAL_ACCESS_TOKEN": "${env:GITHUB_TOKEN}"
    }
    },
    "postgres": {
    "type": "stdio",
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-postgres"],
    "env": {
    "POSTGRES_CONNECTION_STRING": "${env:DATABASE_URL}"
    }
    },
    "brave-search": {
    "type": "stdio",
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-brave-search"],
    "env": {
    "BRAVE_API_KEY": "${env:BRAVE_API_KEY}"
    }
    }
    }
    }

    Note the ${env:VARIABLE_NAME} syntax — VS Code expands environment variables from your shell session, which is better practice than hardcoding secrets directly in settings.json.

    Using .vscode/settings.json for Project-Scoped MCP

    For project-specific servers (like a database server that's only relevant to one project), add the configuration to .vscode/settings.json in your project root instead of your global user settings.

    // .vscode/settings.json
    {
    "github.copilot.chat.mcp.servers": {
    "project-db": {
    "type": "stdio",
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-postgres"],
    "env": {
    "POSTGRES_CONNECTION_STRING": "postgresql://localhost:5432/myproject_dev"
    }
    }
    }
    }

    This keeps production credentials out of your global config and makes the server automatically available when teammates open the same project (though each developer needs to supply their own credentials).

    The 5 Best MCP Servers to Add to VS Code in 2026

    Based on real workflow impact:

    1. GitHub MCP Server


    Package: @modelcontextprotocol/server-github
    What it does: Read issues, PRs, files, commit history from any repo. Create issues, comment on PRs.
    Best for: Code review assistance, issue triage, understanding unfamiliar repos.

    2. Filesystem Server


    Package: @modelcontextprotocol/server-filesystem
    What it does: Read/write files anywhere on your machine.
    Best for: Working across multiple projects, reading config files, generating files outside your workspace.

    3. Postgres / SQLite Server


    Package: @modelcontextprotocol/server-postgres or @modelcontextprotocol/server-sqlite
    What it does: Run queries, inspect schema, analyze data directly.
    Best for: Backend development, data analysis, generating migrations based on actual schema.

    4. Brave Search


    Package: @modelcontextprotocol/server-brave-search
    What it does: Real-time web search from inside Copilot Chat.
    Best for: Research, checking current docs, finding recent Stack Overflow answers.
    Note: Requires a Brave Search API key (free tier available).

    5. Memory Server


    Package: @modelcontextprotocol/server-memory
    What it does: Persistent key-value memory that survives across Copilot sessions.
    Best for: Storing project context, decisions, and preferences that Copilot should remember.

    Troubleshooting: Common VS Code MCP Problems

    Server Not Appearing in Tool List

    Check 1: Confirm VS Code version is 1.99+.
    Check 2: Open the Output panel (View → Output) and select "GitHub Copilot" from the dropdown. Look for MCP-related errors.
    Check 3: Verify the command and args in your config actually work by running them manually in a terminal.

    Test your config manually


    npx -y @modelcontextprotocol/server-filesystem /tmp

    Should start and wait for input — Ctrl+C to exit


    "Command not found" Error

    The command specified in your config can't be found. Solutions:

  • Use the full path: "/usr/local/bin/node" instead of "node"

  • Use "npx" with the -y flag to auto-install

  • Run which node in your terminal to find the correct path
  • Server Starts But Tools Don't Work

    Check that required environment variables are set. API keys and connection strings are the most common missing pieces. Verify with:

    echo $GITHUB_TOKEN  # Should print your token

    If the variable isn't set in VS Code's terminal, it won't be available to MCP servers either. Set it in your shell profile (~/.zshrc, ~/.bashrc) or use VS Code's terminal.integrated.env setting.

    Agent Mode Not Available

    Ensure you have:
    1. GitHub Copilot Chat extension installed and enabled
    2. Active Copilot subscription (free tier includes limited chat)
    3. Agent mode enabled in Copilot Chat settings

    ---

    VS Code vs Cursor: MCP Support Comparison

    If you've read guides for Cursor's MCP setup, you'll notice the configuration format is slightly different. Here's a quick comparison:

    | Feature | VS Code | Cursor |
    |---|---|---|
    | Config location | settings.json | .cursor/mcp.json or global ~/.cursor/mcp.json |
    | Config key | github.copilot.chat.mcp.servers | Top-level mcpServers object |
    | AI engine | GitHub Copilot | Cursor (Claude/GPT-4) |
    | Agent mode | Copilot Chat agent mode | Cursor Composer |
    | HTTP transport | Supported | Supported |
    | Env var syntax | ${env:VAR} | ${env:VAR} |

    The underlying MCP protocol is identical — server packages work in both. Only the configuration format differs.

    ---

    FAQ

    Can I use MCP servers with the free GitHub Copilot tier in VS Code?
    Yes, but the free tier caps you at 50 chat messages and 2,000 completions per month. Agent mode with MCP counts against your chat quota. For active use, a paid Copilot subscription is practical.

    Do MCP servers work in VS Code Remote (SSH, containers, WSL)?
    Yes, but the server runs in whatever environment VS Code is connected to — not your local machine. For remote SSH sessions, Node.js and your MCP packages need to be installed on the remote host.

    Can I use the same MCP server in both VS Code and Cursor simultaneously?
    Not the same running process — each IDE spawns its own instance. But you can have both configured to use the same server package; they'll run as separate processes.

    Is my data sent to GitHub/Microsoft when I use MCP tools?
    Tool inputs and outputs are processed by GitHub Copilot's AI backend (Microsoft Azure OpenAI). The MCP server itself runs locally — but the results of tool calls do pass through Copilot's cloud infrastructure. Review GitHub Copilot's data privacy policy for your plan.

    What's the difference between MCP tools and VS Code extensions?
    VS Code extensions integrate deeply into the editor UI. MCP tools are available specifically inside Copilot Chat's agent mode for AI-driven tool use. They complement each other — a GitHub extension gives you UI features; the GitHub MCP server gives Copilot the ability to act on GitHub on your behalf during a chat session.

    How do I remove an MCP server from VS Code?
    Simply delete its entry from the github.copilot.chat.mcp.servers object in settings.json. VS Code will stop launching it on next restart.