The short answer
- Create
.vscode/mcp.jsonin your project, or run MCP: Open User Configuration from the Command Palette for every workspace. - Put servers under
"servers"(not"mcpServers"), each with a"type":"stdio"withcommandandargs, or"http"withurl. - For a key, add an
inputsentry with"password": trueand use${input:<id>}in the header. VS Code asks once and stores it. - Start the server from the Start link above it in
mcp.json, or run MCP: List Servers. - 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.
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.