# CircleCI MCP Server

Connect your AI assistant to your CircleCI data to debug failures, analyze test results, and improve pipelines using natural language.

  

## CI/CD context for AI tools

The CircleCI MCP server makes your build system understandable by AI tools like Cursor, Claude Code, Windsurf, and more. It’s built on the Model Context Protocol (MCP), a lightweight standard that allows LLM-powered agents to fetch structured data from external systems.

By connecting to the CircleCI MCP Server, agents gain real-time visibility into:

*   Build logs and test outputs
*   Pipeline statuses
*   Recent configuration changes
*   Workflow performance metrics

That means instead of digging through job logs or dashboard UIs, you can ask:

```plaintext
why did my last build fail?
```

and get all the context you need to fix the issue and keep moving without breaking stride.

## Turn build data into action

Once installed, the MCP server makes your CI/CD data accessible through natural language. LLM-based tools can:

*   **Diagnose failing builds**  
    Get structured error summaries and logs.
  
*   **Trace failures to recent changes**  
    Connect regressions to commits, diffs, or workflows.
  
*   **Spot flaky tests**  
    Surface instability patterns from test history.
  
*   **Recommend improvements**  
    Suggest config or timing optimizations in context.
  
*   **Bring CI data into your editor**  
    Use LLM tools to reason through builds without switching tabs.

With access to both code and build context, these tools can help you fix bugs faster, ship changes with confidence, and stay focused on the work that matters.

## Recommended setup

**For local editors — use the [CircleCI CLI](https://cli.circleci.com/).** The MCP server is built directly into the CLI, which is the recommended way to connect Cursor, VS Code, Claude Desktop, and similar tools to CircleCI.

**For web-hosted agents like [Claude.ai](https://claude.ai/), or if company policy prefers** — use the hosted MCP server, which connects via OAuth2 and requires no local install.

Both can be active at the same time.

**Note for original local MCP users:** The original local MCP server (installed with `npx` or Docker and a `CIRCLECI_TOKEN`) is deprecated. Remove it from your AI assistant and use one of the options above.

## Get started with MCP

### Prerequisites

**Hosted CircleCI MCP server:**

*   An AI coding assistant / MCP host that supports remote MCP servers over streamable HTTP.
*   If your MCP host cannot complete an OAuth2 flow, a CircleCI personal API token (see [Managing API Tokens](https://circleci.com/docs/guides/toolkit/managing-api-tokens/#creating-a-personal-api-token).

**CircleCI CLI MCP:**

Install the [CircleCI CLI](https://cli.circleci.com/), then run `circleci auth login` or set the `CIRCLE_TOKEN` environment variable.

### Configuration instructions

**Heads up:** The old local MCP server installed with `npx` or Docker and a `CIRCLECI_TOKEN` is deprecated. If your AI assistant still has it configured, remove it before setting up the options below. For example, in Claude Code run `claude mcp remove circleci-mcp-server`.

## Option 1 — Hosted MCP server

CircleCI hosts a remote MCP server at `https://mcp.circleci.com/v1/mcp`. Nothing to install. Authenticate with OAuth2 by signing in with your CircleCI account. If your MCP host cannot complete an OAuth2 flow (for example, headless or automated setups), see the fall back below.

Claude Code

**Authenticate with OAuth2 (recommended):**

1.  Add the server:
    
    ```
    claude mcp add --transport http circleci https://mcp.circleci.com/v1/mcp
    ```
    
2.  Run `/mcp` inside Claude Code and select `circleci`.
3.  Select **Authenticate** to complete the OAuth2 sign-in in your browser.

**Authenticate with a personal API token (fallback):**

```
claude mcp add --transport http circleci https://mcp.circleci.com/v1/mcp \
  --header "Authorization: Bearer <your-circleci-token>"
```

[Claude Code MCP docs](https://code.claude.com/docs/en/mcp)

Claude Desktop & claude.ai

**Authenticate with OAuth2 (recommended):**

1.  Go to **Settings > Connectors**.
2.  Select **Add custom connector**.
3.  Enter `https://mcp.circleci.com/v1/mcp` as the server URL.
4.  Select **Add**, then complete the OAuth2 sign-in in your browser.

[Custom connectors docs](https://support.claude.com/en/articles/11175166-getting-started-with-custom-connectors-using-remote-mcp)

Cursor

**Authenticate with OAuth2 (recommended):**

1.  Use this link to add the server automatically: [Add CircleCI MCP server to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=circleci&config=eyJ1cmwiOiJodHRwczovL21jcC5jaXJjbGVjaS5jb20vdjEvbWNwIn0=). This opens an install prompt in your Cursor settings.
2.  Select **Install**. The server shows a "Needs authentication" label with a Connect button.
3.  Select **Connect** to start the OAuth2 flow in your browser.

Or add this to your Cursor `mcp.json` file:

```
{
  "mcpServers": {
    "circleci": {
      "url": "https://mcp.circleci.com/v1/mcp"
    }
  }
}
```

**Authenticate with a personal API token (fallback):**

```
{
  "mcpServers": {
    "circleci": {
      "url": "https://mcp.circleci.com/v1/mcp",
      "headers": {
        "Authorization": "Bearer <your-circleci-token>"
      }
    }
  }
}
```

[Cursor setup docs](https://cursor.com/docs)

VS Code

**Authenticate with OAuth2 (recommended):**

Use this link to add the server automatically: [Add CircleCI MCP server to VS Code](vscode:mcp/install?%7B%22name%22%3A%22circleci%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.circleci.com%2Fv1%2Fmcp%22%7D).

Or add this to your `.vscode/mcp.json` file:

```
{
  "servers": {
    "circleci": {
      "type": "http",
      "url": "https://mcp.circleci.com/v1/mcp"
    }
  }
}
```

**Authenticate with a personal API token (fallback):**

```
{
  "servers": {
    "circleci": {
      "type": "http",
      "url": "https://mcp.circleci.com/v1/mcp",
      "headers": {
        "Authorization": "Bearer <your-circleci-token>"
      }
    }
  }
}
```

[VS Code setup docs](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)

Windsurf

**Authenticate with OAuth2 (recommended):**

Add this to your Windsurf `mcp_config.json` file:

```
{
  "mcpServers": {
    "circleci": {
      "serverUrl": "https://mcp.circleci.com/v1/mcp"
    }
  }
}
```

**Authenticate with a personal API token (fallback):**

```
{
  "mcpServers": {
    "circleci": {
      "serverUrl": "https://mcp.circleci.com/v1/mcp",
      "headers": {
        "Authorization": "Bearer <your-circleci-token>"
      }
    }
  }
}
```

[Windsurf setup docs](https://docs.windsurf.com/windsurf/cascade/mcp)

Need a personal API token? See [Managing API tokens](https://circleci.com/docs/guides/toolkit/managing-api-tokens/#creating-a-personal-api-token). Treat the token like a password — reference it through an environment variable or secret store where your MCP host supports it. Full instructions: [Connecting to the CircleCI MCP server](https://circleci.com/docs/guides/toolkit/connecting-to-the-circleci-mcp-server/).

## Option 2 — CircleCI CLI MCP (local)

The CircleCI CLI includes a built-in MCP server that runs locally on your machine using your existing CLI authentication. Use this if you prefer a fully local setup.

CircleCI CLI MCP

**Prerequisites:**

*   The [CircleCI CLI](https://circleci.com/docs/guides/toolkit/circleci-cli/) installed.
*   An authenticated CLI session. Run `circleci auth login`, or set the `CIRCLE_TOKEN` environment variable.

**Enable the MCP server for your AI assistant with one command:**

```
circleci mcp claude enable    # Claude Desktop
circleci mcp cursor enable    # Cursor
circleci mcp vscode enable    # VS Code
```

To disable it, replace `enable` with `disable`.

**Start the server manually** over the default stdio transport, or stream it over HTTP:

```
circleci mcp start     # start over stdio
circleci mcp stream    # stream over HTTP
```

[CLI MCP setup docs](https://circleci.com/docs/guides/toolkit/connecting-to-the-circleci-cli-mcp/) · [CLI MCP command reference](https://cli.circleci.com/reference/#circleci-mcp)

## Available tools

Each MCP exposes a different set of tools. The hosted server provides a curated set of CI/CD actions tuned for AI-driven development and agentic workflows, while the CLI MCP exposes the full CircleCI CLI. Whichever you connect, the tools give AI developers structured CI/CD context for faster, more reliable release cycles.

### Hosted MCP server tools

| Tool | Uses |
| --- | --- |
| `analyze_diff` | Catch rule violations in your diff before code review |
| `config_helper` | Fix config issues before they break your pipeline |
| `create_prompt_template` | Generate prompts that support consistent AI behavior |
| `download_usage_api_data` | Export CircleCI usage data for cost and capacity analysis |
| `find_flaky_tests` | Identify and troubleshoot unstable tests |
| `find_underused_resource_classes` | Find jobs with low CPU/RAM utilization for downsizing |
| `get_build_failure_logs` | Debug and resolve failed builds faster |
| `get_job_test_results` | Understand and fix test failures and performance issues |
| `get_latest_pipeline_status` | Monitor and act on pipeline health |
| `list_artifacts` | Find and download artifacts produced by a job |
| `list_component_versions` | View deployed versions and pick rollback targets |
| `list_followed_projects` | Find projects you follow and their `projectSlug` |
| `recommend_prompt_template_tests` | Test and improve prompt reliability |
| `rerun_workflow` | Rerun workflows from the beginning or from a failed job |
| `run_evaluation_tests` | Run prompt evaluation tests on a CircleCI pipeline |
| `run_pipeline` | Trigger builds while staying in your editor |
| `run_rollback_pipeline` | Roll back faulty deployments with a single command |

### CLI MCP tools

The CLI MCP exposes the entire CircleCI CLI as tools, including:

*   **Config authoring** — validate, process, pack, and generate config YAML.
*   **Org and project management** — contexts, env vars, project/org settings.
*   **Orb tooling** — create, publish, validate, and diff orb versions.
*   **Security policy** — push, test, and evaluate Rego policies.
*   **Self-hosted runners** — manage runner resource classes and tokens.
*   **iOS code signing** — manage certificates and signing configs.
*   **Deploy tracking** — list and instrument deploys.
*   **Docker Layer Cache** — purge DLC.
*   **Direct API access** — call the CircleCI API directly via `circleci api`.

## Learn more

Go deeper on the CircleCI MCP with docs, background reading, and the latest platform updates:

*   [CircleCI MCP overview](https://circleci.com/docs/guides/toolkit/circleci-mcp-overview/) – Supported tools, best practices, and how the hosted and CLI MCPs compare.
*   [Connect to the hosted MCP server](https://circleci.com/docs/guides/toolkit/connecting-to-the-circleci-mcp-server/) – The hosted remote server, no install required.
*   [Connect to the CircleCI CLI MCP](https://circleci.com/docs/guides/toolkit/connecting-to-the-circleci-cli-mcp/) – The local MCP built into the CircleCI CLI.
*   [Blog post: What is a remote MCP server?](https://circleci.com/blog/what-is-a-remote-mcp-server/) – Background on remote MCP and why it matters.
*   [Blog post: Rebuilding the CircleCI CLI from scratch](https://circleci.com/blog/rebuilding-the-circleci-cli-from-scratch/) – The story behind the rebuilt CLI that powers the CLI MCP.
*   [CircleCI changelog](https://circleci.com/changelog/) – See the latest platform updates and feature releases.