How to keep your API key out of mcp.json

Leave the key out of the file. Either run npx @clearrun/cli login once, which the MCP server reads, or reference an environment variable. In VS Code, use "${env:CLEARRUN_API_KEY}".

Last updated

Steps

  1. Save the key with the CLI

    npx @clearrun/cli login

    The MCP server reads the same ~/.config/clearrun/config.json.

  2. Drop the env block

    {
      "mcpServers": {
        "clearrun": {
          "command": "npx",
          "args": ["-y", "@clearrun/mcp"]
        }
      }
    }
  3. Or, in VS Code, reference the variable

    "env": { "CLEARRUN_API_KEY": "${env:CLEARRUN_API_KEY}" }

Also

Use the user-level config (such as ~/.cursor/mcp.json) for anything with a key in it, and keep the project file key-free.