> For the complete documentation index, see [llms.txt](https://docs.reflag.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.reflag.com/api/mcp.md). Agents can also search and read this documentation through its [MCP server](https://docs.reflag.com/~gitbook/mcp).

# MCP

Connect Claude Code, Cursor, VS Code or any other MCP client to your Reflag account.

The Reflag MCP server lets your coding agent work with your feature flags. It can create flags, read their targeting and status, check who has access, and change rollouts, all without leaving your editor or terminal.

Reflag hosts the server, so there's nothing to install. It uses HTTP and you sign in with OAuth, so you don't need an API key:

```
https://app.reflag.com/api/mcp
```

## Claude Code

{% stepper %}
{% step %}

#### Add the server

In your project directory, run:

```sh
claude mcp add --transport http Reflag https://app.reflag.com/api/mcp
```

{% hint style="info" %}
Add `--scope project` to save the server to `.mcp.json` in your project. Commit that file and everyone on your team gets Reflag MCP when they open the project in Claude Code.
{% endhint %}
{% endstep %}

{% step %}

#### Sign in

Start `claude`, enter `/mcp`, select **Reflag** and choose **Authenticate**. Finish signing in to Reflag in your browser.
{% endstep %}

{% step %}

#### Start prompting

Try asking Claude Code:

* "List my Reflag flags."
* "Put this change behind a new Reflag flag."
* "Does the company Acme have access to the `new-checkout` flag?"
* "Roll out `new-checkout` to the beta testers segment."
  {% endstep %}
  {% endstepper %}

To have Claude Code flag new work by default, add instructions to your `CLAUDE.md`. See [Claude Code](https://docs.reflag.com/integrations/claude-code.md) for templates.

## Other clients

### Claude Desktop and claude.ai

1. Go to **Customize > Connectors**.
2. Click **+ Add**, then **Add custom connector**.
3. Enter `Reflag` as the name and `https://app.reflag.com/api/mcp` as the URL, then click **Continue**.
4. Keep the detected authentication settings, choose **Sign in now**, and click **Add**.
5. Click **Connect** next to Reflag and sign in to Reflag.

{% hint style="info" %}
On Team and Enterprise plans, an Owner adds the connector in **Organization settings > Connectors**. Each member then clicks **Connect** in **Customize > Connectors** to sign in.
{% endhint %}

### Cursor

[Add Reflag MCP to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=Reflag\&config=eyJ1cmwiOiJodHRwczovL2FwcC5yZWZsYWcuY29tL2FwaS9tY3AiLCJ0eXBlIjoiaHR0cCJ9) with one click, or set it up manually:

1. Go to **Settings > Cursor Settings > MCP**.
2. Click **New MCP Server** and add the Reflag server:

```json
{
  "mcpServers": {
    "Reflag": {
      "url": "https://app.reflag.com/api/mcp"
    }
  }
}
```

{% hint style="info" %}
To set up the server for one project only, add the configuration above to `.cursor/mcp.json` in your project directory.
{% endhint %}

{% embed url="<https://139729605.fs1.hubspotusercontent-eu1.net/hubfs/139729605/Videos/bucketco-website/cursor-mcp-flag-feature_full-height_h264.mp4>" %}

<p align="center">Creating a flag with Reflag MCP in Cursor</p>

### Visual Studio Code

[Add Reflag MCP to VS Code](vscode:mcp/install?%7B%22name%22%3A%22Reflag%22%2C%22gallery%22%3Afalse%2C%22url%22%3A%22https%3A%2F%2Fapp.reflag.com%2Fapi%2Fmcp%22%7D) with one click, or set it up manually:

{% hint style="info" %}
You must enable [Copilot agent mode](https://code.visualstudio.com/docs/copilot/chat/chat-agent-mode) to use MCP in Copilot chat.
{% endhint %}

1. Open the command palette (`Cmd+Shift+P` or `Ctrl+Shift+P`).
2. Select **MCP: Add Server...**.
3. Select **HTTP**.
4. Enter `https://app.reflag.com/api/mcp` as the URL.
5. Enter `Reflag` as the server ID.

{% hint style="info" %}
To set up the server for one project only, add it to `.vscode/mcp.json` in your project directory.
{% endhint %}

### Other MCP clients

Any [MCP client](https://modelcontextprotocol.io/clients) that supports remote HTTP servers with OAuth can connect to `https://app.reflag.com/api/mcp`.

For clients that only support local (stdio) servers, use [mcp-remote](https://www.npmjs.com/package/mcp-remote) as a bridge:

```json
{
  "mcpServers": {
    "Reflag": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://app.reflag.com/api/mcp"]
    }
  }
}
```

### Set up with the Reflag CLI

The [Reflag CLI](https://docs.reflag.com/api/cli.md#setting-up-mcp-with-the-cli) can write the MCP configuration for Cursor and VS Code:

```sh
npx reflag mcp
```

The CLI requires an up-to-date version of [Node.js](https://nodejs.org/en/download).

## Troubleshooting

* **Reflag tools don't show up.** Check that the server is connected: in Claude Code, run `/mcp`; in other clients, open their MCP settings. Then update your client to its latest version.
* **Authentication fails or expires.** Sign in again. In Claude Code, run `/mcp`, select **Reflag** and choose **Authenticate**.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.reflag.com/api/mcp.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
