This command-line tool provides a convenient interface for managing Bucket feature flags and related services directly from your terminal. It helps you create and manage features, configure access controls, and generate TypeScript types for your projects.
Install the CLI locally in your project:
# npm
npm install --save-dev @bucketco/cli
# yarn
yarn add --dev @bucketco/cli
The fastest way to get started is with the new
command, which initializes everything at once:
# npm
npx bucket new
# yarn
yarn bucket new
If you prefer more control, you can use the individual commands:
# Initialize Bucket in your project
npx bucket init
# Create a new feature
npx bucket features create "My Feature"
# Generate TypeScript types for your features
npx bucket features types
The CLI creates a bucket.config.json
file in your project directory when you run bucket init
. Here's the structure:
{
"$schema": "https://unpkg.com/@bucketco/cli@latest/schema.json",
"baseUrl": "https://app.bucket.co",
"apiUrl": "https://app.bucket.co/api",
"appId": "ap123456789",
"typesOutput": [
{
"path": "gen/features.d.ts",
"format": "react"
}
]
}
latest
)path
and format
properties. Available formats: react
and node
# Initialize a new Bucket configuration
npx bucket init [--overwrite] [--app-id <id>] [--key-format <format>]
# Quick start command that combines init, feature creation, and type generation
npx bucket new "My Feature" [--app-id ap123456789] [--key my-feature] [--key-format custom] [--out gen/features.ts] [--format react]
# Log in to your Bucket account
npx bucket login
# Log out from your Bucket account
npx bucket logout
# Create a new feature
npx bucket features create "My Feature" [--app-id ap123456789] [--key my-feature] [--key-format custom]
# List all features for the current app
npx bucket features list [--app-id ap123456789]
# Generate TypeScript types for your features
npx bucket features types [--app-id ap123456789] [--out gen/features.ts] [--format react]
# List all companies in your app
npx bucket companies list [--filter <text>] [--app-id ap123456789]
# Grant or revoke feature access for companies, segments, and users
npx bucket companies features access [--app-id ap123456789] [featureKey] [--enable|--disable] [--companies <id...>] [--segments <id...>] [--users <id...>]
Setup rules to help AI tools understand your Bucket feature flags:
npx bucket rules [--format <cursor|copilot>] [--yes]
Configure your editor or AI client to connect with Bucket's remote MCP server:
npx bucket mcp [--app-id <id>] [--editor <editor>] [--scope <local|global>]
Supported editors/clients:
The command guides you through selecting which editor to configure, which app to connect to, and whether to use global or project-local configuration.
These options work with all commands:
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 > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.