> ## Documentation Index
> Fetch the complete documentation index at: https://confidence.spotify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Use AI with Confidence

> Learn how to use Confidence MCP servers with AI assistants like Claude Code, Cursor, or VS Code to manage flags and analyze experiments.

Confidence provides MCP (Model Context Protocol) servers that enable AI assistants to manage your feature flags and analyze your experiments. Instead of navigating the UI or writing API calls, you can describe what you want in natural language and let your AI assistant handle it.

## What You Can Do with MCP

With Confidence MCP servers, you can:

* Get help with setting up your integration
* Search documentation
* Create and configure feature flags
* Add variants and define schemas
* Set up targeting rules
* Test flag resolution
* Analyze flag usage in your codebase
* Explore and list experiments (A/B tests and rollouts)
* Analyze experiment results

## Before You Begin

To complete this quickstart:

* You need a [Confidence](https://app.confidence.spotify.com) account
* You need an AI assistant that supports MCP: [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [Cursor](https://www.cursor.com/), or VS Code with GitHub Copilot

## Set Up the Documentation MCP Server

The Documentation MCP server gives your AI assistant access to Confidence documentation through semantic search. No authentication required.

<Tabs>
  <Tab title="Claude Code">
    ```bash theme={null}
    claude mcp add --transport http confidence-docs https://mcp.confidence.dev/mcp/docs
    ```
  </Tab>

  <Tab title="Cursor">
    <Steps>
      <Step title="Open the Command Palette">
        Use `Command + Shift + P` (`Ctrl + Shift + P` on Windows) and search for `Open MCP settings`.
      </Step>

      <Step title="Add the server">
        Select **New MCP Server** and add the following to the `mcpServers` JSON:

        ```json theme={null}
        "confidence-docs": "https://mcp.confidence.dev/mcp/docs"
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="VS Code">
    <Steps>
      <Step title="Create the .vscode directory">
        Create a `.vscode` directory in your workspace root if it doesn't exist.
      </Step>

      <Step title="Create mcp.json">
        Create a file named `mcp.json` in the `.vscode` directory.
      </Step>

      <Step title="Add the server configuration">
        Add the `confidence-docs` server to your configuration:

        ```json theme={null}
        {
          "servers": {
            "confidence-docs": { "url": "https://mcp.confidence.dev/mcp/docs" }
          }
        }
        ```
      </Step>

      <Step title="Start the server">
        Click `Start` next to the MCP server name in the JSON file to start it.
      </Step>
    </Steps>
  </Tab>
</Tabs>

## Set Up the Flags MCP Server

The Flags MCP server enables your AI assistant to create and manage feature flags. This server requires authentication.

<Tabs>
  <Tab title="Claude Code">
    ```bash theme={null}
    claude mcp add --transport http confidence-flags https://mcp.confidence.dev/mcp/flags
    ```

    After adding, open Claude Code, run `/mcp` and select `confidence-flags` to authenticate.
  </Tab>

  <Tab title="Cursor">
    <Steps>
      <Step title="Open the Command Palette">
        Use `Command + Shift + P` (`Ctrl + Shift + P` on Windows) and search for `Open MCP settings`.
      </Step>

      <Step title="Add the server">
        Select **New MCP Server** and add the following to the `mcpServers` JSON:

        ```json theme={null}
        "confidence-flags": "https://mcp.confidence.dev/mcp/flags"
        ```
      </Step>

      <Step title="Authenticate">
        Click `Connect` to authenticate.
      </Step>
    </Steps>
  </Tab>

  <Tab title="VS Code">
    <Steps>
      <Step title="Create the .vscode directory">
        Create a `.vscode` directory in your workspace root if it doesn't exist.
      </Step>

      <Step title="Create mcp.json">
        Create a file named `mcp.json` in the `.vscode` directory.
      </Step>

      <Step title="Add the server configuration">
        Add the `confidence-flags` server to your configuration:

        ```json theme={null}
        {
          "servers": {
            "confidence-flags": { "url": "https://mcp.confidence.dev/mcp/flags" }
          }
        }
        ```
      </Step>

      <Step title="Start and authenticate">
        Click `Start` next to the MCP server name in the JSON file and authenticate when prompted.
      </Step>
    </Steps>
  </Tab>
</Tabs>

## Set Up the Experiments MCP Server

The Experiments MCP server enables your AI assistant to explore and analyze A/B tests and rollouts. This server requires authentication.

<Tabs>
  <Tab title="Claude Code">
    ```bash theme={null}
    claude mcp add --transport http confidence-experiments https://mcp.confidence.dev/mcp/experiments
    ```

    After adding, open Claude Code, run `/mcp` and select `confidence-experiments` to authenticate.
  </Tab>

  <Tab title="Cursor">
    <Steps>
      <Step title="Open the Command Palette">
        Use `Command + Shift + P` (`Ctrl + Shift + P` on Windows) and search for `Open MCP settings`.
      </Step>

      <Step title="Add the server">
        Select **New MCP Server** and add the following to the `mcpServers` JSON:

        ```json theme={null}
        "confidence-experiments": "https://mcp.confidence.dev/mcp/experiments"
        ```
      </Step>

      <Step title="Authenticate">
        Click `Connect` to authenticate.
      </Step>
    </Steps>
  </Tab>

  <Tab title="VS Code">
    <Steps>
      <Step title="Create the .vscode directory">
        Create a `.vscode` directory in your workspace root if it doesn't exist.
      </Step>

      <Step title="Create mcp.json">
        Create a file named `mcp.json` in the `.vscode` directory.
      </Step>

      <Step title="Add the server configuration">
        Add the `confidence-experiments` server to your configuration:

        ```json theme={null}
        {
          "servers": {
            "confidence-experiments": { "url": "https://mcp.confidence.dev/mcp/experiments" }
          }
        }
        ```
      </Step>

      <Step title="Start and authenticate">
        Click `Start` next to the MCP server name in the JSON file and authenticate when prompted.
      </Step>
    </Steps>
  </Tab>
</Tabs>

## Create a Feature Flag with AI

This tutorial walks through creating the same header redesign flag as the [Configure a Flag](/docs/quickstarts/configure-flag) quickstart, but using natural language prompts instead of the UI.

### Verify Your Client Exists

The MCP server requires an existing client. List your available clients to find one to use:

> List my available clients in Confidence

If you don't have a client yet, [create one in the Confidence UI](/docs/how-to-guides/manage-clients) before continuing.

### Create a Flag with Schema

Create a flag and define its schema in a single prompt:

> Create a flag called "header-redesign" with a string property "color" and an integer property "size"

Or you can ask it to base the schema of an existing struct in your codebase:

> Create a flag in Confidence with schema as my header-design struct

### Add Variants

Add the variants you want to test:

> Add a variant "default-style" to the header-redesign flag with color "black" and size 14
>
> Add a variant "new-style" to the header-redesign flag with color "blue" and size 16

### Create an Individual Targeting Rule

Set up an individual targeting rule to test a specific variant:

> Create an individual targeting rule on header-redesign for `user_id` `user-test-id` to see the "new-style" variant

### Test Flag Resolution

Verify your configuration works as expected:

> Test resolving header-redesign for a user with `user_id` `user-test-id`

The AI assistant tells you which variant resolves and why.

## Example Prompts for Common Tasks

Use these prompts for everyday flag management:

### Flag Operations

* "List all feature flags in Confidence"
* "Get details about the checkout-flow flag"
* "Create a boolean flag called enable-dark-mode"
* "Add a variant to the signup-experiment flag"

### Targeting and Rules

* "Create an individual targeting rule on checkout-flow for `user_id` `test-user` to see variant 'new-checkout'"
* "Test what variant resolves for checkout-flow with `user_id` `test-user`"

### Documentation and Integration

* "Show how to integrate Confidence with Python"
* "Search documentation for information about A/B testing"
* "Show the React SDK integration guide"

### Codebase Analysis

* "Analyze what flags to clean up in this codebase"
* "Find where the header-redesign flag appears in the code"

### Experiment Analysis

* "List all running experiments"
* "Search for experiments related to checkout"
* "Show me details about the homepage-redesign A/B test"
* "What's the status of the metrics in my onboarding rollout?"

## Related Resources

<CardGroup cols={2}>
  <Card title="Configure a Flag" href="/docs/quickstarts/configure-flag">
    Step-by-step UI tutorial for creating feature flags
  </Card>

  <Card title="MCP Servers Reference" href="/docs/sdks/mcp-servers">
    Complete reference for all MCP tools and capabilities
  </Card>

  <Card title="Migrate to Confidence" href="/docs/migrations/overview">
    Migrate from PostHog, Eppo, Statsig, or Optimizely with AI-powered migration kits
  </Card>

  <Card title="Flags Reference" href="/docs/flags/introduction">
    Deep dive into feature flag concepts and configuration
  </Card>

  <Card title="SDK Integration" href="/docs/sdks/introduction">
    Integrate Confidence SDKs into your application
  </Card>
</CardGroup>
