VSCode MCP Setup: Connect Servers to GitHub Copilot
To set up MCP in VS Code, add a server to an mcp.json file and use it from GitHub Copilot Chat in Agent mode. The quickest route is the Command Palette command MCP: Add Server. VS Code's file uses a top-level servers key, not the mcpServers key that Claude Desktop and Cursor use.
Step by step
- Get an API key. Register a free MCPifex account, create an instance of the server you want, and generate an API key in the portal. The key starts with mcpx_.
- Open VS Code's MCP config. Run MCP: Add Server from the Command Palette, or MCP: Open User Configuration to edit mcp.json directly. Pick the workspace target if your team should share the entry.
- Add an http-type server entry. Under the top-level servers key, add an entry with type http, url https://mcpifex.com/mcp, and an Authorization header of Bearer
. - Keep the key out of a committed file. In a workspace .vscode/mcp.json, replace the literal key with ${input:mcpifex-key} and declare a matching promptString input with password set to true. VS Code then asks for the value instead of storing it.
- Trust and use the server. Switch Copilot Chat to Agent mode and ask it to use a tool. VS Code shows a one-time trust prompt, then the tools enabled for that instance become available.
Add a remote server in one line
Say you have an MCP endpoint and an API key. Run this in a terminal and VS Code writes the entry into your user-profile mcp.json:
code --add-mcp "{\"name\":\"mcpifex\",\"type\":\"http\",\"url\":\"https://mcpifex.com/mcp\",\"headers\":{\"Authorization\":\"Bearer <YOUR_MCPX_KEY>\"}}"
No dialog appears, so this is handy in a machine setup script. Prefer clicking? Open the Command Palette (Cmd/Ctrl+Shift+P), run MCP: Add Server, and pick workspace or global. For a local server, it can install straight from an npm, PyPI or Docker package name.
Where does VS Code keep MCP config?
| Target | File | Who sees it |
|---|---|---|
| Workspace | .vscode/mcp.json | This project. Meant to be committed and shared. |
| User profile | Open it with MCP: Open User Configuration | Every workspace you open. Lives outside any repo. |
On disk, the user file is %APPDATA%\Code\User\mcp.json on Windows, ~/Library/Application Support/Code/User/mcp.json on macOS and ~/.config/Code/User/mcp.json on Linux. A server defined in a dev container's devcontainer.json, under customizations.vscode.mcp, travels with the container instead.
Write the entry by hand
Every entry under servers needs a type, and the type decides the other fields:
stdio: a local process. Usescommand,args,env,envFileandcwd.http: a remote server over Streamable HTTP, VS Code's recommended remote transport. Usesurl,headersand an optionaloauth.sse: the older remote transport. Still supported for servers that haven't moved to Streamable HTTP.
A local server looks like this:
{
"servers": {
"my-local-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "some-mcp-package"]
}
}
}
A remote server needs no command. Point an http entry at the URL and put the key in a header:
{
"servers": {
"mcpifex": {
"type": "http",
"url": "https://mcpifex.com/mcp",
"headers": {
"Authorization": "Bearer <YOUR_MCPX_KEY>"
}
}
}
}
The file is strict JSON, so no comments, and you need a comma after any existing server. Save it and reload the window if VS Code doesn't pick it up.
Keep your key out of a committed file
A workspace .vscode/mcp.json goes into source control, which is the wrong home for a plaintext token. Declare a promptString input with password: true and reference it as ${input:id}. VS Code asks for the value the first time the server starts and never writes it into the JSON:
{
"inputs": [
{
"id": "mcpifex-key",
"type": "promptString",
"description": "MCPifex API key (mcpx_...)",
"password": true
}
],
"servers": {
"mcpifex": {
"type": "http",
"url": "https://mcpifex.com/mcp",
"headers": {
"Authorization": "Bearer ${input:mcpifex-key}"
}
}
}
}
Use the tools in Copilot Chat
Switch Copilot Chat to Agent mode and ask it to use a tool. As of September 2026, MCP tools show up in Agent mode, not in Ask or Edit. The first time a server starts, VS Code shows a one-time trust prompt.
Agent mode can edit files and run terminal commands, so think before you leave a write tool on. Note also that GitHub Copilot CLI is a separate product with its own MCP config. Don't paste its config into mcp.json.
If it doesn't work
- The server never appears. Check that the top-level key is
servers, notmcpServers. That is the most common copy-paste mistake from other clients. - The file shows JSON errors. Look for a missing comma after the previous server, or a comment.
mcp.jsonis strict JSON. - 401 from the server. The key is missing, mistyped or revoked. Keys from MCPifex start with
mcpx_. - Tools are missing in chat. You are probably in Ask or Edit mode. Switch to Agent mode.
Use hosted servers instead of installing them
With MCPifex, one http entry gives you every server you have set up. You create an instance of a server such as PostgreSQL in the portal, choose which tools are on (write tools start off), and generate a key. The gateway refuses any tool you haven't enabled, whatever VS Code sends.
See instances and tools for how the tool list works, and API keys and authentication for the key itself. Registration is free.
Frequently asked questions
- Why does VS Code use "servers" instead of "mcpServers" in mcp.json?
- That is just VS Code's own schema. Claude Desktop and Cursor use a top-level mcpServers key with the same shape. When you copy JSON between them, rename the key as well as checking the values.
- Do I need type: "http" or type: "sse" for a remote MCP server?
- Use http unless the server only offers the older Server-Sent Events transport. VS Code recommends http, which is Streamable HTTP. sse still works for servers that haven't moved off it.
- Where does VS Code's user-profile mcp.json live?
- On Windows it is %APPDATA%\Code\User\mcp.json. On macOS it is ~/Library/Application Support/Code/User/mcp.json, and on Linux ~/.config/Code/User/mcp.json. The Command Palette command MCP: Open User Configuration opens it without you needing the path.
- Is VS Code's MCP support the same as GitHub Copilot CLI's?
- No. Copilot CLI is a separate product with its own MCP configuration. This guide covers Copilot Chat's Agent mode in VS Code, so don't paste a CLI config into mcp.json.
Sources
Ready to connect?
Host any MCP server behind one endpoint and control exactly what your agents can reach.