How to add an MCP server to VS Code
VS Code reads MCP servers from a workspace file and can prompt for secrets instead of storing them — the one client where you should not paste a token into the config.
Where VS Code keeps its MCP config
- Workspace
.vscode/mcp.json
Create .vscode/mcp.json
VS Code looks for .vscode/mcp.json in the workspace. You can also run MCP: Add Server from the Command Palette, which writes the file for you and is worth using once just to see the shape it expects.
Note the top-level key is servers, not mcpServers. Config copied from a Claude or Cursor guide will be silently ignored until you rename it.
{
"servers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "${workspaceFolder}"]
}
}
}Ask for secrets instead of storing them
VS Code supports an inputs block: declare a value as a password input and VS Code prompts for it the first time the server starts, then keeps it out of the file entirely.
This is the one client where committing the MCP config is genuinely safe, because the token never has to live in it. Use it.
{
"inputs": [
{ "id": "gh-token", "type": "promptString", "description": "GitHub PAT", "password": true }
],
"servers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:gh-token}" }
}
}
}Use the tools
MCP tools are available in Copilot agent mode, not in ordinary chat. Switch the Chat view to Agent, then open the tools picker to see everything your servers exposed and turn individual tools on or off.
If the server is running but you cannot find its tools, you are almost certainly still in Ask mode.
If the server does not appear
Check the JSON parses. A trailing comma is the single most common cause of a server that silently never appears — the client cannot read the file, so it falls back to no servers rather than reporting an error.
Use an absolute path to the command. Clients do not always launch with your shell's PATH, so `npx` may resolve interactively and fail on startup. `which npx` gives you the full path to paste in.
Check the server actually runs on its own. Paste the same command into a terminal: if it exits immediately, the problem is the server or its credentials, not the client config.
Frequently asked questions
Why is my VS Code MCP config being ignored?
VS Code uses servers as the top-level key, while Claude Desktop, Cursor and Windsurf use mcpServers. Config pasted from another client's guide will not load until the key is renamed.
How do I use MCP tools in VS Code?
Switch the Chat view from Ask to Agent mode. MCP tools only appear in agent mode; the tools picker there lets you enable individual tools per server.
How do I keep my token out of the repository?
Declare it in the inputs array as a promptString with password set to true, then reference it as ${input:id} in the server's env. VS Code prompts once and stores it outside the file.