com.devcycle/mcp

DevCycle MCP server for feature flag management

18MITother

Install

Config snippet generator goes here (5 client tabs)

README

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](#repo-configuration).

[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/@devcycle/cli.svg)](https://www.npmjs.com/package/@devcycle/cli)
[![License](https://img.shields.io/npm/l/@devcycle/cli.svg)](https://github.com/DevCycleHQ/cli/blob/main/package.json)

<!-- toc -->
* [Command Topics](#command-topics)
* [Pattern captures the key including surrounding quotes](#pattern-captures-the-key-including-surrounding-quotes)
* [Pattern strips quotes, capturing only the content](#pattern-strips-quotes-capturing-only-the-content)
<!-- tocstop -->

## 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](docs/mcp.md).

## CLI Documentation

## Setup

### Install the CLI

Using NPM

```sh-session
$ npm install -g @devcycle/cli
```

Or alternatively, using homebrew

```sh-session
$ 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](docs/login.md#dvc-login-sso), the CLI will retrieve and store an access token, which is valid for 24 hours.

The [`login again` command](docs/login.md#dvc-login-again) 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](docs/organizations.md) 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](docs/repo.md#dvc-repo-init) behaves in the same way as `login sso`, but creates a [repo configuration file](#repo-configuration) and stores the project and organization choices there instead.

### Using Client Credentials

#### Client Credentials in Auth File

Use the [`dvc status` command](docs/status.md#dvc-status) 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](https://oclif.io/docs/config)

If you intend to run the CLI using options that override config file locations, the [`dvc status` command](docs/status.md#dvc-status) command can be run with those options to confirm t