# API keys out of Cursor’s mcp.json

> Cursor reads MCP servers from ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project). It resolves ${env:NAME} in command, args, env, url and headers, and STDIO servers can load an envFile, so the file can name a variable instead of holding the key. For business platforms, add MoltenRock Connect as one MCP server: it holds the keys and Cursor gets answers. For other servers, read the key from the macOS Keychain at launch.

Cursor’s own docs say it: use environment variables for secrets, never hardcode them. Here’s how, and how to need no key at all.

Source: https://moltenrock.com/mcp-api-keys-cursor · 2026-10-17

## Keys in the project, one commit away

- **.cursor/mcp.json travels**: A project config with a key in it goes wherever the repository goes.
- **envFile is still a file**: Moving the key to a .env file keeps it out of mcp.json, not off the disk.
- **One key per server**: Every server you add is another secret to rotate and another package to trust.

## Keys that are never in a file

- **One Connect entry**: Add MoltenRock Connect once and Cursor reads 30 platforms through it, with no key in mcp.json.
- **Keychain for the rest**: A wrapper reads other servers’ keys from the macOS Keychain when they start.
- **Answers, not keys**: Connect returns data, with customer names and addresses as tokens.
- **Changes wait for you**: On Stripe, Cloudflare and GitHub, Cursor’s agent can only propose; you approve with Touch ID.

## Clean up Cursor’s mcp.json

1. **Find the keys**: Check ~/.cursor/mcp.json and every .cursor/mcp.json in your projects for env values and headers.
2. **Add Connect once**: Copy the entry from MoltenRock Connect → Settings → Agent Setup → Claude Desktop, Cursor into ~/.cursor/mcp.json.
3. **Keychain for the rest**: Store the key once with security add-generic-password -a "$USER" -s my-mcp-key -w (it asks for the value, so it never lands in your shell history), then point the server’s command at a two-line wrapper script that reads it with security find-generic-password -s my-mcp-key -w, exports it and starts the server. The config then holds a path, not a secret.
4. **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.

## Where a Cursor MCP key can live

| Option | What’s in the config file | Good for |
| --- | --- | --- |
| The key in env or headers | The key itself, in plain text | A quick test, then remove it |
| ${env:NAME} or envFile | A variable name; the key sits in your environment or a .env file | Shared project config |
| Keychain and a wrapper script | A path to the wrapper; no secret | Any MCP server you trust |
| MoltenRock Connect | One entry, no key at all | Its 30 business platforms |

## What this fixes, and what it doesn’t

**Stays on your Mac**

- Platform keys, in Connect or MoltenRock’s vault
- Keys for other servers, in the Keychain
- An mcp.json with nothing secret in it

**Leaves your Mac**

- Connect’s calls from your Mac to each platform
- Tool results, to Cursor 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.

## What people ask first

### Where is Cursor’s mcp.json?

~/.cursor/mcp.json for every project, or .cursor/mcp.json inside one project.

### Does Cursor support environment variables in mcp.json?

Yes: ${env:NAME}, plus ${userHome} and ${workspaceFolder}, in command, args, env, url and headers. STDIO servers can also load an envFile.

### Does Cursor need a key to use MoltenRock Connect?

No. Connect holds the platform keys on your Mac; Cursor talks to it over MCP.

### What does it cost?

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

## An mcp.json you could publish.

MoltenRock Connect is free for Mac.
