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).
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
The CLI creates a reflag.config.json file when you run reflag init. This file contains all necessary settings for your Reflag integration.
{
"$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 configbaseUrl: Base URL for Reflag servicesapiUrl: API URL for Reflag servicesappId: Your Reflag application IDtypesOutput: Path(s) where TypeScript types will be generatednpx reflag init [--overwrite]
Options:
--overwrite: Overwrite existing configuration file--app-id <id>: Set the application ID--key-format <format>: Set the key format for flagsnpx 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)# Login to your Reflag account
npx reflag login
# Logout from your Reflag account
npx reflag logout
npx reflag flags create "My Flag" [--app-id ap123456789] [--key my-flag]
npx reflag flags list [--app-id ap123456789]
npx reflag flags types [--app-id ap123456789] [--out gen/flags.ts] [--format react]
npx reflag rules [--format <cursor|copilot>] [--yes]
Options:
--format: Format to add rules in (cursor or copilot)--yes: Skip confirmation promptsnpx reflag mcp [--editor <editor>] [--scope <local|global>]
Options:
--editor: The editor to configure (cursor, vscode, claude, windsurf)--scope: Whether to configure settings globally or locallyThe setup process will:
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 }}
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 informationTo 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.
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.
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"
]
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.json2. Add this to your configuration file:
{
"mcpServers": {
"bucket": {
"command": "npx",
"args": [
"@bucketco/cli",
"mcp"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect