Skip to content
Go back

GrowthBook MCP Server: Feature Flags & A/B Tests in Claude Code

Stuart Brameld

Stuart Brameld

Founder
Updated:
Table of contents

The GrowthBook MCP server is GrowthBook’s official Model Context Protocol integration: it lets you create feature flags, run A/B tests, and manage experiments straight from Claude Code, Cursor, or VS Code, without opening the GrowthBook dashboard. Ask Claude to wrap a new feature in a flag, and it handles both the code change and the GrowthBook configuration in one step.

No more switching between your IDE and GrowthBook’s dashboard to keep flags and experiments in sync — the MCP server keeps both updated from the same conversation.

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.

We’ve seen the same shift across other tools marketing and growth teams rely on: analytics with the GA4 MCP server, design handoff with the Figma MCP server, and research automation with the Firecrawl MCP server. Each one turns a dashboard-only workflow into something your AI coding tool can drive directly.

About Growth Method

Shipping a feature flag from inside your AI coding tool is a small example of a bigger shift: marketing teams are moving from dashboards to agents too. Growth Method is built on the same idea, for the marketing side of the business. Instead of a chat box bolted onto your existing tools, it’s the agentic marketing platform for B2B teams — connect GrowthBook (plus GA4, PostHog, Google Ads and more) once, and both your team and your AI agents can plan campaigns, ship them, and see what actually moved the needle.

If your team is already comfortable asking Claude to wrap a feature in a flag, the natural next step is asking an AI marketing agent to plan the campaign that flag supports, and tell you afterwards whether it moved the number you care about. That’s what we’re building.

Apply for early access to Growth Method.

Frequently asked questions

What is the GrowthBook MCP server?

The GrowthBook MCP server is GrowthBook’s official Model Context Protocol integration. It exposes 14 tools for creating feature flags, running A/B tests, and managing experiments, so an AI coding assistant can make those changes directly instead of you switching to the GrowthBook dashboard.

Does GrowthBook MCP work with Claude Code?

Yes. GrowthBook MCP works with Claude Code, Claude Desktop, Cursor, and VS Code. For Claude Code, you add the server with two environment variables, GB_API_KEY and GB_EMAIL, in your MCP configuration.

Can I manage feature flags and A/B tests from Claude, Cursor, or VS Code?

Yes. Once connected, you can ask your AI coding tool to create and target feature flags, generate TypeScript types for them, create A/B tests linked to a flag, and pull back experiment results, all without leaving your editor.

Is the GrowthBook MCP server free to use?

The MCP server itself is open source and free. You need a GrowthBook account and API key to connect it, and GrowthBook’s free plan is enough to try it out.

Resources


Back to top ↑