swiftapplications

AI agents on the Mac

Cursor on macOS: MCP servers and where the keys go

Where Cursor keeps MCP config on a Mac (global and per project), the mcp.json format, and a wrapper-script pattern that keeps API keys out of the file.

Updated 8 October 2026 3 min read

The short answer

Cursor reads MCP servers from ~/.cursor/mcp.json (all projects) and .cursor/mcp.json (one project). Both are plain JSON, so don’t paste keys into their env blocks: point the server’s command at a small script that reads the key from the Keychain and then starts the server.

The two config files

~/.cursor/mcp.json
{
  "mcpServers": {
    "my-server": {
      "command": "/Users/you/bin/my-server.sh",
      "args": []
    }
  }
}

A .cursor/mcp.json in the project adds servers for that project only. Be careful committing it if it contains anything personal.

The wrapper-script pattern

The server still needs the key in its environment, but nothing has to store it on disk:

~/bin/my-server.sh
#!/bin/zsh
# Read the key at launch and hand it only to this server process.
export MY_SERVICE_API_KEY="$(security find-generic-password -s my-service-api-key -w)"
exec /usr/local/bin/my-mcp-server "$@"
bash
chmod 700 ~/bin/my-server.sh

This works for any MCP client that launches servers by command, including Claude Desktop, Claude Code and Codex.

What it doesn’t fix

The server process still holds the key, and anything the agent can make the server do, it can do with your key. For business tools, the stronger fix is a server that lets the agent read but turns every change into a proposal you approve.

The safe way to do this

MoltenRock Connect

One local MCP server for 30 business platforms

Connect holds every key; your agents read Stripe, Shopify and 28 more over MCP and never see one. On Stripe they can only propose, and you approve with Touch ID.

Get MoltenRock Connect

Questions developers ask

Where is Cursor’s MCP config on Mac?

Globally in ~/.cursor/mcp.json and per project in .cursor/mcp.json.

Is it safe to put API keys in mcp.json?

No. It’s plain JSON that other programs and agents can read. Use a wrapper script that reads the Keychain, or a server that holds keys itself.

Can I share .cursor/mcp.json with my team?

Yes, as long as it contains commands and arguments only, no secrets.