Skip to main content
Glama

Bucket Feature Flags MCP Server

Official
by bucketco

存储桶 CLI

用于与 Bucket 服务交互的命令行界面。CLI 允许您管理应用、功能、身份验证,并为 Bucket 功能生成 TypeScript 类型。使用此工具,您可以直接从终端简化功能标记工作流程。

用法

首先在您的项目中本地安装 CLI:

# npm npm install --save-dev @bucketco/cli # yarn yarn add --dev @bucketco/cli

然后从项目的根目录运行new命令,初始化 CLI,创建功能,并一次性生成类型:

# npm npx bucket new # yarn yarn bucket new

单独的命令

您可以单独调用每个步骤,而不必运行new步骤。

# Initialize Bucket in your project (if not already setup) npx bucket init # Create a new feature npx bucket features create "My Feature" # Generate TypeScript types for your features npx bucket features types

配置

运行bucket init时,CLI 会在项目目录中创建一个bucket.config.json文件。此文件包含 Bucket 集成所需的所有设置。

配置文件结构

以下是bucket.config.json文件中可用的配置选项的完整列表:

{ "$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" } ] }
选项描述默认
$schema配置的自动完成功能。 latest可以用特定版本替换。https://unpkg.com/@bucketco/cli@latest/schema.json
baseUrlBucket 服务的基本 URL。https://app.bucket.co
apiUrlBucket 服务的 API URL(覆盖 API 调用的 baseUrl)。https://app.bucket.co/api
appId您的 Bucket 应用程序 ID。必需的
typesOutputTypeScript 类型生成路径。可以是字符串,也可以是包含pathformat属性的对象数组。可用格式: reactnode“gen/features.ts” 格式为“react”

您可以使用单个命令的命令行选项覆盖这些设置。

命令

bucket init

在您的项目中初始化一个新的 Bucket 配置。这将创建一个bucket.config.json文件,其中包含您的设置,并提示您输入任何未通过选项提供的必需信息。

npx bucket init [--overwrite]

选项:

  • --overwrite :如果存在,则覆盖现有配置文件。
  • --app-id <id> :设置应用程序 ID。
  • --key-format <format> :设置功能的密钥格式。

bucket new [featureName]

一体化命令,快速上手。此命令将init 、特性创建和类型生成功能集成到单个步骤中。使用此命令可以最快地启动并运行 Bucket。

npx bucket new "My Feature" [--app-id ap123456789] [--key my-feature] [--key-format custom] [--out gen/features.ts] [--format react]

选项:

  • --key :该功能的特定键。
  • --app-id :要使用的应用程序 ID。
  • --key-format :功能键的格式(自定义、蛇形、骆驼等)。
  • --out :生成 TypeScript 类型的路径。
  • --format :生成类型的格式(react 或 node)。

如果您希望对每个步骤进行更多控制,则可以使用单独的命令( initfeatures createfeatures types )。

bucket login

登录您的 Bucket 帐户。这将验证您的 CLI 以进行后续操作,并安全地存储凭据。

npx bucket login

bucket logout

从您的 Bucket 帐户注销,删除存储的凭据。

npx bucket logout

bucket features

使用以下子命令管理您的 Bucket 功能。

bucket features create [featureName]

在您的 Bucket 应用中创建一个新功能。如果未提供选项,该命令将通过交互式提示引导您完成功能创建过程。

npx bucket features create "My Feature" [--app-id ap123456789] [--key my-feature] [--key-format custom]

选项:

  • --key :该功能的特定键。
  • --app-id :要使用的应用程序 ID。
  • --key-format :功能键的格式。
bucket features list

列出当前应用的所有功能。这有助于您直观地了解可用的功能及其当前配置。

npx bucket features list [--app-id ap123456789]

选项:

  • --app-id :要使用的应用程序 ID。
bucket features types

为您的功能生成 TypeScript 类型。这可确保在 TypeScript/JavaScript 应用程序中使用 Bucket 功能时的类型安全。

npx bucket features types [--app-id ap123456789] [--out gen/features.ts] [--format react]

选项:

  • --app-id :要使用的应用程序 ID。
  • --out :生成 TypeScript 类型的路径。
  • --format :生成类型的格式(react 或 node)。

bucket companies

用于管理公司的命令。

bucket companies list

列出您的应用中的所有公司。

npx bucket companies list [--filter <text>] [--app-id ap123456789]

选项:

  • --filter :按名称或 ID 过滤公司。
  • --app-id :要使用的应用程序 ID。

该命令输出一个包含以下列的表:

  • id :公司 ID。
  • name :公司名称(如果未设置则显示“(未命名)”)。
  • users :公司内的用户数量。
  • lastSeen :公司最后活跃的日期。

bucket companies features access

授予或撤销公司、部门和用户对特定功能的访问权限。如果未提供功能密钥,系统将提示您从列表中选择一个。

npx bucket companies features access [--app-id ap123456789] [featureKey] [--enable|--disable] [--companies <id...>] [--segments <id...>] [--users <id...>]

参数:

  • featureKey :授予/撤销访问权限的功能的键(可选,如果省略则进行交互式选择)。

选项:

  • --enable :为指定目标启用该功能。
  • --disable :禁用指定目标的功能。
  • --users :目标用户 ID。可以多次指定。
  • --companies :目标公司 ID。可多次指定。
  • --segments :目标段 ID。可以多次指定。
  • --app-id :要使用的应用程序 ID。

必须指定至少一个目标(公司、细分或用户)。您还必须指定--enable--disable ,但不能同时指定两者。

例子:

# Enable feature for multiple companies and users npx bucket companies features access my-feature --enable --companies comp_123 --companies comp_456 --users user_789

bucket apps

用于管理 Bucket 应用程序的命令。

全局选项

这些选项可以与任何命令一起使用:

  • --debug :启用调试模式以获得详细输出。
  • --base-url <url> :设置 Bucket API 的基本 URL。
  • --api-url <url> :直接设置 API URL(覆盖基本 URL)。
  • --help :显示命令的帮助信息。

人工智能辅助开发

Bucket 通过规则和模型上下文协议 (MCP) 提供强大的 AI 辅助开发能力,帮助您的 AI 开发工具更好地理解您的特征,从而提供更精准的辅助。

存储桶规则(推荐)

rules命令可帮助您为项目设置 AI 专用规则。这些规则使 AI 工具能够更好地理解如何使用 Bucket 和功能开关,以及如何在代码库中使用它们。

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

选项:

  • --format :添加规则的格式:
    • cursor :向.cursor/rules/bucket.mdc添加规则,用于 Cursor IDE 集成。
    • copilot :向.github/copilot-instructions.md添加规则以用于 GitHub Copilot 集成。
  • --yes :跳过确认提示并覆盖现有文件而不询问。

此命令将向您的项目添加规则,为 AI 工具提供有关如何设置和使用 Bucket 功能标志的上下文。对于 Copilot 格式,规则将添加到文件中的专用部分,以便您在维护 Bucket 规则的同时,还能维护其他 Copilot 指令。

模型上下文协议

模型上下文协议 (MCP) 是一种开放协议,它提供了一种标准化的方式将 AI 模型连接到不同的数据源和工具。在 Bucket 上下文中,MCP 使您的代码编辑器能够理解您的功能开关、它们的状态以及它们在代码库中的关系。这在您的功能管理工作流程和 AI 驱动的开发工具之间建立了无缝的桥梁。MCP 服务器由 Bucket 托管,因此非常易于上手。

**注意:Bucket 的mcp CLI 命令之前用于本地服务器。不过,在 Bucket CLI 的最新版本中, mcp命令已被重新设计,可帮助您连接到新的远程 MCP 服务器。**_

设置 MCP

mcp命令可帮助您配置编辑器或 AI 客户端,以连接到 Bucket 的远程 MCP 服务器。这使您的 AI 工具能够理解您的功能开关并提供更多上下文帮助。

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

选项:

该命令将指导您完成:

  1. 选择要配置的编辑器/客户端。
  2. 选择要连接的 Bucket 应用程序。
  3. 决定全局配置还是项目本地配置。
  4. 为您选择的编辑器设置适当的配置文件。

注意:此设置使用mcp-remote作为兼容层,允许远程托管的 Bucket MCP 服务器与所有支持 MCP STDIO 服务器的编辑器/客户端兼容。如果您的编辑器/客户端支持基于 OAuth 的 HTTP 流式传输,则可以直接连接到 Bucket MCP 服务器。

发展

# Build the CLI yarn build # Run the CLI locally yarn bucket [command] # Lint and format code yarn lint yarn format

要求

  • Node.js >=18.0.0

执照

MIT 许可证版权所有 (c) 2025 Bucket ApS

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

直接从代码编辑器中的聊天中标记功能,包括 VS Code、Cursor、Windsurf、Claude Code——任何支持 MCP 的 IDE。

  1. 用法
    1. 单独的命令
  2. 配置
    1. 配置文件结构
  3. 命令
    1. bucket init
    2. bucket new [featureName]
    3. bucket login
    4. bucket logout
    5. bucket features
    6. bucket companies
    7. bucket companies features access
    8. bucket apps
  4. 全局选项
    1. 人工智能辅助开发
      1. 存储桶规则(推荐)
    2. 模型上下文协议
      1. 设置 MCP
    3. 发展
      1. 要求
        1. 执照

          Related MCP Servers

          • A
            security
            A
            license
            A
            quality
            A template for creating custom tools for Cursor IDE using Model Context Protocol (MCP), allowing developers to extend Cursor's functionality with their own server-based tools.
            Last updated -
            11
            2
            Python
            MIT License
            • Apple
            • Linux
          • -
            security
            A
            license
            -
            quality
            SeekChat supports MCP tool execution, enabling AI to directly control your computer and perform various tasks. Easily automate file management, data analysis, code development, and more, turning AI into a truly intelligent assistant.
            Last updated -
            18
            JavaScript
            Apache 2.0
            • Apple
            • Linux
          • -
            security
            F
            license
            -
            quality
            An MCP server that allows AI assistants to programmatically manage Unleash feature flags through natural language, enabling operations like creating, updating, and retrieving feature flags across projects.
            Last updated -
            5
            2
            TypeScript

          View all related MCP servers

          MCP directory API

          We provide all the information about MCP servers via our MCP API.

          curl -X GET 'https://glama.ai/api/mcp/v1/servers/bucketco/bucket-javascript-sdk'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server