# How to add an MCP server to VS Code

Level 3: Connect AI to your tools · 7 min · Updated 19 November 2026 · Path: Connect MCP servers to your assistant

By the end you'll add MCP servers to VS Code for your user or one workspace, keep API keys out of the file, and check that Copilot uses them.

Copilot in VS Code is good with the code in front of it. Ask it about your team's documentation, a browser test or a ticket, and it has to guess. [MCP](https://ai-powered.com/academy/glossary/mcp) servers give Copilot's agent new tools, and VS Code offers two ways to add them: a short guided form, or a JSON file you can share.

*Diagram: Adding a server, step by step.* Pick a server you trust, add it to your app (a URL or a command), sign in or restart, then try a small task and approve the first tool call.

## The quick way: the form

As of 19 November 2026, VS Code's docs describe these steps:

**Steps**

1. Make sure AI features are on and a folder is open.
2. Run **Chat: Open Customizations** from the Command Palette and select **MCP Servers**.
3. Select **Add Server** (**+**) in the **User** group.
4. Choose **HTTP (HTTP or Server-Sent Events)** and paste a URL for a remote server, or **Command (stdio)** and enter the command for a local one.

**MCP: Add Server** in the Command Palette walks you through the same thing.

## The shareable way: mcp.json

VS Code reads two files with the same format:

- `.vscode/mcp.json` in a workspace, for that workspace (and your team, if you commit it).
- Your user `mcp.json`, for every workspace. Open it with **MCP: Open User Configuration**.

**Not the same as Claude or Cursor**

The top-level key is `servers`, not `mcpServers`, and every entry needs a `type`: `stdio` for local servers, `http` or `sse` for remote ones. Copying a config from another app without changing this is the most common reason a server doesn't appear.

The exact entries for a remote server (Context7, library documentation) and a local one (Microsoft's Playwright browser server):

[Context7](https://ai-powered.com/mcp/context7) in VS Code (.vscode/mcp.json):

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

[Playwright MCP](https://ai-powered.com/mcp/playwright-mcp-2) in VS Code (.vscode/mcp.json):

```json
{
  "servers": {
    "playwright-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@playwright/mcp"
      ]
    }
  }
}
```

## Keep API keys out of the file

Don't paste keys into `mcp.json`, least of all one you commit. Declare an input instead. VS Code asks for the value the first time the server starts, then stores it securely:

```json
{
  "inputs": [
    {
      "type": "promptString",
      "id": "perplexity-key",
      "description": "Perplexity API Key",
      "password": true
    }
  ],
  "servers": {
    "perplexity": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "server-perplexity-ask"],
      "env": {
        "PERPLEXITY_API_KEY": "${input:perplexity-key}"
      }
    }
  }
}
```

Remote servers can sign in with OAuth instead; the reference documents an `oauth` object with a `clientId`.

## Check that it worked

Copilot picks relevant tools by itself, so you don't have to name the server every time.

**Try it**

Ask for something small that needs the new server, then expand the [tool call](https://ai-powered.com/academy/glossary/tool-call) in the chat to confirm the server was used. Approve only actions you understand.

To switch a server off, open **Chat: Open Customizations** → **MCP Servers** and use the **…** menu to **Disable** or **Uninstall** it. Stopping a server only ends its current run; the next request can start it again.

## Servers worth a look

MCP servers for developer tools from the directory:

- [GitHub](https://ai-powered.com/mcp/github-2): Official MCP server connecting AI assistants to GitHub repos, issues and workflows
- [fastmcp](https://ai-powered.com/mcp/fastmcp): Python framework for building MCP servers, clients and interactive apps
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Local MCP server that builds a code knowledge graph for AI coding agents
- [XERJ](https://ai-powered.com/mcp/xerj): Local search engine for AI agents with cited answers over your code and docs
- [REA](https://ai-powered.com/mcp/rea): CLI and MCP server that lets coding agents reverse engineer apps and binaries

## Stay safe

VS Code's docs warn that local servers can run code on your machine and that tools can use services with your permissions. Before you install or start a server, check who publishes it, its command or URL and the access it asks for, and read trust prompts before you accept them.

## Key takeaways

- Quick: **Chat: Open Customizations** → **MCP Servers** → **Add Server**.
- Shareable: `.vscode/mcp.json` with `servers` and a `type` on each entry.
- Keys go in `inputs`, never in the file.

## What to try next

- Connect a hosted server to [ChatGPT](https://ai-powered.com/academy/connect-mcp-servers/chatgpt), where only URLs work.
- See why one server works in all these apps: [MCP server vs API](https://ai-powered.com/academy/glossary/mcp-server-vs-api).

## Sources

Official documentation, checked on 19 November 2026:

- [Add and use MCP servers (VS Code docs)](https://code.visualstudio.com/docs/copilot/customization/mcp-servers)
- [MCP configuration reference (VS Code docs)](https://code.visualstudio.com/docs/agents/reference/mcp-configuration)

Next lesson: [How to add an MCP server to ChatGPT](https://ai-powered.com/academy/connect-mcp-servers/chatgpt)
