Client setup
One .mcp.json for Claude Code and VS Code: share it with the team
Write one workspace-root .mcp.json that Claude Code and VS Code both read, keep each developer's key in their own environment, and move off .vscode/mcp.json.
By Lucian Dyer, FetchMCP team · Published
This article was drafted with AI assistance from the sources listed below and edited and published by the FetchMCP team. Disclosure: the FetchMCP API, which this article mentions, is this site's own product.
- 1Write mcpServersPut .mcp.json at the workspace root with a top-level mcpServers object.
- 2Reference the keyUse Bearer ${FETCHMCP_API_KEY}, never the key itself and never ${env:NAME}.
- 3Leave out editor-only fieldsNo inputs, envFile, dev or sandboxEnabled in the shared file.
- 4Set the variable per personEach developer exports their own key before starting the client.
- 5Check both clientsclaude mcp list in Claude Code, a tool call in VS Code chat.
Your team uses two clients. Half run Claude Code, half run Copilot in VS Code, and the repository carries two MCP files that drift apart. Since VS Code's Copilot harness reads a workspace-root .mcp.json, one file can serve both.
Checked against the Claude Code MCP docs and the VS Code MCP configuration reference and migration guide (both dated 11/18/2026) on 2026-11-22.
The shared file
.mcp.json sits at the repository root. Both clients read a top-level mcpServers object from it:
{
"mcpServers": {
"fetchmcp": {
"type": "http",
"url": "https://fetchmcp.net/mcp",
"headers": {
"Authorization": "Bearer ${FETCHMCP_API_KEY}"
}
}
}
}
"type": "http" is the Streamable HTTP entry. VS Code also accepts "sse" for a legacy endpoint, but its docs say to prefer HTTP when the server supports it.
"Authorization": "Bearer ${...}" is the only place the key appears, and only as a reference. Claude Code expands ${VAR} in a server's command, args, env, url and headers. VS Code's portable format uses the same ${NAME} form.
Commit this file. Nothing in it is a secret.
Each developer's key
export FETCHMCP_API_KEY=YOUR_KEY goes in each person's shell profile, or wherever your team keeps local secrets. The variable has to be set in the environment of the process that starts the client.
- Claude Code expands the reference when it loads
.mcp.json. - VS Code's docs say the value must be available in the environment of the host that runs or connects to the server.
- VS Code's portable format does not read an
envFile, so do not rely on a.envfile for the shared entry.
VS Code's migration guide adds a warning worth repeating: environment variables are not a secret store. They keep the key out of git, nothing more.
What to leave out
inputs, envFile, dev and sandboxEnabled are editor-only fields. The VS Code reference says not to copy them into a portable file.
${input:api-token} is the usual VS Code way to prompt for a key. The portable format does not support it, and servers that depend on it are not forwarded to Copilot harness sessions.
${env:FETCHMCP_API_KEY} is the .vscode/mcp.json syntax. In the shared file, write ${FETCHMCP_API_KEY}.
$NAME without braces is risky. VS Code treats a bare $NAME as literal text, and its docs recommend the braced form for compatibility.
When the variable is missing
claude mcp list is the first check in Claude Code. If a referenced variable is unset and has no default, the config still loads. Claude Code shows a missing-variable warning for that server and uses the ${...} text as-is, so the server gets a placeholder instead of a key.
${NAME:-default} stops the warning, but a key should not have a default. VS Code's docs describe it as a non-secret default. Use it for a URL or a path, not for Authorization.
Claude Code also reads some credential variables as empty in a remote server's url and headers, such as ANTHROPIC_AUTH_TOKEN. A name outside that set expands as written, so give the fetch server its own variable. The empty header post covers the affected names.
Approval in each client
claude mcp reset-project-choices exists because Claude Code asks for approval in interactive sessions before it uses project-scoped servers from .mcp.json. The command resets those choices.
VS Code keeps trust and authentication separate. Its reference says adding a configuration alone does not confirm that a session can use the server, and tool approvals still apply.
When the same server name exists in several Claude Code scopes, local wins over project and project over user. The whole entry comes from one source; fields are not merged. A teammate with an old local fetchmcp entry keeps using it until they remove it.
Moving off .vscode/mcp.json
VS Code's reference states: "The Local harness is deprecated and will be removed in February 2027." That harness uses the servers format of .vscode/mcp.json.
- Set Session Target to Copilot in the Chat view or the Agents window.
- Run Chat: Open Customizations from the Command Palette and select Migrations.
- Expand MCP Servers for the workspace, select the servers and choose Migrate.
The workspace .vscode/mcp.json maps to .mcp.json at the workspace root. Automatic migration removes an entry from the source file only after it writes and verifies the destination. If .mcp.json already has a different server with the same name, migration stops and the source stays unchanged.
Some things do not migrate automatically: password and command inputs, cwd, envFile, SSE transport, and a VS Code oauth object. Disabled state is not stored in .mcp.json at all. Review the result before you commit it.
Try it with a real server
FetchMCP API runs a Streamable HTTP server with a bearer key, so the file above works as written once each developer sets FETCHMCP_API_KEY. "The MCP server registers 2 tools." Copy the current URL from the MCP docs. Other clients and the bridge for Claude Desktop are in the setup guide.
Frequently asked questions
Can Claude Code and VS Code read the same MCP config file?
Yes. Claude Code reads .mcp.json at the project root for project-scoped servers, and VS Code's Copilot harness reads a workspace-root .mcp.json with a top-level mcpServers object.
Which variable syntax works in both clients?
${NAME} and ${NAME:-default}. VS Code's ${env:NAME} belongs to the older .vscode/mcp.json format, and VS Code treats a bare $NAME as literal text.
What happens in Claude Code if a developer has not set the key variable?
The config still loads. claude mcp list shows a missing-variable warning for that server, and Claude Code uses the unexpanded ${NAME} text as-is instead of a key.
Is .vscode/mcp.json going away?
VS Code's docs say the Local harness, which uses the servers format of .vscode/mcp.json, is deprecated and will be removed in February 2027. Its migration flow maps a workspace .vscode/mcp.json to .mcp.json at the workspace root.
Sources
- Connect Claude Code to tools via MCP (Claude Code docs) (Documentation)
- MCP configuration reference (VS Code docs) (Documentation)
- Migrate Copilot customizations in VS Code (VS Code docs) (Documentation)