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
71.3K downloads
18 stars

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

Installation

Install the Reflag CLI as a development dependency in your project:

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

# yarn
yarn add --dev @reflag/cli

Get started quickly with the new command:

# npm
npx reflag new

# yarn
yarn reflag new

Configuration

The CLI creates a reflag.config.json file when you run reflag init. This file contains all necessary settings for your Reflag integration.

Configuration File Structure

{
  "$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"
    }
  ]
}

Configuration options:

  • $schema: Provides autocompletion for the config
  • baseUrl: Base URL for Reflag services
  • apiUrl: API URL for Reflag services
  • appId: Your Reflag application ID
  • typesOutput: Path(s) where TypeScript types will be generated

Basic Commands

Initialize a New Project

npx reflag init [--overwrite]

Options:

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

Quick Start with a New Flag

npx reflag new "My Flag" [--app-id ap123456789] [--key my-flag]

Options:

  • --key: Specific key for the flag
  • --app-id: App ID to use
  • --key-format: Format for flag keys
  • --out: Path for generated TypeScript types
  • --format: Format of generated types (react or node)

Authentication

# Login to your Reflag account
npx reflag login

# Logout from your Reflag account
npx reflag logout

Managing Flags

Create a Flag

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

List All Flags

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

Generate TypeScript Types

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

AI-Assisted Development

Set Up Reflag Rules

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

Options:

  • --format: Format to add rules in (cursor or copilot)
  • --yes: Skip confirmation prompts

Configure MCP Connection

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

Options:

  • --editor: The editor to configure (cursor, vscode, claude, windsurf)
  • --scope: Whether to configure settings globally or locally

The setup process will:

  1. Help you select which editor to configure
  2. Let you choose which Reflag app to connect to
  3. Configure either global or project-local settings
  4. Set up the appropriate configuration files

CI/CD Integration

For CI/CD pipelines, use the --api-key option or set the REFLAG_API_KEY environment variable:

npx reflag flags types --api-key $API_KEY

Example GitHub Actions workflow:

# Using command-line argument
- 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 }}

Global Options

These options work with any command:

  • --debug: Enable verbose output
  • --base-url <url>: Set the base URL for Reflag API
  • --api-url <url>: Set the API URL directly
  • --api-key <key>: Use API key for authentication
  • --help: Display help information

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