Bucket (Feature Flagging) MCP server

Flag features directly from chat in your code editor, including VS Code, Cursor, Windsurf, Claude Code - any IDE with MCP support.
Back to servers
Setup instructions
Provider
Bucket
Release date
Apr 07, 2025
Language
TypeScript
Package
Stats
45.7K downloads
15 stars

Reflag CLI is a powerful command-line tool for managing feature flags in your applications. It allows you to create and manage flags, generate TypeScript type definitions, and integrate with AI development tools through the Model Context Protocol (MCP).

Installation

Get started by installing the CLI locally in your project:

# npm
npm install --save-dev @reflag/cli

# yarn
yarn add --dev @reflag/cli

Then initialize your project with the new command from your project's root directory:

# npm
npx reflag new

# yarn
yarn reflag new

Configuration

The CLI creates a reflag.config.json file in your project directory during initialization. This file contains all necessary settings for your Reflag integration.

Configuration Options

{
  "$schema": "https://unpkg.com/@reflag/cli@latest/schema.json",
  "baseUrl": "https://app.reflag.com",
  "apiUrl": "https://app.reflag.com/api",
  "appId": "ap123456789",
  "typesOutput": [
    {
      "path": "gen/flags.d.ts",
      "format": "react"
    }
  ]
}
Option Description Default
$schema Autocompletion for the config. latest can be replaced with a specific version. "https://unpkg.com/@reflag/cli@latest/schema.json"
baseUrl Base URL for Reflag services. "https://app.reflag.com"
apiUrl API URL for Reflag services (overrides baseUrl for API calls). "https://app.reflag.com/api"
appId Your Reflag application ID. Required
typesOutput Path(s) where TypeScript types will be generated. Can be a string or an array of objects with path and format properties. Available formats: react and node. "gen/flags.ts" with format "react"

Commands

Quick Start Commands

reflag new [flagName]

All-in-one command to get started quickly, combining initialization, flag creation, and type generation:

npx reflag new "My Flag" [--app-id ap123456789] [--key my-flag] [--key-format custom] [--out gen/flags.ts] [--format react]

reflag init

Initialize a new Reflag configuration in your project:

npx reflag init [--overwrite]

Options:

  • --overwrite: Overwrite existing configuration file if one exists
  • --app-id <id>: Set the application ID
  • --key-format <format>: Set the key format for flags

Authentication Commands

reflag login

Log in to your Reflag account:

npx reflag login

reflag logout

Log out from your Reflag account:

npx reflag logout

Flag Management Commands

reflag flags create [flagName]

Create a new flag in your Reflag app:

npx reflag flags create "My Flag" [--app-id ap123456789] [--key my-flag] [--key-format custom]

reflag flags list

List all flags for the current app:

npx reflag flags list [--app-id ap123456789]

reflag flags types

Generate TypeScript types for your flags:

npx reflag flags types [--app-id ap123456789] [--out gen/flags.ts] [--format react]

AI Integration

Setting up AI Rules

The rules command helps you set up AI-specific rules for your project:

npx reflag rules [--format <cursor|copilot>] [--yes]

Configuring the Model Context Protocol (MCP)

The mcp command configures your editor or AI client to connect with Reflag's remote MCP server:

npx reflag mcp [--app-id <id>] [--editor <editor>] [--scope <local|global>]

Supported editors/clients:

  • cursor: Cursor IDE
  • vscode: Visual Studio Code
  • claude: Claude Desktop
  • windsurf: Windsurf

CI/CD Integration

For automated environments, use the --api-key option or the REFLAG_API_KEY environment variable:

# Generate types in CI/CD
npx reflag flags types --api-key $REFLAG_API_KEY

Example GitHub Actions workflow:

# Using command option
- name: Generate types
  run: npx reflag flags types --api-key ${{ secrets.REFLAG_API_KEY }}

# Using environment variable
- name: Generate types
  run: npx reflag flags types
  env:
    REFLAG_API_KEY: ${{ secrets.REFLAG_CI_API_KEY }}

Migrating from Bucket SDK

If you're migrating from the Bucket CLI:

  • The command has been renamed from bucket to reflag
  • Types file renamed to flags.d.ts from features.d.ts
  • Auth file changed to .reflag-auth from .bucket-auth
  • Config file changed to reflag.config.json from bucket.config.json
  • The features command renamed to flags
  • API key now uses REFLAG_API_KEY instead of BUCKET_API_KEY

Remember to update your scripts, build steps, and .gitignore patterns.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "bucket" '{"command":"npx","args":["@bucketco/cli","mcp"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "bucket": {
            "command": "npx",
            "args": [
                "@bucketco/cli",
                "mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "bucket": {
            "command": "npx",
            "args": [
                "@bucketco/cli",
                "mcp"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later