MCP secrets · VS Code

API keys out of VS Code’s mcp.json

VS Code has the best built-in answer of the lot: it asks for the key and stores it securely. Here’s how to use it, and when you need no key at all.

The short answer

VS Code reads MCP servers from .vscode/mcp.json in a workspace or from your user profile. Its inputs array lets a server definition use ${input:id}: with type promptString and password: true, VS Code asks for the key the first time the server starts, hides what you type and stores it securely, so the file never holds it. envFile can also load variables from a file. For business platforms, an agent that can run commands on your Mac can use MoltenRock Connect, which holds the keys itself.

The problem

Where it goes wrong

  • .vscode/mcp.json travels
    A key written into a workspace config goes wherever the repository goes.
  • envFile is still a file
    A .env file keeps the key out of mcp.json, not off the disk.
  • One key per server
    Every server is another secret to rotate and another package to trust.

The solution

MoltenRock Connect: Prompted keys, or no key at all

  • Inputs with password: true
    VS Code asks once, hides the value and stores it securely; mcp.json only names the input.
  • Business tools through Connect
    An agent that can run commands on your Mac talks to MoltenRock Connect’s local socket: 30 platforms, no key.
  • Answers, not keys
    Connect returns data, with customer names and addresses as tokens.
  • Changes wait for you
    On Stripe, Cloudflare and GitHub, the agent can only propose; you approve with Touch ID.

Side by side

Where a VS Code MCP key can live

OptionWhat’s in mcp.jsonGood for
The key in env or headersThe key itself, in plain textA quick test, then remove it
An input with password: trueAn input id; VS Code stores the value securelyAny MCP server in VS Code
envFileA path to a .env file holding the keyKeys you already keep in .env
MoltenRock ConnectNothing: the agent uses Connect’s local socketIts 30 business platforms

How it works

Clean up VS Code’s mcp.json

  1. 01
    Find the keys
    Check .vscode/mcp.json in each workspace and the mcp.json in your user profile for env values and headers.
  2. 02
    Turn keys into inputs
    Add an inputs entry with "type": "promptString" and "password": true, and use "${input:your-id}" where the key was.
  3. 03
    Point the agent at Connect
    In MoltenRock Connect → Settings → Agent Setup → Other agents, copy the note for your agent.
  4. 04
    Rotate what was in the file
    Any key that sat in a config file may have been copied, synced or shared. Make a new one and revoke the old.

Straight answer

What this fixes, and what it doesn’t

Stays on your Mac

  • Platform keys, in Connect or MoltenRock’s vault
  • Other servers’ keys, in VS Code’s secure input storage
  • An mcp.json with nothing secret in it

Leaves your Mac

  • Connect’s calls from your Mac to each platform
  • Answers, to your agent and its model
  • MoltenRock Connect covers its 30 business platforms (Stripe, Shopify, WooCommerce, GitHub, Cloudflare and more). An MCP server for anything else still needs its own key: keep that one in the Keychain.

Questions

What people ask first

How do I keep an API key out of VS Code’s mcp.json?

Define an input with type promptString and password: true, and reference it as ${input:id}. VS Code asks the first time the server starts and stores the value securely.

Where is mcp.json in VS Code?

.vscode/mcp.json in a workspace, or in your user profile.

Can VS Code’s agent use MoltenRock Connect?

Connect’s documented routes are MCP for Claude Code, Claude Desktop and Cursor, and its local socket for any agent that can run commands on your Mac. Use the socket note from Agent Setup → Other agents.

What does it cost?

Connect is free for two platforms; one $9.99 unlock opens all 30, and MoltenRock Pro includes it.

Prompted keys, or none at all.

MoltenRock Connect is free for Mac.