Add a remote MCP server to VS Code
VS Code reads MCP servers for Copilot from mcp.json, under a top-level servers object (not mcpServers). A remote server takes type "http", a url and optional headers.
By Jake Marsh. Checked against VS Code's own docs on 2026-10-31; each section links its source.
The VS Code config
For a server named my-server at https://example.com/mcp that takes an Authorization header. Where it goes: .vscode/mcp.json in the workspace, or your user mcp.json (MCP: Open User Configuration).
{
"servers": {
"my-server": {
"type": "http",
"url": "https://example.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_KEY"
}
}
}
}Swap in your own server below and the VS Code version updates first, with every other client after it.
Where VS Code reads it
.vscode/mcp.json in the workspaceworkspace: that folder, and anyone who opens itmcp.json in your user profile (run MCP: Open User Configuration)user: every workspace.mcp.json at the workspace root, or $COPILOT_HOME/mcp-config.jsonportable format with an mcpServers object, read by VS Code too
Keys, headers and sign-in
Rather than writing a key into the file, declare an input and reference it: an inputs entry of type promptString with password: true, and ${input:<id>} in the header. VS Code asks for the value the first time the server starts and stores it securely.
With an oauth object (a clientId), VS Code runs the OAuth flow itself and opens a browser window on the first connection. A client secret isn't stored in mcp.json; use the Set Client Secret CodeLens.
{
"inputs": [
{ "type": "promptString", "id": "my-server-key", "description": "my-server API key", "password": true }
],
"servers": {
"my-server": {
"type": "http",
"url": "https://example.com/mcp",
"headers": { "Authorization": "Bearer ${input:my-server-key}" }
}
}
}Source: code.visualstudio.com/docs/agents/reference/mcp-configuration
Check that it connected
Run MCP: List Servers from the Command Palette, or open MCP Servers in the Agent Customizations editor. Each server's menu has Start Server, Stop Server, Restart Server and Show Output; Show Output opens that server's output channel.
Source: code.visualstudio.com/docs/agents/run/manage-mcp-servers
VS Code gotchas
The VS Code format uses servers, not mcpServers. An mcpServers block pasted from another client's docs belongs in the portable .mcp.json instead.
Source: code.visualstudio.com/docs/agents/reference/mcp-configuration
Input variables don't work in the portable .mcp.json format, and servers that need them aren't forwarded to Copilot harness sessions. Keep prompted keys in .vscode/mcp.json or the user mcp.json.
Source: code.visualstudio.com/docs/agents/reference/mcp-configuration
Restart the server after changing its configuration. If Restart isn't offered, stop the server and start it again.
Source: code.visualstudio.com/docs/agents/run/manage-mcp-servers
Servers from outside the workspace can ask for trust on first start or after a configuration change; MCP: Reset Trust clears those decisions. An enterprise MCP allowlist can block a server, and local configuration can't override it.
Source: code.visualstudio.com/docs/agents/run/manage-mcp-servers
Still not connecting? VS Code Copilot MCP tools not showing walks through the fixes in order.
Generate the config for your server
Runs in your browser. Nothing you type is sent anywhere. Still, don't paste real keys on shared screens.
VS Code (Copilot agent mode)
.vscode/mcp.json in the workspace, or your user mcp.json (MCP: Open User Configuration)
{
"servers": {
"my-server": {
"type": "http",
"url": "https://example.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_KEY"
}
}
}
}Source: code.visualstudio.com/docs/agents/reference/mcp-configuration
Claude Code
Run in a terminal (--scope user makes it available in every project)
claude mcp add --transport http --scope user my-server "https://example.com/mcp" --header "Authorization: Bearer YOUR_KEY"Source: code.claude.com/docs/en/mcp
Cursor
~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project)
{
"mcpServers": {
"my-server": {
"url": "https://example.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_KEY"
}
}
}
}Source: cursor.com/docs/context/mcp
Codex CLI
~/.codex/config.toml
[mcp_servers.my_server]
url = "https://example.com/mcp"
http_headers = { "Authorization" = "Bearer YOUR_KEY" }Source: developers.openai.com/codex/mcp
Windsurf / Devin Desktop
~/.config/devin/mcp_config.json (older Windsurf: ~/.codeium/windsurf/mcp_config.json)
{
"mcpServers": {
"my-server": {
"serverUrl": "https://example.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_KEY"
}
}
}
}Devin CLI / Devin Local
Run in a terminal (-s user saves it to ~/.config/devin/mcp_config.json for every project)
devin mcp add -s user -H "Authorization: Bearer YOUR_KEY" my-server "https://example.com/mcp"Gemini CLI
~/.gemini/settings.json (or .gemini/settings.json in the project)
{
"mcpServers": {
"my-server": {
"httpUrl": "https://example.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_KEY"
}
}
}
}Antigravity CLI (agy)
~/.gemini/config/mcp_config.json (or .agents/mcp_config.json in the workspace)
{
"mcpServers": {
"my-server": {
"serverUrl": "https://example.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_KEY"
}
}
}
}Source: antigravity.google/docs/mcp
Cline
cline_mcp_settings.json (in the Cline panel, MCP Servers > Configure > Configure MCP Servers; Cline CLI: ~/.cline/data/settings/cline_mcp_settings.json)
{
"mcpServers": {
"my-server": {
"type": "streamableHttp",
"url": "https://example.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_KEY"
}
}
}
}Source: docs.cline.bot/mcp/mcp-overview
OpenCode
opencode.json in the project root, or ~/.config/opencode/opencode.json for every project
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"my-server": {
"type": "remote",
"url": "https://example.com/mcp",
"oauth": false,
"headers": {
"Authorization": "Bearer YOUR_KEY"
}
}
}
}Source: opencode.ai/docs/mcp-servers/
Need a task list for those agents?
Taskhold is a remote MCP server that gives VS Code and your other agents a task list you share, with their progress on a live board. Its setup link writes this config for the agent, so you don't have to. $12 a month or $120 a year, 7-day trial.
Add Taskhold to VS Code in one click
Opens VS Code or VS Code Insiders on this computer, then asks you to sign in to Taskhold. No key to copy. Needs a Taskhold subscription or trial.