Skip to main content

How to Connect MCP Servers to VS Code and GitHub Copilot

Short answer

VS Code reads MCP servers from a top-level servers object in .vscode/mcp.json in your project, or in the mcp.json file in your user profile. Use "type": "stdio" with a command for a server that runs on your computer, and "type": "http" with a url for a remote one. Save the file, run MCP: List Servers from the Command Palette, then open Copilot Chat in Agent mode and ask for something one of those tools does.

Tested withVS Code MCP configuration reference (checked 2026-10-20)GitHub Copilot MCP docs for VS Code (checked 2026-10-20)Checked 20 Oct 2026

What you'll have at the end​

A .vscode/mcp.json file in your project with one local server and one remote server. Copilot Chat can call a tool from either of them. This is the finished file:

workspace-mcp.json
{
"inputs": [
{
"type": "promptString",
"id": "github-pat",
"description": "GitHub personal access token",
"password": true
}
],
"servers": {
"github": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github-pat}"
}
},
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp"
}
}
}

Before you start

  • VS Code 1.99 or later, with access to GitHub Copilot and AI features turned on. GitHub's Copilot MCP page lists 1.99 as the minimum version.
  • A project folder open in VS Code. The project-level config lives inside the project.
  • Organization policy. If your organization is on Copilot Business or Copilot Enterprise, an admin has to turn on the "MCP servers in Copilot" policy. Copilot Free, Pro, Pro+ and Max aren't governed by that policy.
  • Docker running, for the GitHub example in step 2.
  • uv, if you want to run the local bookmarks server from the build guide in step 2.

1. Choose where the config goes​

VS Code has three places to put a server, and each one has its own file format. Pick the one that matches who needs the server.

WhereFileWho gets the serverTop-level key
This project.vscode/mcp.json in the project rootAnyone who opens the project, if you commit the fileservers
All your projectsYour user profile mcp.json. Run MCP: Open User Configuration to open itOnly you, in every project on this machineservers
Portable, for compatible Copilot tools.mcp.json at the workspace rootAnyone who opens the project, with compatible toolsmcpServers

The first two use the VS Code format, which supports input variables and envFile. The portable .mcp.json file doesn't. It only appears in the guided flow when the experimental chat.mcp.workspaceRootConfig.enabled setting is on.

Don't copy entries between formats without changing the key. If a server doesn't appear, check that the top-level key matches the file.

2. Add a local (stdio) server​

A local server runs on your computer. VS Code starts it as a child process and talks to it over standard input and output. The command must be on your system PATH or be a full path, and the server's runtime has to be installed on the same machine.

This example adds the bookmarks server from the build guide. Put that project in a folder called bookmarks inside your project, then save this as .vscode/mcp.json. The ${workspaceFolder} variable resolves to your project folder.

local-stdio-mcp.json
{
"servers": {
"bookmarks": {
"type": "stdio",
"command": "uv",
"args": [
"--directory",
"${workspaceFolder}/bookmarks",
"run",
"bookmarks.py"
]
}
}
}

If you'd rather use the menus, run MCP: Add Server from the Command Palette, choose Command (stdio), enter the command and its arguments, and give the server an ID such as bookmarks. The guided flow asks where to save the server. Pick the destination that matches your choice in step 1.

The guided flow also helps you find existing servers. Open the Extensions view, search for @mcp, select a server and choose Install. Only install servers from publishers you trust, since a local server can run code on your machine.

3. Add a remote (HTTP) server​

A remote server runs somewhere else and VS Code connects to its URL. Use "type": "http" and a url. VS Code tries the Streamable HTTP transport first and falls back to Server-Sent Events if the server doesn't support it.

"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp"
}

That entry sits inside the servers object, next to the others. Follow the server publisher's setup notes for authentication before you rely on it.

If the server uses OAuth, VS Code opens a browser window for authorization the first time it connects. GitHub's remote server is an example. Its URL is https://api.githubcopilot.com/mcp/, and you click Auth in the CodeLens above the server in mcp.json.

4. Keep tokens out of the file​

Don't paste a token into mcp.json. VS Code can ask for it instead. Declare an input in the inputs array with a type, an id, and a description, then reference it with ${input:id}. VS Code prompts for the value the first time the server starts and stores it securely.

The github entry in the finished file does this. Its password flag hides what you type:

"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github-pat}"
}

Inputs only work in the VS Code format. Portable .mcp.json files don't support them, and servers that need input prompts aren't forwarded to Copilot harness sessions. Don't paste tokens into chat, and don't commit a file that contains one.

Trust before you start

Servers in .vscode/mcp.json inherit Workspace Trust. In Restricted Mode they don't start. Read the config before you trust a repository you didn't write, because a stdio server runs its command on your machine.

5. Check that Copilot calls your tools​

  1. Open the Command Palette and run MCP: List Servers. Your servers should appear. Select one and choose Show Output to read its log if it isn't running.
  2. Open Copilot Chat and select Agent from the agent dropdown. The GitHub setup steps for MCP tools use Agent mode.
  3. Open the tools picker in the chat box to see the tools from each server.
  4. Send a prompt that names the server and asks for something harmless. For the bookmarks server, try this:
Use the bookmarks server to search for "mcp" and list what it finds. Don't change any files.
  1. Expand the tool call in the chat and check that it belongs to the server you added and that its output is real. An answer that sounds right doesn't prove a tool ran.

If Copilot asks you to confirm the tool call, read it and click Continue only if it's something you expected.

Common problems​

The server doesn't appear in MCP: List Servers. The top-level key is probably wrong. .vscode/mcp.json and your user mcp.json need servers. .mcp.json needs mcpServers. Check the file is valid JSON too.

The server is listed but won't start, and its output shows the command isn't found. VS Code couldn't find the command on your PATH. Use the full path instead: run which uv on macOS or Linux, or where uv on Windows, and put that path in command. The runtime also has to be installed on the machine that runs the server, which matters for Dev Containers and remote workspaces.

A Docker server exits as soon as it starts. Remove the -d (detach) flag from the docker run arguments. VS Code needs the server to stay in the foreground to talk to it over stdio.

The server doesn't start in a project you just opened. The project is in Restricted Mode. Review .vscode/mcp.json, then trust the workspace. Restricted Mode blocks workspace servers from starting.

Copilot has the tools but doesn't call them. Check that the chat is in Agent mode and name the server in your prompt, as in step 5. If you changed a server's tools and the list looks stale, run MCP: Reset Cached Tools and restart the server.

A server with ${input:...} variables is missing from a portable .mcp.json file. Portable files don't support input variables, and servers that need them aren't forwarded to Copilot harness sessions. Move the server to .vscode/mcp.json or your user mcp.json.

FAQ​

Where is the MCP config file for VS Code?

For one project, it is .vscode/mcp.json in the project root. For every project on your machine, run MCP: Open User Configuration from the Command Palette. Both files use a top-level servers object.

Does GitHub Copilot in VS Code need a paid plan to use MCP servers?

MCP works with Copilot access. If your organization is on Copilot Business or Copilot Enterprise, an admin has to enable the MCP servers in Copilot policy first. That policy doesn't apply to Copilot Free, Pro, Pro+ or Max.

Can I share my MCP servers with my team?

Commit .vscode/mcp.json to the repository and everyone who opens the project gets the server definitions. Each person still installs the server runtime and signs in with their own account, so don't commit tokens.

Why does my MCP server work in Claude Desktop but not in VS Code?

The two apps read different files. VS Code reads a servers object from .vscode/mcp.json or your user mcp.json, while Claude Desktop reads mcpServers from its own config file. Add the server to VS Code's file with a type field, and check that its command is on your PATH.