> ## Documentation Index
> Fetch the complete documentation index at: https://docs.growthbook.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Official GrowthBook MCP Server

> Connect AI tools like Cursor, VS Code, and Claude to GrowthBook using the Model Context Protocol (MCP). Use GrowthBook Cloud with OAuth, or run the server yourself.

[Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) is a standard for integrating AI tools and agents with platforms like GrowthBook. The official GrowthBook MCP server is a thin bridge: it loads GrowthBook [Agent Skills](/integrations/ai-agents/agent-skills) (workflows and guardrails) and makes authenticated calls to the [GrowthBook REST API](/app/api).

<Info>
  **It's official!**

  Check us out on the [official MCP Registry](https://registry.modelcontextprotocol.io/?q=growthbook)
</Info>

## How it works

The server exposes four tools:

| Tool                     | Purpose                                                                                       |
| ------------------------ | --------------------------------------------------------------------------------------------- |
| `growthbook_list_skills` | List bundled skill entry points (name + description)                                          |
| `growthbook_read_skill`  | Return a listed skill, or a child path it names (e.g. `feature-flags/references/flag-create`) |
| `growthbook_api_read`    | Authenticated `GET` against the GrowthBook REST API                                           |
| `growthbook_api_write`   | Authenticated `POST` / `PUT` / `PATCH` / `DELETE` against the REST API                        |

Typical flow:

1. Call `growthbook_list_skills`, then `growthbook_read_skill` with the matching name.
2. If that skill routes to a child path, call `growthbook_read_skill` again with that path.
3. Follow the workflow. Skills show calls like `gb-call GET /api/v1/projects` — map `GET` to `growthbook_api_read` and mutating methods to `growthbook_api_write` with the same path and optional JSON body.
4. Prefer the paths listed in the skill; do not invent endpoints.

Competence lives in the skills (draft → review → publish, safe rollouts, and other guardrails). The API tools are authenticated passthroughs — they do not validate payloads.

<Tip>
  **Capability-only mode**

  Connect to `/mcp/api` instead of `/mcp` (or set `GB_SKILLS_ENABLED=false` for a local process) to expose only `growthbook_api_read` and `growthbook_api_write`. Use this when your client or team supplies its own workflows.
</Tip>

<Warning>
  **Migrating from MCP 1.x?**

  GrowthBook MCP 2.x removes the old per-endpoint tools (`create_feature_flag`, `get_experiments`, and so on). Use the skill loader plus API read/write tools instead. Point Cloud clients at `https://mcp.growthbook.io/mcp`, or upgrade local installs to `@growthbook/mcp@latest`.
</Warning>

## GrowthBook Cloud

If you use [GrowthBook Cloud](https://app.growthbook.io), connect your MCP client to the hosted server. You sign in with OAuth in the browser — no API key in the MCP config.

| Endpoint                            | Tools                                 |
| ----------------------------------- | ------------------------------------- |
| `https://mcp.growthbook.io/mcp`     | Skills + API read/write (recommended) |
| `https://mcp.growthbook.io/mcp/api` | API read/write only                   |

### Cursor

<a href="https://cursor.com/en-US/install-mcp?name=growthbook&config=eyJ1cmwiOiJodHRwczovL21jcC5ncm93dGhib29rLmlvL21jcCJ9">
  <img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Install MCP Server" className="no-zoom" />
</a>

1. Open **Cursor Settings** → **MCP**
2. Click **Add new global MCP server**
3. Add:

```json theme={null}
{
  "mcpServers": {
    "growthbook": {
      "url": "https://mcp.growthbook.io/mcp"
    }
  }
}
```

4. Save. When Cursor connects, complete the GrowthBook OAuth consent flow in the browser.

You should see a green active status after the server connects.

### VS Code

1. Open **User Settings (JSON)**
2. Add:

```json theme={null}
{
  "servers": {
    "growthbook": {
      "type": "http",
      "url": "https://mcp.growthbook.io/mcp"
    }
  }
}
```

3. Save. Start the server if prompted, then complete OAuth when your client opens the browser.

In Copilot Chat, a tool icon indicates the server is connected.

### Claude Code

```bash theme={null}
claude mcp add --transport http growthbook https://mcp.growthbook.io/mcp
```

Verify with `claude mcp get growthbook` or `/mcp` inside Claude Code. Complete OAuth when prompted.

### Claude Desktop

1. Go to **Settings** → **Connectors** (or **Extensions** → browse connectors, depending on your Claude Desktop version)
2. Add a custom connector / remote MCP server pointed at `https://mcp.growthbook.io/mcp`
3. Complete the GrowthBook OAuth consent flow

We also publish a GrowthBook entry in Anthropic's Connectors Directory when available — search for "GrowthBook" if you prefer the directory install.

### Other MCP clients

Any client that supports remote HTTP MCP with OAuth can use:

```text theme={null}
https://mcp.growthbook.io/mcp
```

Use the URL field (or equivalent) in that client's MCP settings. The server advertises OAuth protected-resource metadata so the client can discover GrowthBook as the authorization server.

## Example prompts

Once connected, ask for the outcome and let the agent load the matching skill:

* "Create a boolean feature flag called `new-checkout-flow` that defaults to false."
* "Which feature flags are stale and safe to clean up?"
* "What are the results of our checkout experiment? Should we ship the winner?"
* "Design and launch an A/B test on the `pricing-v2` flag."
* "Chart daily signups by country for the last 30 days."

Want slash commands and no MCP process? [Install the Agent Skills plugin](/integrations/ai-agents/agent-skills).

## Self-hosted

If you run GrowthBook yourself, you can still use the official MCP server in two ways: a local stdio process in your editor, or the official Docker image as your own HTTP MCP endpoint.

### Option A: Local stdio

Runs `@growthbook/mcp` on your machine and talks to your GrowthBook API with an API key or personal access token (PAT). Requires **Node.js 18+**.

1. Create a key in GrowthBook: **Settings** → **API Keys**, or a PAT under **Account** → **Personal Access Tokens**. A PAT is recommended so actions are attributed to your user and scoped to your permissions.
2. Add an MCP server entry that runs `npx` with env vars:

| Variable            | Status                   | Description                                                                     |
| ------------------- | ------------------------ | ------------------------------------------------------------------------------- |
| `GB_API_KEY`        | Required                 | GrowthBook API key or PAT                                                       |
| `GB_API_URL`        | Required for self-hosted | Your GrowthBook API base URL (for example `https://growthbook-api.example.com`) |
| `GB_SKILLS_ENABLED` | Optional                 | Set to `false` to register only the API tools                                   |
| `GB_HTTP_HEADER_*`  | Optional                 | Extra headers on every API request (see [Custom headers](#custom-headers))      |

<CodeGroup>
  ```json macOS / Linux theme={null}
  {
    "mcpServers": {
      "growthbook": {
        "command": "npx",
        "args": ["-y", "@growthbook/mcp@latest"],
        "env": {
          "GB_API_KEY": "YOUR_API_KEY",
          "GB_API_URL": "https://growthbook-api.example.com"
        }
      }
    }
  }
  ```

  ```json Windows theme={null}
  {
    "mcpServers": {
      "growthbook": {
        "command": "cmd",
        "args": ["/c", "npx", "-y", "@growthbook/mcp@latest"],
        "env": {
          "GB_API_KEY": "YOUR_API_KEY",
          "GB_API_URL": "https://growthbook-api.example.com"
        }
      }
    }
  }
  ```

  ```json WSL theme={null}
  {
    "mcpServers": {
      "growthbook": {
        "command": "wsl",
        "args": ["npx", "-y", "@growthbook/mcp@latest"],
        "env": {
          "GB_API_KEY": "YOUR_API_KEY",
          "GB_API_URL": "https://growthbook-api.example.com"
        }
      }
    }
  }
  ```
</CodeGroup>

VS Code uses the same `command` / `args` / `env` values under a `servers` key instead of `mcpServers`.

For Claude Code:

```bash theme={null}
claude mcp add growthbook --transport stdio \
  --env GB_API_KEY=YOUR_API_KEY \
  --env GB_API_URL=https://growthbook-api.example.com \
  -- npx -y @growthbook/mcp@latest
```

<Tip>
  **GrowthBook Cloud via stdio**

  You can also use stdio against Cloud by omitting `GB_API_URL` (it defaults to `https://api.growthbook.io`) and setting `GB_API_KEY`. Most Cloud users should prefer the [hosted OAuth endpoint](#growthbook-cloud) instead.
</Tip>

<h3 id="option-b-docker">
  Option B: Official Docker image
</h3>

Run the same HTTP MCP server GrowthBook Cloud uses, against your own API. Clients connect with a URL and OAuth — no API key in the MCP client config.

**Prerequisites**

* Your GrowthBook API must expose the OAuth 2.1 Authorization Server. Set `OAUTH_AS_ENABLED=1` on the API process (see [Environment variables](/self-host/env#oauth-authorization-server-mcp)).
* A public HTTPS URL for the MCP server (clients and OAuth metadata use this base URL).

**Image:** [`ghcr.io/growthbook/growthbook-mcp`](https://github.com/growthbook/growthbook-mcp/pkgs/container/growthbook-mcp) — pin a version tag (for example `2.1.0`) rather than relying on `latest` in production.

```bash theme={null}
docker run --rm -p 3333:3333 \
  -e GB_MCP_TRANSPORT=http \
  -e GB_MCP_HOST=0.0.0.0 \
  -e GB_MCP_PORT=3333 \
  -e GB_MCP_URL=https://mcp.example.com \
  -e GB_API_URL=https://growthbook-api.example.com \
  ghcr.io/growthbook/growthbook-mcp:2.1.0
```

| Variable                      | Required | Purpose                                                                                                            |
| ----------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
| `GB_MCP_URL`                  | Yes      | Public base URL of this MCP server (stamped into OAuth resource metadata; the process refuses to start without it) |
| `GB_API_URL`                  | Yes      | Your GrowthBook API URL (also the default OAuth issuer)                                                            |
| `GB_MCP_HOST` / `GB_MCP_PORT` | No       | Bind address/port inside the container (defaults shown above)                                                      |
| `GB_OAUTH_ISSUER`             | No       | Override if the Authorization Server issuer is not `GB_API_URL`                                                    |
| `GB_SKILLS_ENABLED`           | No       | Set `false` to disable skill tools on `/mcp`                                                                       |
| `GB_HTTP_HEADER_*`            | No       | Extra headers on every API request (see [Custom headers](#custom-headers))                                         |

Clients then use:

* `https://mcp.example.com/mcp` — skills + API tools
* `https://mcp.example.com/mcp/api` — API tools only

Put TLS termination (and any network controls you need) in front of the container. For multi-tenant or public deployment, front the service with your own gateway and auth policies as you would any OAuth resource server.

### Custom headers

If your GrowthBook API sits behind a reverse proxy or extra auth (for example Cloudflare Access), pass headers via `GB_HTTP_HEADER_*` on the MCP process (stdio or Docker). Each name after the prefix is converted from `UPPER_SNAKE_CASE` to `Title-Case-With-Dashes`:

| Environment variable             | HTTP header sent  |
| -------------------------------- | ----------------- |
| `GB_HTTP_HEADER_X_TENANT_ID`     | `X-Tenant-ID`     |
| `GB_HTTP_HEADER_CF_ACCESS_TOKEN` | `Cf-Access-Token` |

<Info>
  **Header precedence**

  Custom headers cannot override `Authorization` or `Content-Type`.
</Info>

Example (stdio + Cloudflare Access):

```json theme={null}
{
  "mcpServers": {
    "growthbook": {
      "command": "npx",
      "args": ["-y", "@growthbook/mcp@latest"],
      "env": {
        "GB_API_KEY": "YOUR_API_KEY",
        "GB_API_URL": "https://growthbook.internal.example.com",
        "GB_HTTP_HEADER_CF_ACCESS_CLIENT_ID": "YOUR_CF_CLIENT_ID",
        "GB_HTTP_HEADER_CF_ACCESS_CLIENT_SECRET": "YOUR_CF_CLIENT_SECRET"
      }
    }
  }
}
```

You can add as many `GB_HTTP_HEADER_*` variables as needed — each one becomes a separate header on every request.

## Next steps

* [Install the Agent Skills plugin](/integrations/ai-agents/agent-skills) — same playbooks, no MCP process
* [MCP vs the plugin](/integrations/ai-agents) — which to use when
* [GrowthBook REST API](/app/api) — what the API tools call
* [growthbook-mcp on GitHub](https://github.com/growthbook/growthbook-mcp)

[Join our community Slack for additional tips and tricks](https://join.slack.com/t/growthbookusers/shared_invite/zt-2xw8fu279-Y~hwnfCEf7WrEI9qScHURQ)
