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

# Set Up Confidence for Your AI Assistant

> Connect Confidence MCP servers to your AI assistant so you can manage flags and analyze experiments in natural language.

Set up AI access to Confidence so you can manage flags, metrics, and
experiments in natural language. You can work with Confidence through AI in
two ways:

* **MCP servers** connect Confidence to the AI assistant in your IDE or
  terminal, such as Claude Code, Codex, Cursor, or VS Code with GitHub Copilot.
* **The Confidence Agent** runs inside the Confidence app and is also
  available in Slack. It needs no setup.

## Choose a Path

| | MCP servers | Confidence Agent |
| - | - | - |
| Where it runs | Your AI assistant, next to your code | The Confidence app and Slack |
| Setup | Add each server to your assistant | None |
| Best for | Creating flags from your code, integrating SDKs, cleaning up flags, creating metrics and event definitions | Creating experiments, analyzing experiments run elsewhere, exploring results, working with your team in Slack |

The Confidence Agent and the MCP servers have different tool sets. For
example, the agent can create experiments and analyze an experiment run
elsewhere, while only the MCP servers create metrics with `createMetric`. More AI
features are coming to both.

## Connect the MCP Servers

Confidence has three public MCP servers:

* **Documentation**: searches and reads the Confidence documentation, including
  SDK integration guides. It needs no authentication.
* **Flags**: creates and manages clients, flags, variants, targeting rules,
  event definitions, assignment tables, metrics, and metric calculations.
* **Experiments**: lists A/B tests and rollouts and reads their results. It
  can't create or change experiments.

The MCP servers can't create entities, fact tables, or dimension tables. Do
those steps in the app or with the API. For every tool on each server, see
[MCP servers](/docs/reference/agent/mcp-servers.md).

### Before You Begin

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

> [!TIP]
>
> If you have the [Confidence CLI](/docs/start/quickstart-cli.md) installed, run
> `confidence mcp install` to skip the manual setup below.

Add each server you want to use to your AI assistant.

### Set Up the Documentation MCP Server

The Documentation MCP server gives your AI assistant access to Confidence documentation. It requires **no authentication**, uses streamable HTTP as the transport, and its URL is `https://confidence.spotify.com/docs/mcp`.

**Claude Code**

```bash theme={null}
claude mcp add --transport http confidence-docs https://confidence.spotify.com/docs/mcp
```

**Codex**

```bash theme={null}
codex mcp add confidence-docs --url "https://confidence.spotify.com/docs/mcp"
```

**Cursor**

**1. Open the Command Palette**

Use `Command + Shift + P` (`Ctrl + Shift + P` on Windows) and search for `Open MCP settings`.

**2. Add the server**

Select **New MCP Server** and add the following to the `mcpServers` JSON:

```json theme={null}
"confidence-docs": "https://confidence.spotify.com/docs/mcp"
```

**VS Code**

**1. Create the .vscode directory**

Create a `.vscode` directory in your workspace root if it doesn't exist.

**2. Create mcp.json**

Create a file named `mcp.json` in the `.vscode` directory.

**3. Add the server configuration**

Add the `confidence-docs` server to your configuration:

```json theme={null}
{
  "servers": {
    "confidence-docs": { "url": "https://confidence.spotify.com/docs/mcp" }
  }
}
```

**4. Start the server**

Click `Start` next to the MCP server name in the JSON file to start it.

### Set Up the Flags MCP Server

The Flags MCP server lets your AI assistant create and manage feature flags. It **requires authentication**, so allow access from the IDE or developer tool where you use it. The server uses streamable HTTP as the transport and its URL is `https://mcp.confidence.dev/mcp/flags`.

**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.

**Codex**

```bash theme={null}
codex mcp add confidence-flags --url https://mcp.confidence.dev/mcp/flags
codex mcp login confidence-flags
```

**Cursor**

**1. Open the Command Palette**

Use `Command + Shift + P` (`Ctrl + Shift + P` on Windows) and search for `Open MCP settings`.

**2. 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"
```

**3. Authenticate**

Click `Connect` to authenticate.

**VS Code**

**1. Create the .vscode directory**

Create a `.vscode` directory in your workspace root if it doesn't exist.

**2. Create mcp.json**

Create a file named `mcp.json` in the `.vscode` directory.

**3. 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" }
  }
}
```

**4. Start and authenticate**

Click `Start` next to the MCP server name in the JSON file and authenticate when prompted.

### Set Up the Experiments MCP Server

The Experiments MCP server lets your AI assistant explore and analyze A/B tests and rollouts. It **requires authentication**, so allow access from the IDE or developer tool where you use it. The server uses streamable HTTP as the transport and its URL is `https://mcp.confidence.dev/mcp/experiments`.

**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.

**Codex**

```bash theme={null}
codex mcp add confidence-experiments --url https://mcp.confidence.dev/mcp/experiments
codex mcp login confidence-experiments
```

**Cursor**

**1. Open the Command Palette**

Use `Command + Shift + P` (`Ctrl + Shift + P` on Windows) and search for `Open MCP settings`.

**2. 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"
```

**3. Authenticate**

Click `Connect` to authenticate.

**VS Code**

**1. Create the .vscode directory**

Create a `.vscode` directory in your workspace root if it doesn't exist.

**2. Create mcp.json**

Create a file named `mcp.json` in the `.vscode` directory.

**3. 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" }
  }
}
```

**4. Start and authenticate**

Click `Start` next to the MCP server name in the JSON file and authenticate when prompted.

### Check the Connection

Ask your assistant a question that each server answers:

```text theme={null}
List my Confidence clients.
List the running experiments in Confidence.
Search the Confidence documentation for how to integrate the React SDK.
```

If the Flags or Experiments server doesn't respond, authenticate it again from
your assistant.

## Use the Confidence Agent

Open the chat in the Confidence app to work with the Confidence Agent. It uses
your account's resources and any connected data and code sources. To organize
work into projects with shared context, see
[Work with the Confidence Agent](/docs/guides/work-with-the-confidence-agent.md).

To ask the agent from a Slack channel or direct message, see
[Use Confidence in Slack](/docs/guides/use-confidence-in-slack.md).

## Example Prompts

Use these prompts with the MCP servers. You can also give most of them to the
Confidence Agent.

### Flags

```text theme={null}
Create a flag called "header-redesign" with a string property "color" and an
integer property "size". Add a variant "default-style" with color "black" and
size 14, and a variant "new-style" with color "blue" and size 16.
```

```text theme={null}
Create a flag in Confidence with the same schema as the HeaderDesign struct.
```

```text theme={null}
Create an individual targeting rule on header-redesign so that user_id
user-test-id gets the "new-style" variant. Then test what resolves for that user.
```

```text theme={null}
Analyze which flags to clean up in this codebase.
```

For the full flag workflow, see [Add a feature flag](/docs/guides/add-a-feature-flag.md).

### Events and Metrics

```text theme={null}
Create a Confidence event definition called "purchase" with a string field
user_id that references the User entity, a double field amount, and a string
field product.
```

```text theme={null}
Create a metric called "Average weekly sales per user" that averages amount
from the sales fact table over one week from exposure.
```

For the full metric workflow, see [Create a metric](/docs/guides/create-your-first-metric.md).

### Experiments

```text theme={null}
List all running experiments.
Show details about the homepage-redesign A/B test.
What's the status of the metrics in the onboarding rollout?
```

### Documentation and Integration

```text theme={null}
Show how to integrate Confidence with Python.
Search the documentation for information about A/B testing.
```

## Related Resources

> **[MCP Servers Reference](/docs/reference/agent/mcp-servers.md)**
>
> Every tool on the Documentation, Flags, and Experiments servers

> **[Work with the Confidence Agent](/docs/guides/work-with-the-confidence-agent.md)**
>
> Use the agent in the app, with projects and global context

> **[Use Confidence in Slack](/docs/guides/use-confidence-in-slack.md)**
>
> Ask the agent from a channel or direct message

> **[Quickstart with the CLI](/docs/start/quickstart-cli.md)**
>
> Set up your project and connect your assistant with one command

> **[Migrate to Confidence](/docs/migrations/overview.md)**
>
> Migrate from PostHog, Eppo, Statsig, or Optimizely with AI-powered migration kits
