DevCycle 标志

DevCycle

组织
DevCycleHQ

DevCycle - CLI

发布者DevCycleHQ
代码仓库cli
语言TypeScript
复刻数
6
星标数
20
可用工具
0
传输类型streamable-http
许可协议MIT
链接
  • 将工具接入 AI 工作流

    DevCycle 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 20 个 Star 和 6 个 Fork。

DevCycle CLI & MCP Server

This repository contains the DevCycle CLI for managing feature flags from the command line, plus an MCP (Model Context Protocol) server that enables AI coding assistants to interact with DevCycle.

Major features include:

  • Fully manage your Features, Variables, Variations and Targeting Rules from the command line
  • Detect and list DevCycle Variable usages in your codebase
  • Manage your Self-Targeting Overrides to quickly switch between Variable values
  • Generate type definitions for type-safe usage of DevCycle (Typescript only)
  • MCP (Model Context Protocol) server for AI-powered feature flag management with Cursor and Claude

The CLI can be customized in several ways using command-line args or by creating a configuration file.

oclif Version License

MCP Server for AI Assistants

The DevCycle MCP (Model Context Protocol) server enables AI coding assistants like Cursor and Claude to manage feature flags directly from your development environment. DevCycle offers a hosted MCP server that requires no local installation.

Quick Setup (No Installation Required)

  1. Configure your AI assistant to use the hosted MCP server:

    • Cursor: Add to .cursor/mcp_settings.json:

      json
      {
        "mcpServers": {
          "devcycle": {
            "url": "https://mcp.devcycle.com/mcp"
          }
        }
      }
    • Claude Desktop: Add to your Claude config file:

      json
      {
        "mcpServers": {
          "devcycle": {
            "command": "npx",
            "args": [
              "mcp-remote",
              "https://mcp.devcycle.com/mcp"
            ]
          }
        }
      }
  2. That's it! The server will guide you through OAuth authentication when you first use it.

Your AI assistant can now create, update, and manage feature flags on your behalf.

For local installation options, detailed configuration, available tools, and advanced usage, see the complete MCP documentation.

CLI Documentation

Setup

Install the CLI

Using NPM

sh
$ npm install -g @devcycle/cli

Or alternatively, using homebrew

sh
$ brew tap devcyclehq/cli
$ brew install devcycle

Authentication

Many of the CLI commands require DevCycle API authorization. There are several ways to provide these credentials.

Using Access Tokens (preferred)

Login Command

By using the login sso command, the CLI will retrieve and store an access token, which is valid for 24 hours.

The login again command can be used to retrieve a new access token using the saved project and organization without prompting for them.

This process will open browser windows to interact with the DevCycle universal login page. It will first obtain a personal access token, then prompt you to choose an organization. A second browser window is used to authenticate the CLI with your chosen organization.

To switch organizations once logged in, the organizations select command can be used.

If executing the CLI in a containerized environment, please ensure one of the following PORTs can be accessed via Port Forwarding: 2194 (default), 2195, 2196 or 8080. This will allow the authentication process to complete and set the access token appropriately.

Repo Init Command

The repo init command behaves in the same way as login sso, but creates a repo configuration file and stores the project and organization choices there instead.

Using Client Credentials

Client Credentials in Auth File

Use the dvc status command to find the configuration file location for your platform. The credentials can be stored in the file pointed to by the Auth config path. Create the file if it does not exist, with the following contents.

yaml
clientCredentials:
  client_id: <your client id>
  client_secret: <your client secret>

This file should not be checked in to version control.

The default location is based on the oclif configDir

If you intend to run the CLI using options that override config file locations, the dvc status command command can be run with those options to confirm that the file locations are as expected.

Project Selection

You also need to specify the default project ID for the CLI to use.

If there is a repo configuration file, the dvc diff and dvc usages commands will use the project defined there.

Otherwise, this is chosen during login or set using the project select command

Environment Variables

Set the following environment variables:

sh
$ export DEVCYCLE_CLIENT_ID=<your client id>
$ export DEVCYCLE_CLIENT_SECRET=<your client secret>
$ export DEVCYCLE_PROJECT_KEY=<your project key>

Command-Line Arguments

The CLI can be run with the following arguments:

sh
$ dvc --client-id=<your client id> --client-secret=<your client secret> --project=<your project key>

Github Action

The Devcycle Github actions are configured with auth information through the project-key, client-id and client-secret configuration parameters. This is passed to the CLI via command line arguments.

Usage

sh
$ npm install -g @devcycle/cli
$ dvc COMMAND
running command...
$ dvc (--version)
@devcycle/cli/6.3.2 linux-x64 node-v22.22.2
$ dvc --help [COMMAND]
USAGE
  $ dvc COMMAND
...

Command Topics

  • dvc alias - Manage repository variable aliases.
  • dvc autocomplete - display autocomplete installation instructions
  • dvc cleanup - Replace a DevCycle variable with a static value in the current version of your code. Currently only JavaScript is supported.
  • dvc diff - Print a diff of DevCycle variable usage between two versions of your code.
  • dvc environments - Create a new Environment for an existing Feature.
  • dvc features - Create, view, or modify Features with the Management API.
  • dvc generate - Generate Devcycle related files.
  • dvc help - Display help for dvc.
  • dvc identity - View or manage your DevCycle Identity.
  • dvc keys - Retrieve SDK keys from the Management API.
  • dvc login - Log in to DevCycle.
  • dvc logout - Discards any auth configuration that has been stored in the auth configuration file.
  • dvc organizations - List or switch organizations.
  • dvc overrides - Create, view, or modify Overrides for a Project with the Management API.
  • dvc projects - Create, or view Projects with the Management API.
  • dvc repo - Manage repository configuration.
  • dvc status - Check CLI status.
  • dvc targeting - Create, view, or modify Targeting Rules for a Feature with the Management API.
  • dvc usages - Print all DevCycle variable usages in the current version of your code.
  • dvc variables - Create, view, or modify Variables with the Management API.
  • dvc variations - Create a new Variation for an existing Feature.

Repo Configuration

The following commands can only be run from the root of a configured repository

Many of the options available as command-line args can also be specified using a repo configuration file. The default location for this file is <REPO ROOT>/.devcycle/config.yml.

This location can be overridden using the --repo-config-path flag.

The configuration file format is documented below:

yml
## the project and organization to use when connecting to the DevCycle Rest API for this repo
project: "project-key"
org:
  id: "org_xxxxxx"
  name: "unique-org-key"
  display_name: "Human Readable Org Name"
## block for configuring "code insights" features like diff and variable usage scanning
## use this section to improve the detection of DevCycle usage within your code
codeInsights:
  ## add additional names to check for when looking for instances of DVCClient from an SDK
  clientNames:
    - "dvcClient"
  ## map the values used in your code to the corresponding variable key in DevCycle
  variableAliases:
    "VARIABLES.ENABLE_V1": "enable-v1"
  ## additional regex patterns used to match variables for a specific file extension
  matchPatterns:
    ## file extension to override for, containing a list of patterns to use
    js:
      - dvcClient\.variable\(\s*["']([^"']*)["']
  ## an array of file glob patterns to include in usage scan
  includeFiles:
    - "*.[jt]s"
  ## an array of file glob patterns to exclude from usage scan
  excludeFiles:
    - "dist/*"

Match Patterns and Aliases

When identifying variable usages in the code, the CLI will identify DevCycle SDK methods by default. To capture other usages you may define match patterns. Match patterns are defined by file extension.

:::note Each pattern must include exactly one capture group for the variable key. Capture the entire key value (including surrounding quotes if you choose the “with quotes” pattern). :::

Match patterns can be defined in the configuration file, for example:

yml
codeInsights:
  matchPatterns:
    js:
      - customVariableGetter\(\s*["']([^"']*)["']
    ts:
      - customVariableGetter\(\s*["']([^"']*)["']
    jsx:
      - customVariableHook\(\s*["']([^"']*)["']
      - customVariableGetter\(\s*["']([^"']*)["']
    tsx:
      - customVariableHook\(\s*["']([^"']*)["']
      - customVariableGetter\(\s*["']([^"']*)["']

Capturing with or without quotes

Match patterns can capture variable keys with or without quotes, which affects whether aliases are needed:

With quotes:

yml
# Pattern captures the key including surrounding quotes
- dvcClient\.variable\(\s*(["'][^"']*["'])\s*,
  • Matches: dvcClient.variable('my-variable', default)
  • Captures: 'my-variable' (with quotes)

Without quotes (aliases or generated constants required):

yml
# Pattern strips quotes, capturing only the content
- dvcClient\.variable\(\s*["']([^"']*)["']
  • Matches: dvcClient.variable('my-variable', default)
  • Captures: my-variable

Match patterns can also be passed directly to relevant commands using the --match-pattern flag:

bash
dvc usages --match-pattern ts="customVariableGetter\(\s*["']([^"']*)["']" js="customVariableGetter\(\s*["']([^"']*)["']"

When testing your regex the --show-regex flag can be helpful. This will print all patterns used to find matches in your codebase.

bash
dvc usages --show-regex

Custom Wrapper Functions

If you use wrapper functions around the SDK, add patterns for them.

Example: Custom wrapper functions

yml
codeInsights:
  matchPatterns:
    ts:
      # Matches: getFeatureFlag('my-variable', defaultValue)
      - getFeatureFlag\(\s*([^,)]*)\s*,
      # Matches: isFeatureEnabled('my-variable')
      - isFeatureEnabled\(\s*([^,)]*)\s*\)
    tsx:
      # Matches: useFeatureFlag('my-variable', defaultValue)
      - useFeatureFlag\(\s*([^,)]*)\s*,

安装

TypingMind
{
  "mcpServers": {
    "devcycle": {
      "url": "https://mcp.devcycle.com/sse"
    }
  }
}

将 DevCycle MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 DevCycle 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过远程托管的 MCP 服务器 URL 在 TypingMind 中连接。

添加 MCP 服务器 URL

如果 DevCycle 已托管在远程服务器上,或您的团队希望让多个用户共用一个连接器,请选择此方式。

1

打开 MCP 连接器

在 TypingMind 中,前往“插件”,打开“MCP 连接器”,然后选择“添加 URL”。

  1. 在您的浏览器中打开 TypingMind。
  2. 进入“插件”。
  3. 打开“MCP 连接器”。
  4. 点击“添加 URL”。
TypingMind 的“添加自定义 MCP 服务器 URL”表单
2

粘贴服务器 URL

在“服务器 URL”字段中输入 https://mcp.devcycle.com/sse。根据服务器要求,添加连接名称、描述、图标、自定义 HTTP 请求头或 OAuth 客户端设置。

  1. 将 https://mcp.devcycle.com/sse 粘贴到“服务器 URL”字段中。
  2. 为 DevCycle 输入连接名称。
  3. 您可以添加描述和图标,以便更容易识别此连接。
  4. 如果服务器需要身份验证,请添加自定义 HTTP 请求头或 OAuth 客户端信息。
3

创建连接

点击“创建连接”,然后返回插件列表,确认新的 MCP 连接显示为“有效”。

  1. 点击“创建连接”。
  2. 返回 MCP 连接器列表。
  3. 确认 DevCycle 连接显示为“有效”。
  4. 如果连接未立即出现,请刷新插件列表。
4

切换模型,无需重新连接

使用您偏好的模型开始聊天,在“插件”中启用 DevCycle 工具,并根据需要随时切换到其他模型。该 MCP 连接在 TypingMind 工作区中仍然可用。

  1. 在 TypingMind 中开始新聊天。
  2. 选择您想使用的 AI 模型。
  3. 在“插件”中启用 DevCycle 工具。
  4. 需要时,请让模型使用该工具。
  5. 切换到其他 AI 模型,继续使用同一个 MCP 连接。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 DevCycle 帮我完成这项任务吗?
DevCycle
当然。我已阅读。
以下是我使用 DevCycle 得到的结果。

常见问题

DevCycle MCP 服务器有什么用途?

DevCycle 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 DevCycle MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 DevCycle,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 DevCycle MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 DevCycle 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 DevCycle MCP 连接到 TypingMind?

在 TypingMind 中添加 DevCycle 托管的 MCP 服务器 URL,即可连接。如果您希望在 TypingMind 工作区中使用远程 MCP 连接,这种方式很适合。

DevCycle MCP 在 TypingMind 中提供哪些工具?

DevCycle 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 DevCycle MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 DevCycle 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇