Skip to content
Go back

GrowthBook MCP Server: Feature Flags and A/B Tests From Your AI Coding Tool

Updated:

The GrowthBook MCP Server is the first Model Context Protocol server built for feature management and experimentation. It lets you create feature flags, run A/B tests, and manage experiments directly from AI coding tools like Claude, Cursor, and VS Code.

No more switching between your IDE and GrowthBook’s dashboard. Ask Claude to wrap your new feature in a flag, and it handles both the code and the GrowthBook configuration.

Table of contents

Open Table of contents

What is MCP?

Model Context Protocol (MCP) is a standard that lets AI tools connect to external platforms. Instead of writing custom integration code for every service, AI assistants can use MCP servers as a universal interface.

GrowthBook’s MCP server was the first in the experimentation space. It formalises the connection between your AI coding assistant and GrowthBook’s feature flag and experimentation platform.

Why this matters

GrowthBook frames this around a specific problem: “Don’t let vibe coding become vibe shipping.”

When you’re using AI to write code quickly, it’s tempting to deploy without proper safeguards. The MCP server removes friction from adding feature flags, so there’s no excuse to skip them.

Instead of:

  1. Write code with AI
  2. Open GrowthBook dashboard
  3. Create feature flag
  4. Copy configuration back to code
  5. Deploy and hope

You get:

  1. Ask Claude to add the feature with a flag
  2. Deploy safely

The flag creation happens inline. Your AI assistant handles both the code changes and the GrowthBook setup simultaneously.

What you can do with it

The GrowthBook MCP Server includes 14 tools:

Feature flags

Experiments

Other tools

Setting it up

You’ll need a GrowthBook account and an API key. Create one in Settings → API Keys → New Secret Key.

The server requires two environment variables:

Two optional variables:

Claude Code setup

Add this to your Claude Code configuration:

{
  "mcpServers": {
    "growthbook": {
      "command": "npx",
      "args": ["-y", "@growthbook/mcp"],
      "env": {
        "GB_API_KEY": "your-api-key",
        "GB_EMAIL": "your-email@example.com"
      }
    }
  }
}

Claude Desktop setup

For Claude Desktop, add the same configuration to your claude_desktop_config.json file.

Cursor and VS Code

Both editors support MCP servers through their settings. The GrowthBook documentation includes direct installation links for Cursor.

For a complete walkthrough, watch the GrowthBook MCP setup video.

Practical examples

Adding a feature flag to new code:

“Wrap this new checkout flow in a feature flag called ‘new-checkout’ and set it to off by default”

Claude creates the flag in GrowthBook, generates the code to check it, and wraps your feature appropriately.

Setting up a beta test:

“Create a feature flag for the new dashboard that’s only visible to users with the beta-tester attribute”

The MCP server handles the targeting configuration in GrowthBook while Claude updates your code.

Checking experiment results:

“Show me the results for the pricing-page-test experiment”

Get experiment data without opening the GrowthBook dashboard.

Real-world applications

Campaign optimisation

Marketing agencies can rapidly test different creative variations across client campaigns. Instead of manually setting up each test, describe your experiment goals to your AI tool and have the setup handled automatically.

Landing page testing

Growth teams can quickly iterate on landing page elements—headlines, CTAs, form fields—without breaking their analytical workflow. Ask your AI assistant to create experiments and immediately discuss potential outcomes and statistical considerations.

Email marketing

Email marketers can test subject lines, send times, and content variations while staying focused on overall campaign strategy. The AI integration means less time on platform management and more time on creative thinking.

GrowthBook vs PostHog: MCP comparison

Both GrowthBook and PostHog offer MCP server support. Here’s how they compare:

FeatureGrowthBook MCPPostHog MCP
Feature Flag ManagementComprehensiveComprehensive
A/B TestingAdvanced statistical analysisIntegrated with product analytics
Marketing FocusStrong experimentation featuresProduct-analytics focused
Setup ComplexityStraightforwardModerate

GrowthBook excels for teams focused primarily on experimentation, while PostHog provides broader product analytics alongside experimentation features.

The bigger picture

This is part of a broader shift in how developers interact with external services. MCP servers turn dashboard-based tools into conversational interfaces.

For teams using AI coding assistants heavily, having feature flags accessible through the same interface reduces the temptation to skip them. When adding a flag is as easy as asking for it, there’s less friction between “move fast” and “ship safely.”

The GrowthBook MCP Server is open source on GitHub and works with any MCP-compatible client.

Resources


Back to top ↑