# Statsig MCP with Codex

## 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
[here](https://console.statsig.com/settings?tab=organization){" "}
{% /callout %}

On Codex, use OAuth and the HTTP transport directly. Codex saves authentication for future sessions.

{% tabs %}
{% tab title="Codex Desktop" %}
In Codex Desktop, navigate to *Settings > MCP servers* and add a new custom server. Set up using Streamable HTTP, with URL set to `https://api.statsig.com/v1/mcp`:

![Set up Statsig MCP in the Codex Desktop App](https://docs.statsig.com/images/integrations/mcp/statsig-codex-desktop-app-setup.png)

Upon saving, you should see statsig turned on under custom servers.

![Statsig MCP in the Codex Desktop App MCP Servers List](https://docs.statsig.com/images/integrations/mcp/statsig-codex-desktop-app-complete.png)
{% /tab %}

{% tab title="Codex CLI and IDE extension" %}
If you're working in Codex CLI or IDE extension, run the below command to add the Statsig MCP server into your `~/.codex/config.toml` file and restart Codex.

```bash
codex mcp add statsig --url https://api.statsig.com/v1/mcp
```

This command opens a browser window for you to sign in to your Statsig account and authorize access to your Statsig project.

After signing in, restart Codex and run `/mcp` in CLI to confirm the Statsig MCP appears as an available MCP server. Make sure the status is **enabled**:

![Statsig MCP in the Codex CLI MCP Servers List](https://docs.statsig.com/images/integrations/mcp/statsig-codex-cli-complete.png)
{% /tab %}
{% /tabs %}

{% accordion title="Using API key instead of OAuth" %}
```toml
[mcp_servers.statsig]
url = "https://api.statsig.com/v1/mcp"
command = "npx"
args = ["--yes", "mcp-remote", "https://api.statsig.com/v1/mcp", "--header", "statsig-api-key: console-YOUR-CONSOLE-API-KEY"]
trust_level = "trusted"
enabled = true
```

Replace `console-YOUR-CONSOLE-API-KEY` with your actual Statsig Console API key, which you can retrieve [here](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 Codex

With Statsig MCP configured in any Codex environment, you can:

* **Explore Experiments**: "List all my active experiments"
* **Manage Gates**: "What gates are currently stale?"
* **Configure Dynamic Configs**: "Show me the configuration for the dynamic config 'dynamic-config'"
* **Get Insights**: "Show me details about the experiment called 'new-checkout-flow'"

## Next steps

After installation, you can:

* List experiments, gates, and dynamic configs
* Create and update experiments, gates, and configs
* Access your Statsig data directly from Codex

For available MCP capabilities, go to the [MCP capabilities](https://docs.statsig.com/integrations/mcp/overview#current-mcp-capabilities) section.
