Add an MCP server to VS Code, with a key VS Code asks for once

VS Code's mcp.json uses "servers", not "mcpServers". The exact file, a local server, and a keyed server that prompts once and keeps the key out of git.

Updated 5 min readmcpvscodecopilotsetup

Tested 28 October 2026 with the configs' command lines on Linux and Windows 11, Node 22 (VS Code itself not run)On this page: 1 live demo

The short answer

  1. Create .vscode/mcp.json in your project, or run MCP: Open User Configuration from the Command Palette for every workspace.
  2. Put servers under "servers" (not "mcpServers"), each with a "type": "stdio" with command and args, or "http" with url.
  3. For a key, add an inputs entry with "password": true and use ${input:<id>} in the header. VS Code asks once and stores it.
  4. Start the server from the Start link above it in mcp.json, or run MCP: List Servers.
  5. In Copilot Chat, switch to Agent mode and open the tools picker to see the server's tools.

VS Code's MCP config looks like everyone else's with one difference that catches people out: the top-level key is servers. A Claude Desktop or Cursor block pasted in as mcpServers is ignored without an error.

Live demoBuild your .vscode/mcp.json

The live demo loads here when scripts run. The text below says what it shows.

Type your server's name and the command that starts it (or its URL and the name of the variable that holds its key), pick this workspace or every one, your computer, and copy the result. It applies exactly the rules on this page and runs in your browser: nothing is sent or saved. With scripts off, the examples below are the same shapes.

A local server

{
  "servers": {
    "everything": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-everything"]
    }
  }
}

@modelcontextprotocol/server-everything is the MCP project's own test server: free, on npm, no key, with an echo tool. Start with it to prove the setup, then swap in the command your server's README gives.

A server that needs a key, asked for once

VS Code's own answer to secrets is inputs: it prompts the first time the server starts and keeps the value in its secret storage, so the file you commit holds only the question. The example is Clinamen's hosted server, which needs a Clinamen Signature key (sales open at launch); any server that takes a bearer key works the same way.

{
  "inputs": [
    { "type": "promptString", "id": "clinamen-key", "description": "Clinamen licence key", "password": true }
  ],
  "servers": {
    "clinamen": {
      "type": "http",
      "url": "https://mcp.clinamen.dev/mcp",
      "headers": { "Authorization": "Bearer ${input:clinamen-key}" }
    }
  }
}

Prefer an environment variable? ${env:CLINAMEN_LICENCE_KEY} works in the same place. VS Code must have been started from an environment that has it: quit fully and reopen after setx or a profile change.

Two limits from VS Code's documentation: inputs work only in VS Code's own file format (not in a portable .mcp.json at the workspace root, which uses ${NAME} instead), and servers that need an input are not passed on to Copilot's cloud agent sessions.

Check it works

Run MCP: List Servers, pick the server and Show Output to see its log. A server that started lists its tools; one that failed says why. Then in Copilot Chat in Agent mode, ask: "call the echo tool of the everything server with hello". It answers Echo: hello. A keyed server is only proven once one of its tools answers: Clinamen's hosted server, for one, starts with a missing key and then says why it refused it.

If it fails, run the command and args in a terminal first. A working MCP server waits for input, printing nothing or one startup line (Ctrl+C). On Windows, a spawn npx ENOENT in the output means: use "command": "cmd", "args": ["/c", "npx", "-y", "@modelcontextprotocol/server-everything"].

Something here did not work?

Every command on this page was run before it was published, on the systems named in "How we tested this". If a step fails for you, write to [email protected] with what you ran and what you saw, and we will fix the page.