Bucket CLI is a command-line interface tool for managing feature flags and interacting with Bucket services. It allows you to create, manage, and implement feature flags directly from your terminal while providing TypeScript type generation to ensure type safety in your applications.
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 using the new
command from your project's root directory. This initializes the CLI, creates a feature, and generates types all at once:
# npm
npx bucket new
# yarn
yarn bucket new
The CLI creates a bucket.config.json
file in your project when you run bucket init
. This file contains all necessary settings for your Bucket integration.
{
"$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"
}
]
}
Option | Description | Default |
---|---|---|
$schema |
Autocompletion for the config. latest can be replaced with a specific version. |
"https://unpkg.com/@bucketco/cli@latest/schema.json" |
baseUrl |
Base URL for Bucket services. | "https://app.bucket.co" |
apiUrl |
API URL for Bucket services (overrides baseUrl for API calls). | "https://app.bucket.co/api" |
appId |
Your Bucket 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/features.ts" with format "react" |
npx bucket init [--overwrite]
Options:
--overwrite
: Overwrite existing configuration file--app-id <id>
: Set the application ID--key-format <format>
: Set the key format for features# Login to your Bucket account
npx bucket login
# Logout from your Bucket account
npx bucket logout
npx bucket features create "My Feature" [--key my-feature] [--app-id ap123456789] [--key-format custom]
npx bucket features list [--app-id ap123456789]
npx bucket features types [--app-id ap123456789] [--out gen/features.ts] [--format react]
npx bucket companies list [--filter <text>] [--app-id ap123456789]
npx bucket companies features access [featureKey] [--enable|--disable] [--companies <id...>] [--segments <id...>] [--users <id...>] [--app-id ap123456789]
Example:
# Enable feature for multiple companies and users
npx bucket companies features access my-feature --enable --companies comp_123 --companies comp_456 --users user_789
The Model Context Protocol provides a way to connect AI models with your feature flags for enhanced AI-assisted development.
npx bucket mcp [--port <number|"auto">] [--app-id ap123456789]
Options:
--port
: Port to run the SSE server on (defaults to 8050, "auto" for random port)--app-id
: App ID to use{
"mcpServers": {
"Bucket": {
"url": "http://localhost:8050/sse"
}
}
}
{
"mcpServers": {
"Bucket": {
"command": "npx",
"args": ["-y", "supergateway", "--sse", "http://localhost:8050/sse"]
}
}
}
Settings > MCP
Add new global MCP server
and paste the SSE configSettings > Developer
Edit config
and paste the STDIO configSet up AI-specific rules for your project with:
npx bucket rules [--format cursor|copilot] [--yes]
Options:
--format
: Format to add rules in (cursor or copilot)--yes
: Skip confirmation promptsThere 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.