Back to MCP Servers

GrowthBook MCP Server

Official GrowthBook MCP server to manage feature flags, experiments, environments, SDK connections, and metrics from your LLM client.

Developer Tools by GrowthBook API Key active
Overview

The GrowthBook MCP server is the official Model Context Protocol integration from GrowthBook, the open-source feature flagging and experimentation platform. It lets an AI coding assistant (Cursor, Claude Desktop, Claude Code, VS Code, or any MCP-compatible client) read and mutate your GrowthBook configuration directly. You can create feature flags inline as you scaffold a component, wire up an A/B test, generate TypeScript types for your flags, or look up SDK connection details without leaving your editor.

The server exposes tools covering the main GrowthBook primitives: feature flags (create, list, find stale, add force rules, generate types), experiments (list, create, get attributes, manage defaults), environments, projects, SDK connections, metrics, and a documentation search tool. Tool permissions are scoped to the API key or Personal Access Token you provide, so an agent cannot perform actions the underlying user is not allowed to do.

The server is open source, published as @growthbook/mcp on npm and maintained by GrowthBook in the growthbook/growthbook-mcp repo. It runs locally over stdio and can point at either GrowthBook Cloud or a self-hosted GrowthBook instance via GB_API_URL and GB_APP_ORIGIN.

Tools

Tool Description
create_feature_flag Create a new feature flag, or wrap an element with one, specifying key, type, and default value.
get_feature_flags List feature flags in your GrowthBook instance or fetch a single flag by ID.
get_stale_feature_flags Analyze a set of flag IDs to identify stale flags and suggest cleanup.
create_force_rule Add a targeting/force rule (e.g. country = CA) to an existing feature flag.
generate_flag_types Generate TypeScript type definitions for your GrowthBook feature flags.
get_experiments List experiments, or fetch a specific experiment with metadata, full results, or a summary.
get_attributes List user attributes tracked in GrowthBook, useful for experiment targeting.
create_experiment Create an A/B test, optionally linked to a feature flag.
get_defaults Retrieve sample default values from prior experiments to seed new ones.
create_defaults Set custom baseline default values for future experiments.
clear_user_defaults Reset custom experiment defaults back to system-generated recommendations.
get_environments List all configured environments (e.g. production, staging).
get_projects List all projects in your GrowthBook instance.
get_sdk_connections List SDK connections that show how GrowthBook integrates with your apps.
create_sdk_connection Create a new SDK connection for a given language and environment.
get_metrics List fact and legacy metrics, or fetch a specific metric by ID.
search_growthbook_docs Search the GrowthBook documentation by keyword or question.
Setup Guide

Prerequisites

  • A GrowthBook account (Cloud at app.growthbook.io or self-hosted)
  • A GrowthBook API key or Personal Access Token. Capabilities will be scoped to the permissions of that key.
  • Node.js installed locally (the server runs via npx)

Required environment variables

  • GB_API_KEY: GrowthBook API key or PAT
  • GB_EMAIL: Email address tied to your GrowthBook account (used when creating flags and experiments)

Optional environment variables

  • GB_API_URL: Defaults to https://api.growthbook.io. Set this for self-hosted installs.
  • GB_APP_ORIGIN: Defaults to https://app.growthbook.io. Used to generate UI links.
  • GB_HTTP_HEADER_*: Pattern for adding custom HTTP headers, e.g. GB_HTTP_HEADER_X_PROXY=value.

Cursor / Claude Desktop config

{
  "mcpServers": {
    "growthbook": {
      "command": "npx",
      "args": ["-y", "@growthbook/mcp@latest"],
      "env": {
        "GB_API_KEY": "YOUR_API_KEY",
        "GB_API_URL": "https://api.growthbook.io",
        "GB_APP_ORIGIN": "https://app.growthbook.io",
        "GB_EMAIL": "you@example.com"
      }
    }
  }
}

Claude Code (terminal)

claude mcp add growthbook --transport stdio \
  --env GB_API_KEY=YOUR_API_KEY \
  --env GB_API_URL=https://api.growthbook.io \
  --env GB_APP_ORIGIN=https://app.growthbook.io \
  --env GB_EMAIL=you@example.com \
  -- npx -y @growthbook/mcp@latest

VS Code

Use the same JSON as above but under the "servers" key instead of "mcpServers".

Use Cases
  • Scaffold a feature flag directly from your editor while writing the code that consumes it, including key, type, default value, and targeting rule.
  • Spin up a new A/B test linked to a feature flag, with variations generated by the AI from a short hypothesis.
  • Audit and clean up stale feature flags by asking the agent to list flags older than N weeks and propose removals.
  • Keep TypeScript flag types in sync with GrowthBook by regenerating types whenever flags change.
  • Inspect SDK connections, environments, and metrics to debug why a flag isn't evaluating as expected in a given environment.
Example Prompts
  • "Create a feature flag called checkout-v2-enabled (boolean, default false) in the web project and wrap the <CheckoutPage /> component with it."
  • "List all stale feature flags in production and suggest which ones are safe to remove."
  • "Create an A/B experiment for the new pricing page hypothesis, with control and a 50/50 variant, and link it to the pricing-redesign flag."
  • "Regenerate the TypeScript types for our GrowthBook flags and write them to src/types/flags.ts."
  • "Show me all SDK connections and which environments they target, then create a new Node.js SDK connection for staging."
Pros
  • Official server maintained by GrowthBook and published as @growthbook/mcp on npm.
  • Broad tool coverage spanning flags, experiments, environments, projects, SDK connections, metrics, and docs search.
  • Works against both GrowthBook Cloud and self-hosted instances via configurable API and app URLs.
  • Permissions are inherited from the API key or PAT, so agent capabilities are bounded by existing user roles.
Limitations
  • Runs over stdio only; there is no hosted remote MCP endpoint, so each user must configure the npx command and env vars locally.
  • Tool inputs and outputs are not exhaustively documented in the README; some discovery happens at runtime.
  • Capabilities are limited by the underlying API key permissions, which can be confusing when an agent action silently fails due to insufficient scope.
Alternatives