diff --git a/integrations/mcp/chatgpt-connector.mdx b/integrations/mcp/chatgpt-connector.mdx index b3fd83bcb..0ae223a0a 100644 --- a/integrations/mcp/chatgpt-connector.mdx +++ b/integrations/mcp/chatgpt-connector.mdx @@ -1,12 +1,42 @@ --- -title: MCP Setup for ChatGPT Connector -sidebarTitle: ChatGPT Connector +title: Statsig MCP with ChatGPT +description: Learn how to talk directly to Statsig from within ChatGPT. --- -## ChatGPT Connector +## Overview -If you're looking to connect Statsig MCP to a ChatGPT-based connector flow, start with the generic MCP configuration and adapt it to the connector’s “custom headers” / “API key” mechanism: +You can set up a connector between the Statsig MCP server and ChatGPT, allowing you to query experiments, manage feature flags, explore analytics -- all directly within ChatGPT's conversational interface. -- See: [MCP Manual Setup](/integrations/mcp/manual-setup) +## Installation +1. Navigate to "Settings > Apps and Connectors > Advanced Settings" and turn on Developer mode. +(Note: Developer mode is currently only available for Plus, Pro, Business, and Enterprise / Edu tiers). +2. Once Developer mode is activated, return to the Apps and Connectors settings pane, and in the "Enabled apps and connectors" section, select "Create an app". +3. Fill out the form to create a new ChatGPT app: +* Add a name (e.g., Statsig MCP) for your tool +* Under "MCP Server URL", fill in `https://api.statsig.com/v1/mcp` +* Under "Authentication", select OAuth. + + +ChatGPT connector authentication settings + + + +## Using Statsig MCP within ChatGPT + +With Statsig MCP configured in ChatGPT, 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 more information about available MCP capabilities, see the [MCP capabilities](/integrations/mcp/overview#current-mcp-capabilities) section. diff --git a/integrations/mcp/claude-code.mdx b/integrations/mcp/claude-code.mdx index a9978bfc1..9eef495b5 100644 --- a/integrations/mcp/claude-code.mdx +++ b/integrations/mcp/claude-code.mdx @@ -1,15 +1,70 @@ --- -title: MCP Setup for Claude Code -sidebarTitle: Claude Code +title: Statsig MCP with Claude Code +description: Learn how to set up the Statsig MCP server in Claude Code. --- -## Setup in Claude Code +## Installation -We recommend using the HTTP transport directly: +On Claude Code, we recommend using OAuth and the HTTP transport directly. Run this command on the command line: + +```bash +claude mcp add --transport http statsig https://api.statsig.com/v1/mcp +``` + +This command will: +- Add the Statsig MCP server to your Claude Code configuration +- Configure it to use HTTP transport with OAuth authentication +- Set up the connection to Statsig's MCP endpoint + + + +While we recommend setting up Statsig MCP via OAuth, you can also authenticate with your Console API key. Run this command on the command line: ```bash claude mcp add --transport http statsig-local https://api.statsig.com/v1/mcp \ --header "statsig-api-key: console-YOUR-CONSOLE-API-KEY" ``` +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! + + + +## Authentication via OAuth +To authenticate via OAuth, run `/mcp` in Claude Code and follow the setup instructions: + +1. Claude Code will open a browser window +2. Sign in to your Statsig account +3. Authorize the MCP server to access your Statsig project +4. The authentication will be saved for future sessions + +## Verification + +After installation, you can verify the connection by: + +1. Opening Claude Code +2. Asking Claude to list your Statsig experiments or gates +3. If configured correctly, Claude will be able to access your Statsig data + +## Using Statsig MCP with Claude Code + +Once configured, you can interact with your Statsig data through Claude Code: + +- **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 you encounter issues: + +- Make sure you have the latest version of Claude Code +- Verify your Statsig account has the necessary API permissions +- Check that the MCP server URL is correct: `https://api.statsig.com/v1/mcp` +- Try re-running the installation command + +## Next Steps +- Learn about [MCP capabilities](/integrations/mcp/overview#current-mcp-capabilities) +- Explore [use cases](/integrations/mcp/overview#use-cases) for Statsig MCP +- Set up Statsig MCP in other tools: [Cursor](/integrations/mcp/cursor), [Codex](/integrations/mcp/codex) diff --git a/integrations/mcp/codex.mdx b/integrations/mcp/codex.mdx index 5e619532d..85dba7e4f 100644 --- a/integrations/mcp/codex.mdx +++ b/integrations/mcp/codex.mdx @@ -1,17 +1,39 @@ --- -title: MCP Setup for Codex -sidebarTitle: Codex +title: Statsig MCP with Codex +description: Learn how to set up the Statsig MCP server using Codex CLI or IDE extension. --- -## Setup in Codex +## Overview -Run: +You can set up the Statsig MCP server using an API key on Codex CLI and Codex IDE Extension today. -```bash -codex mcp add statsig -- npx --yes mcp-remote https://api.statsig.com/v1/mcp \ - --header "statsig-api-key: console-YOUR-CONSOLE-API-KEY" +## Installation +To setup Statsig MCP with Codex, add the below to your `~/.codex/config.toml` file: + +```toml +[mcp_servers.statsig] +command = "npx" +args = ["--yes", "mcp-remote", "https://api.statsig.com/v1/mcp", "--header", "statsig-api-key: console-YOUR-CONSOLE-API-KEY"] +trust_level = "trusted" ``` -This will update your `~/.codex/config.toml`. +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! + + +## 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 more information about available MCP capabilities, see the [MCP capabilities](/integrations/mcp/overview#current-mcp-capabilities) section. diff --git a/integrations/mcp/cursor.mdx b/integrations/mcp/cursor.mdx index 45abe4a4c..ddb50ca73 100644 --- a/integrations/mcp/cursor.mdx +++ b/integrations/mcp/cursor.mdx @@ -1,10 +1,87 @@ --- -title: MCP Setup for Cursor -sidebarTitle: Cursor +title: Statsig MCP with Cursor +description: Learn how to set up the Statsig MCP server in Cursor IDE. --- -## Setup in Cursor +## Installation -[Click Here](cursor://anysphere.cursor-deeplink/mcp/install?name=statsig&config=eyJjb21tYW5kIjoibnB4IG1jcC1yZW1vdGUgaHR0cHM6Ly9hcGkuc3RhdHNpZy5jb20vdjEvbWNwIC0taGVhZGVyIHN0YXRzaWctYXBpLWtleToke0FVVEhfVE9LRU59IiwiZW52Ijp7IkFVVEhfVE9LRU4iOiJpbnNlcnQteW91ci1hcGkta2V5LWhlcmUifX0%3D) to add the Statsig MCP to Cursor, or copy the JSON to: `~/.cursor/mcp.json`. +You can add the Statsig MCP with OAuth to Cursor in two ways: +### Option 1: Quick Install (Recommended) +[Click here](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" + } + } +} +``` + + + +While we recommend setting up Statsig MCP via OAuth, you can also authenticate with your Console API key. [Click here](cursor://anysphere.cursor-deeplink/mcp/install?name=statsig&config=eyJjb21tYW5kIjoibnB4IG1jcC1yZW1vdGUgaHR0cHM6Ly9hcGkuc3RhdHNpZy5jb20vdjEvbWNwIC0taGVhZGVyIHN0YXRzaWctYXBpLWtleToke0FVVEhfVE9LRU59IiwiZW52Ijp7IkFVVEhfVE9LRU4iOiJpbnNlcnQteW91ci1hcGkta2V5LWhlcmUifX0%3D) to quick install, 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 [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! + + + +## Authentication via OAuth and Verification + +Cursor will automatically handle OAuth authentication when you first use the Statsig MCP. You'll be prompted 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 Statsig MCP server should be listed and active + +The authentication will be saved for future sessions + +## Using Statsig MCP with Cursor + +Once configured, 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 + +- Learn about [MCP capabilities](/integrations/mcp/overview#current-mcp-capabilities) +- Explore [use cases](/integrations/mcp/overview#use-cases) for Statsig MCP +- See examples of [stale gate cleanup](/integrations/mcp/overview#example-prompt-for-stale-gate-cleanup) diff --git a/integrations/mcp/manual-setup.mdx b/integrations/mcp/manual-setup.mdx index e070fb96c..2969a413c 100644 --- a/integrations/mcp/manual-setup.mdx +++ b/integrations/mcp/manual-setup.mdx @@ -1,8 +1,12 @@ --- title: MCP Manual Setup -sidebarTitle: Manual Setup +description: Generic MCP server configuration for any tool that supports MCP. --- +## Overview + +If your AI tool supports MCP but isn't listed in our specific guides, you can use this generic configuration to connect to the Statsig MCP server. + ## MCP Server Configuration Add the following MCP server configuration JSON to your tool's config file: @@ -13,13 +17,45 @@ Add the following MCP server configuration JSON to your tool's config file: "statsig": { "command": "npx mcp-remote https://api.statsig.com/v1/mcp --header statsig-api-key:${AUTH_TOKEN}", "env": { - "AUTH_TOKEN": "insert-your-statsig-console-api-key-here" + "AUTH_TOKEN": "console-YOUR-CONSOLE-API-KEY" } } } } ``` -Replace the token with your Statsig Console API key from `https://console.statsig.com/api_keys`. +Replace `console-YOUR-CONSOLE-API-KEY` with your actual Statsig Console API key, which you can retrieve from [https://console.statsig.com/api_keys](https://console.statsig.com/api_keys). + +## API Key Permissions + +Ensure your API key has the right permissions: +- **Read-only keys** can view experiments, gates, and configs +- **Write keys** can make changes to your project + +## Alternative: Direct URL Configuration + +Some tools support direct URL-based MCP configuration. In that case, use: + +``` +https://api.statsig.com/v1/mcp +``` + +With the header: +``` +statsig-api-key: console-YOUR-CONSOLE-API-KEY +``` + +## Verification + +After configuration, verify the connection by asking your AI tool to: +- List your Statsig experiments +- Show your feature gates +- Display a specific dynamic config + +If the tool can access your Statsig data, the setup is complete. +## Next Steps +- Learn about [MCP capabilities](/integrations/mcp/overview#current-mcp-capabilities) +- Explore [use cases](/integrations/mcp/overview#use-cases) for Statsig MCP +- Check tool-specific guides: [Cursor](/integrations/mcp/cursor), [Claude Code](/integrations/mcp/claude-code), [Codex](/integrations/mcp/codex), [ChatGPT](/integrations/mcp/chatgpt-connector) diff --git a/integrations/mcp/overview.mdx b/integrations/mcp/overview.mdx index 43ffe6105..34704b5f6 100644 --- a/integrations/mcp/overview.mdx +++ b/integrations/mcp/overview.mdx @@ -1,12 +1,64 @@ --- -title: MCP Overview +title: Statsig MCP Overview sidebarTitle: Overview +description: Learn how to set up the Statsig MCP server to interact with your Statsig data using AI tools. --- ## Statsig MCP Server -The Statsig MCP (Model Context Protocol) server lets tools like Cursor and Claude have similar functionality to the Statsig Console. With this setup, you can ask questions, explore experiments, and access your Statsig data using AI. +The Statsig MCP (Model Context Protocol) server lets tools like Cursor, Claude Code, ChatGPT, and Codex have similar functionality to the Statsig Console. With this setup, you can ask questions, explore experiments, and access your Statsig data using AI. -To get started quickly, see the main setup page: [Statsig MCP Server](/integrations/mcp). +## Quick Start +Choose your preferred AI tool to get started: + + + Set up Statsig MCP in Cursor IDE with OAuth or API key authentication. + + + Configure Statsig MCP for Claude Code with HTTP transport. + + + Connect Statsig MCP to ChatGPT using the connector feature. + + + Set up Statsig MCP with Codex CLI or IDE extension. + + + +For other tools or custom setups, see the [Manual Setup](/integrations/mcp/manual-setup) guide. + +## Current MCP Capabilities + +The Statsig MCP server provides access to: + +- **Experiments**: List, view details, and manage experiments +- **Feature Gates**: Query and manage feature flags +- **Dynamic Configs**: Access and modify dynamic configurations +- **Metrics**: Explore metrics and analytics data + +## Use Cases + +With Statsig MCP configured, 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'" + +## Example Prompt for Stale Gate Cleanup + +``` +List all feature gates that haven't been modified in the last 90 days +and have less than 1% of traffic. Suggest which ones might be safe to archive. +``` + +## Authentication + +Statsig MCP supports two authentication methods: + +1. **OAuth (Recommended)**: Secure browser-based authentication that doesn't require managing API keys +2. **API Key**: Direct authentication using your Statsig Console API key + +OAuth is available for Cursor and Claude Code. For other tools, use API key authentication via the [Manual Setup](/integrations/mcp/manual-setup) guide.