# Statsig MCP with Cursor

## Installation and authentication with OAuth

{% callout type="note" %}
MCP OAuth only supports Personal Console API Keys. Ensure your Statsig org
owner has enabled Personal Console API Keys creation for your role in
[organization settings](https://console.statsig.com/settings?tab=organization){" "}
{% /callout %}

You can add the Statsig MCP with OAuth to Cursor in two ways:

### Option 1: Quick install (recommended)

Use the [install link](cursor://anysphere.cursor-deeplink/mcp/install?name=statsig\&config=eyJ1cmwiOiJodHRwczovL2FwaS5zdGF0c2lnLmNvbS92MS9tY3AifQ%3D%3D) to automatically add the Statsig MCP to Cursor.

### Option 2: Manual configuration

1. Open Cursor settings
2. Navigate to **Settings → Cursor Settings → Tools & Integrations**
3. Find the MCP servers section
4. Add the following configuration to `~/.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "statsig": {
      "url": "https://api.statsig.com/v1/mcp"
    }
  }
}
```

Cursor automatically handles OAuth authentication when you first use the Statsig MCP. Cursor prompts you to:

1. Sign in to your Statsig account
2. Authorize the MCP server to access your Statsig project
3. Restart Cursor to apply the changes
4. Verify the connection by navigating to *Settings → Cursor Settings → Tools & Integrations*, where the Statsig MCP server should appear and be active

Cursor saves the authentication for future sessions.

{% accordion title="Using API key instead of OAuth" %}
OAuth is the recommended setup, but you can also authenticate with your Console API key. Use the [quick install link](cursor://anysphere.cursor-deeplink/mcp/install?name=statsig\&config=eyJjb21tYW5kIjoibnB4IG1jcC1yZW1vdGUgaHR0cHM6Ly9hcGkuc3RhdHNpZy5jb20vdjEvbWNwIC0taGVhZGVyIHN0YXRzaWctYXBpLWtleToke0FVVEhfVE9LRU59IiwiZW52Ijp7IkFVVEhfVE9LRU4iOiJpbnNlcnQteW91ci1hcGkta2V5LWhlcmUifX0%3D), or manually configure:

1. Open Cursor settings
2. Navigate to **Settings → Cursor Settings → Tools & Integrations**
3. Find the MCP servers sections
4. Add the below configuration to `~/.cursor/mcp.json`

```json
{
  "mcpServers": {
    "statsig": {
      "command": "npx mcp-remote https://api.statsig.com/v1/mcp --header statsig-api-key:${AUTH_TOKEN}",
      "env": {
        "AUTH_TOKEN": "console-YOUR-CONSOLE-API-KEY"
      }
    }
  }
}
```

Replace `console-YOUR-CONSOLE-API-KEY` with your actual Statsig Console API key, which you can retrieve from the [API keys page](https://console.statsig.com/api_keys). Ensure your API key has the right permissions: read-only keys can view data, while write keys can make changes to your project.
{% /accordion %}

## Using Statsig MCP with Cursor

After configuration, you can use Statsig MCP commands in Cursor's chat interface:

* **Query Experiments**: "What experiments are currently running?"
* **Manage Gates**: "List all my feature flags"
* **Get Details**: "Show me the configuration for gate 'new-feature'"
* **Create Entities**: "Create a new experiment called 'checkout-test'"

## Troubleshooting

If the MCP server doesn't appear:

* Make sure you've restarted Cursor after adding the configuration
* Check that the `mcp.json` file is in the correct location: `~/.cursor/mcp.json`
* Verify your Statsig account has the necessary permissions

## Next steps

* [MCP capabilities](https://docs.statsig.com/integrations/mcp/overview#current-mcp-capabilities)
* [Use cases](https://docs.statsig.com/integrations/mcp/overview#use-cases) for Statsig MCP
* [Stale gate cleanup example](https://docs.statsig.com/integrations/mcp/overview#example-prompt-for-stale-gate-cleanup)
