Enable AI Agents to fix build failures from CircleCI.
Add to Claude Desktop config.json
{
"mcpServers": {
"circleci-public-mcp-server-circleci": {
"command": "node",
"args": [
"~/.mcp/mcp-server-circleci/index.js"
]
}
}
} Get the source and run locally
git clone https://github.com/CircleCI-Public/mcp-server-circleci.git ~/.mcp/mcp-server-circleci
cd ~/.mcp/mcp-server-circleci Model Context Protocol (MCP) is a new, standardized protocol for managing context between large language models (LLMs) and external systems. In this repository, we provide an MCP Server for CircleCI.
Use Cursor, Windsurf, Copilot, Claude, or any MCP-compatible client to interact with CircleCI using natural language — without leaving your IDE.
| Tool | Description |
|---|---|
analyze_diff | Analyze git diffs against cursor rules for violations |
config_helper | Validate and get guidance for your CircleCI configuration |
create_prompt_template | Generate structured prompt templates for AI applications |
download_usage_api_data | Download usage data from the CircleCI Usage API |
find_flaky_tests | Identify flaky tests by analyzing test execution history |
find_underused_resource_classes | Find jobs with underused compute resources |
get_build_failure_logs | Retrieve detailed failure logs from CircleCI builds |
get_job_test_results | Retrieve test metadata and results for CircleCI jobs |
get_latest_pipeline_status | Get the status of the latest pipeline for a branch |
list_artifacts | List artifacts produced by a CircleCI job |
list_component_versions | List all versions for a CircleCI component |
list_followed_projects | List all CircleCI projects you’re following |
recommend_prompt_template_tests | Generate test cases for prompt templates |
rerun_workflow | Rerun a workflow from start or from the failed job |
run_evaluation_tests | Run evaluation tests on a CircleCI pipeline |
run_pipeline | Trigger a pipeline to run |
run_rollback_pipeline | Trigger a rollback for a project |
Team / centralized deployment: To run one shared remote server for your org (Kubernetes, Docker, etc.) with per-developer or shared CircleCI tokens, see Self-Managed Remote MCP Server.
Prerequisites:
Add the following to your Cursor MCP config:
{
"mcpServers": {
"circleci-mcp-server": {
"command": "npx",
"args": ["-y", "@circleci/mcp-server-circleci@latest"],
"env": {
"CIRCLECI_TOKEN": "your-circleci-token",
"CIRCLECI_BASE_URL": "https://circleci.com",
"MAX_MCP_OUTPUT_LENGTH": "50000"
}
}
}
}
CIRCLECI_BASE_URLis optional — required for on-prem customers only.MAX_MCP_OUTPUT_LENGTHis optional — maximum output length for MCP responses (default: 50000).
Add the following to your Cursor MCP config:
{
"mcpServers": {
"circleci-mcp-server": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"CIRCLECI_TOKEN",
"-e",
"CIRCLECI_BASE_URL",
"-e",
"MAX_MCP_OUTPUT_LENGTH",
"circleci/mcp-server-circleci"
],
"env": {
"CIRCLECI_TOKEN": "your-circleci-token",
"CIRCLECI_BASE_URL": "https://circleci.com",
"MAX_MCP_OUTPUT_LENGTH": "50000"
}
}
}
}
See Self-Managed Remote MCP Server. Use the per-user client configuration and add it to your Cursor MCP config (Cursor Settings → MCP).
Prerequisites:
Add the following to .vscode/mcp.json in your project:
{
"inputs": [
{
"type": "promptString",
"id": "circleci-token",
"description": "CircleCI API Token",
"password": true
},
{
"type": "promptString",
"id": "circleci-base-url",
"description": "CircleCI Base URL",
"default": "https://circleci.com"
}
],
"servers": {
"circleci-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@circleci/mcp-server-circleci@latest"],
"env": {
"CIRCLECI_TOKEN": "${input:circleci-token}",
"CIRCLECI_BASE_URL": "${input:circleci-base-url}"
}
}
}
}
💡 Inputs are prompted on first server start, then stored securely by VS Code.
Add the following to .vscode/mcp.json in your project:
{
"inputs": [
{
"type": "promptString",
"id": "circleci-token",
"description": "CircleCI API Token",
"password": true
},
{
"type": "promptString",
"id": "circleci-base-url",
"description": "CircleCI Base URL",
"default": "https://circleci.com"
}
],
"servers": {
"circleci-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"CIRCLECI_TOKEN",
"-e",
"CIRCLECI_BASE_URL",
"circleci/mcp-server-circleci"
],
"env": {
"CIRCLECI_TOKEN": "${input:circleci-token}",
"CIRCLECI_BASE_URL": "${input:circleci-base-url}"
}
}
}
}
See Self-Managed Remote MCP Server. Use the per-user client configuration in .vscode/mcp.json.
Prerequisites:
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"circleci-mcp-server": {
"command": "npx",
"args": ["-y", "@circleci/mcp-server-circleci@latest"],
"env": {
"CIRCLECI_TOKEN": "your-circleci-token",
"CIRCLECI_BASE_URL": "https://circleci.com",
"MAX_MCP_OUTPUT_LENGTH": "50000"
}
}
}
}
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"circleci-mcp-server": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"CIRCLECI_TOKEN",
"-e",
"CIRCLECI_BASE_URL",
"-e",
"MAX_MCP_OUTPUT_LENGTH",
"circleci/mcp-server-circleci"
],
"env": {
"CIRCLECI_TOKEN": "your-circleci-token",
"CIRCLECI_BASE_URL": "https://circleci.com",
"MAX_MCP_OUTPUT_LENGTH": "50000"
}
}
}
}
See Self-Managed Remote MCP Server. Create a wrapper script as shown in Claude Desktop and CLI clients, then point your claude_desktop_config.json at it.
To find or create your config file, open Claude Desktop settings, click Developer in the left sidebar, then click Edit Config. The config file is located at:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.jsonFor more information: https://modelcontextprotocol.io/quickstart/user
Prerequisites:
claude mcp add circleci-mcp-server -e CIRCLECI_TOKEN=your-circleci-token -- npx -y @circleci/mcp-server-circleci@latest
claude mcp add circleci-mcp-server -e CIRCLECI_TOKEN=your-circleci-token -e CIRCLECI_BASE_URL=https://circleci.com -- docker run --rm -i -e CIRCLECI_TOKEN -e CIRCLECI_BASE_URL circleci/mcp-server-circleci
See Self-Managed Remote MCP Server and the Claude Code client setup there.
Prerequisites:
Add the following to your Windsurf mcp_config.json:
{
"mcpServers": {
"circleci-mcp-server": {
"command": "npx",
"args": ["-y", "@circleci/mcp-server-circleci@latest"],
"env": {
"CIRCLECI_TOKEN": "your-circleci-token",
"CIRCLECI_BASE_URL": "https://circleci.com",
"MAX_MCP_OUTPUT_LENGTH": "50000"
}
}
}
}
Add the following to your Windsurf mcp_config.json:
{
"mcpServers": {
"circleci-mcp-server": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"CIRCLECI_TOKEN",
"-e",
"CIRCLECI_BASE_URL",
"-e",
"MAX_MCP_OUTPUT_LENGTH",
"circleci/mcp-server-circleci"
],
"env": {
"CIRCLECI_TOKEN": "your-circleci-token",
"CIRCLECI_BASE_URL": "https://circleci.com",
"MAX_MCP_OUTPUT_LENGTH": "50000"
}
}
}
}
See Self-Managed Remote MCP Server. Use the per-user client configuration in your Windsurf mcp_config.json.
For more information: https://docs.windsurf.com/windsurf/mcp
Prerequisites:
MCP client configuration in Amazon Q Developer is stored in JSON format in a file named mcp.json. Two levels of configuration are supported:
~/.aws/amazonq/mcp.json — applies to all workspaces.amazonq/mcp.json — specific to the current workspaceIf both files exist, their contents are merged. In case of conflict, the workspace config takes precedence.
Edit ~/.aws/amazonq/mcp.json or create .amazonq/mcp.json with the following:
{
"mcpServers": {
"circleci-local": {
"command": "npx",
"args": [
"-y",
"@circleci/mcp-server-circleci@latest"
],
"env": {
"CIRCLECI_TOKEN": "YOUR_CIRCLECI_TOKEN",
"CIRCLECI_BASE_URL": "https://circleci.com",
"MAX_MCP_OUTPUT_LENGTH": "50000"
},
"timeout": 60000
}
}
}
See Self-Managed Remote MCP Server. Use a wrapper script as shown in Claude Desktop and CLI clients, then register it with q mcp add.
Prerequisites:
Edit ~/.aws/amazonq/mcp.json or create .amazonq/mcp.json with the following:
{
"mcpServers": {
"circleci-local": {
"command": "npx",
"args": [
"-y",
"@circleci/mcp-server-circleci@latest"
],
"env": {
"CIRCLECI_TOKEN": "YOUR_CIRCLECI_TOKEN",
"CIRCLECI_BASE_URL": "https://circleci.com",
"MAX_MCP_OUTPUT_LENGTH": "50000"
},
"timeout": 60000
}
}
}
See Self-Managed Remote MCP Server. Use a wrapper script as shown in Claude Desktop and CLI clients, then add it via the MCP configuration UI:
circleci-remote-mcp)To install CircleCI MCP Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @CircleCI-Public/mcp-server-circleci --client claude
Run the MCP server centrally (for example on Kubernetes or Docker) so your team shares one deployment. Choose how developers authenticate:
| Mode | When to use | Server setup | Client setup | CircleCI audit trail |
|---|---|---|---|---|
| Per-user tokens (recommended) | Teams with SSO-backed Personal API Tokens | REQUIRE_REQUEST_TOKEN=true, no server PAT | Each dev forwards their PAT | Per developer |
| Shared token (interim) | Quick rollout, single service identity OK | CIRCLECI_TOKEN on server, REQUIRE_REQUEST_TOKEN=false (explicit opt-out) | No auth header needed | Single shared identity |
Security: Request authentication is on by default in remote mode. The shared-token mode disables it (
REQUIRE_REQUEST_TOKEN=false), making every caller able to act as the server’sCIRCLECI_TOKENidentity with no credentials. Only enable it on a network you fully trust, and prefer per-user tokens otherwise. Terminating TLS at an ingress provides encryption, not authentication.
Both modes use remote HTTP mode (start=remote). Publish port 8000 (or your chosen port).
Per-user tokens (recommended):
docker run --rm -p 8000:8000 \
-e start=remote \
-e port=8000 \
-e REQUIRE_REQUEST_TOKEN=true \
circleci/mcp-server-circleci
Shared token (interim):
docker run --rm -p 8000:8000 \
-e start=remote \
-e port=8000 \
-e CIRCLECI_TOKEN=your-shared-circleci-pat \
-e REQUIRE_REQUEST_TOKEN=false \
circleci/mcp-server-circleci
Environment variables:
| Variable | Description |
|---|---|
start=remote | Starts the HTTP+SSE MCP server instead of stdio |
port | Listening port inside the container (default: 8000) |
REQUIRE_REQUEST_TOKEN | Reject requests without Authorization: Bearer or Circle-Token header. Defaults to required; set REQUIRE_REQUEST_TOKEN=false to allow unauthenticated requests (shared-token mode) |
CIRCLECI_TOKEN | Shared fallback PAT for all requests when per-user headers are not sent |
CIRCLECI_BASE_URL | Optional — required for on-prem only (default: https://circleci.com) |
DISABLE_TELEMETRY=true | Opt out of usage metrics export |
The server accepts per-request tokens via:
Authorization: Bearer <circleci-pat>Circle-Token: <circleci-pat>If a client sends a header token, it takes precedence over CIRCLECI_TOKEN on the server.
Telemetry metrics recorded during a request are exported using the same token as that request.
Most MCP clients only support local (stdio) processes. Use mcp-remote, a third-party stdio-to-HTTP bridge, to connect them to your remote server.
URL scheme: Use
http://localhost:8000/mcpwith--allow-httpfor local testing. In production, terminate TLS at your ingress/load balancer and usehttps://your-host/mcpwithout--allow-http.
Windows: Avoid spaces around the colon in
--headervalues. Put the fullBearer <token>value in an environment variable.
Security: Examples use
npxfor convenience. For production or team rollouts, pin a specific version in your MCP config (for examplemcp-remote@0.1.38instead ofmcp-remote). Do not use versions below0.1.16(CVE-2025-6514).
Each developer forwards their own CircleCI Personal API Token on every request:
{
"inputs": [
{
"type": "promptString",
"id": "circleci-token",
"description": "CircleCI API Token",
"password": true
}
],
"mcpServers": {
"circleci-mcp-server-remote": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"http://localhost:8000/mcp",
"--allow-http",
"--header",
"Authorization:${AUTH_HEADER}"
],
"env": {
"AUTH_HEADER": "Bearer ${input:circleci-token}"
}
}
}
}
Replace http://localhost:8000/mcp with your team’s server URL. Cursor and VS Code support ${input:...} prompts; other clients can set AUTH_HEADER directly.
When the server has CIRCLECI_TOKEN set and is started with REQUIRE_REQUEST_TOKEN=false (request auth is on by default and must be explicitly disabled), clients do not need to send a token:
{
"mcpServers": {
"circleci-mcp-server-remote": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"http://localhost:8000/mcp",
"--allow-http"
]
}
}
}
Create a wrapper script (e.g. circleci-remote-mcp.sh):
#!/bin/bash
export AUTH_HEADER="Bearer your-circleci-token"
npx mcp-remote http://localhost:8000/mcp --allow-http --header "Authorization:${AUTH_HEADER}"
Make it executable (chmod +x circleci-remote-mcp.sh), then reference it from your MCP config:
{
"mcpServers": {
"circleci-remote-mcp-server": {
"command": "/full/path/to/circleci-remote-mcp.sh"
}
}
}
claude mcp add circleci-mcp-server \
-e AUTH_HEADER="Bearer your-circleci-token" \
-- npx mcp-remote http://localhost:8000/mcp --allow-http --header "Authorization:${AUTH_HEADER}"
Omit --header and AUTH_HEADER when using a shared-token server.
# Health check (no auth required)
curl http://localhost:8000/ping
# Should return 401 when REQUIRE_REQUEST_TOKEN=true and no token is sent
curl -s -o /dev/null -w "%{http_code}\n" -X POST http://localhost:8000/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'
# Should return 200 with a valid Bearer token and MCP Accept headers
curl -s -o /dev/null -w "%{http_code}\n" -X POST http://localhost:8000/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer your-circleci-pat" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'
Example: “Find the latest failed pipeline on my branch and get logs” — see the wiki for more examples.
https://github.com/user-attachments/assets/3c765985-8827-442a-a8dc-5069e01edb74
analyze_diffAnalyzes git diffs against cursor rules to identify rule violations.
Provide:
git diff --cached, git diff HEAD).cursorrules or .cursor/rulesReturns detailed violation reports with confidence scores and explanations.
Useful for:
config_helperAssists with CircleCI configuration tasks by providing guidance and validation.
.circleci/config.yml for syntax and semantic errorscreate_prompt_templateGenerates structured prompt templates for AI-enabled applications based on feature requirements.
download_usage_api_dataDownloads usage data from the CircleCI Usage API for a given organization. Accepts flexible date input (e.g., “March 2025” or “last month”). Cloud-only feature.
Option 1: Start a new export job by providing:
orgId, startDate, endDate (max 32 days), outputDirOption 2: Check/download an existing export job by providing:
orgId, jobId, outputDirReturns a CSV file with CircleCI usage data for the specified time frame.
[!NOTE] Usage data can be fed into the
find_underused_resource_classestool for cost optimization analysis.
find_flaky_testsIdentifies flaky tests in your CircleCI project by analyzing test execution history. Leverages the flaky test detection feature in CircleCI.
This tool can be used in three ways:
Using Project Slug (Recommended):
list_followed_projects to get your projects, then:Using CircleCI Project URL:
Using Local Project Context:
Output modes:
FILE_OUTPUT_DIRECTORY env var): Creates a directory with flaky test detailsfind_underused_resource_classesAnalyzes a CircleCI usage data CSV file to find jobs with average or max CPU/RAM usage below a given threshold (default: 40%).
Provide a CSV file obtained from download_usage_api_data.
Returns a markdown list of underused jobs organized by project and workflow — useful for identifying cost optimization opportunities.
get_build_failure_logsRetrieves detailed failure logs from CircleCI builds. This tool can be used in three ways:
Using Project Slug and Branch (Recommended):
list_followed_projects to get your projects, then:Using CircleCI URLs:
Using Local Project Context:
The tool returns formatted logs including:
get_job_test_resultsRetrieves test metadata for CircleCI jobs, allowing you to analyze test results without leaving your IDE. This tool can be used in three ways:
Using Project Slug and Branch (Recommended):
Using CircleCI URL:
https://app.circleci.com/pipelines/github/org/repo/123/workflows/abc-def/jobs/789https://app.circleci.com/pipelines/github/org/repo/123/workflows/abc-defhttps://app.circleci.com/pipelines/github/org/repo/123Using Local Project Context:
The tool returns:
[!NOTE] Test metadata must be configured in your CircleCI config. See Collect Test Data for setup instructions.
get_latest_pipeline_statusRetrieves the status of the latest pipeline for a given branch. This tool can be used in three ways:
Using Project Slug and Branch (Recommended):
Using CircleCI Project URL:
Using Local Project Context:
Example output:
---
Workflow: build
Status: success
Duration: 5 minutes
Created: 4/20/2025, 10:15:30 AM
Stopped: 4/20/2025, 10:20:45 AM
---
Workflow: test
Status: running
Duration: unknown
Created: 4/20/2025, 10:21:00 AM
Stopped: in progress
list_artifactsRetrieves the list of artifacts produced by a CircleCI job. This tool can be used in three ways:
Using Project Slug and Branch (Recommended):
list_followed_projects to get your projects, then:Using CircleCI URL:
https://app.circleci.com/pipelines/gh/organization/project/123/workflows/abc-def/jobs/789https://app.circleci.com/pipelines/gh/organization/project/123/workflows/abc-defhttps://app.circleci.com/pipelines/gh/organization/project/123Using Local Project Context:
Useful for:
list_component_versionsLists all versions for a specific CircleCI component in an environment. Includes deployment status, commit information, and timestamps.
The tool will prompt you to select the component and environment if not provided.
Useful for:
list_followed_projectsLists all projects that the user is following on CircleCI.
projectSlugExample output:
Projects followed:
1. my-project (projectSlug: gh/organization/my-project)
2. another-project (projectSlug: gh/organization/another-project)
[!NOTE] The
projectSlug(not the project name) is required for many other CircleCI tools.
recommend_prompt_template_testsGenerates test cases for prompt templates to ensure they produce expected results.
rerun_workflowReruns a workflow from its start or from the failed job.
Returns the ID of the newly-created workflow and a link to monitor it.
run_evaluation_testsRuns evaluation tests (also known as “Prompt Tests”) on a CircleCI pipeline. Generates an appropriate CircleCI configuration and triggers a pipeline using it.
This tool can be used in three ways:
Using Project Slug and Branch (Recommended):
list_followed_projects to get your projects, then:Using CircleCI URL:
Using Local Project Context:
The tool accepts prompt template files and returns a URL to monitor the triggered pipeline.
[!NOTE] If the project has multiple pipeline definitions, the tool will return a list of available pipelines for you to choose from.
run_pipelineTriggers a pipeline to run. This tool can be used in three ways:
Using Project Slug and Branch (Recommended):
Using CircleCI URL:
Using Local Project Context:
The tool returns a link to monitor the pipeline execution.
run_rollback_pipelineTriggers a rollback for a CircleCI project. The tool interactively guides you through:
Most common issues:
Clear package caches:
npx clear-npx-cache
npm cache clean --force
Force latest version: Add @latest to your config:
"args": ["-y", "@circleci/mcp-server-circleci@latest"]
Restart your IDE completely (not just reload window)
CIRCLECI_TOKEN in Personal API Tokensecho $CIRCLECI_TOKEN (Mac/Linux) or echo %CIRCLECI_TOKEN% (Windows)CIRCLECI_BASE_URL is https://circleci.comnode --versionnpm --versionHanging processes — kill existing MCP processes:
# Mac/Linux:
pkill -f "mcp-server-circleci"
# Windows:
taskkill /f /im node.exe
Port conflicts: Restart your IDE if the connection seems blocked.
npx @circleci/mcp-server-circleci@latest --helpDEBUG=* npx @circleci/mcp-server-circleci@latestStill need help?
The server supports OpenTelemetry metrics for tracking tool usage. Metrics are exported unless you set DISABLE_TELEMETRY=true. On remote deployments, metrics use the same token as the request (per-user PAT or shared server PAT).
| Metric | Description |
|---|---|
circleci.mcp.tool.invocations | Tool invocation count |
circleci.mcp.tool.duration_ms | Execution time in ms |
circleci.mcp.tool.errors | Error count |
Clone the repository:
git clone https://github.com/CircleCI-Public/mcp-server-circleci.git
cd mcp-server-circleci
Install dependencies:
pnpm install
Build the project:
pnpm build
You can build the Docker container locally using:
docker build -t circleci:mcp-server-circleci .
This will create a Docker image tagged as circleci:mcp-server-circleci that you can use with any MCP client.
Local stdio mode (single developer, token on the client):
docker run --rm -i \
-e CIRCLECI_TOKEN=your-circleci-token \
-e CIRCLECI_BASE_URL=https://circleci.com \
circleci/mcp-server-circleci
Remote mode (centralized server for a team): see Self-Managed Remote MCP Server.
The easiest way to iterate on the MCP Server is using the MCP inspector. You can learn more about the MCP inspector at https://modelcontextprotocol.io/docs/tools/inspector
Start the development server:
pnpm watch # Keep this running in one terminal
In a separate terminal, launch the inspector:
pnpm inspector
Configure the environment:
CIRCLECI_TOKEN to the Environment Variables section in the inspector UIhttps://circleci.com)Run the test suite:
pnpm test
Run tests in watch mode during development:
pnpm test:watch
For more detailed contribution guidelines, see CONTRIBUTING.md
AI-powered task management system for AI-driven development. Features PRD parsing, task expansion, multi-provider support (Claude, OpenAI, Gemini, Perplexity, xAI), and selective tool loading for optimized context usage.
Provide coding agents direct access to Figma data to help them one-shot design implementation.
High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 66 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.
gitmcp.io is a generic remote MCP server to connect to ANY GitHub repository or project for documentation
MCP Server for Android/iOS application and device automation, development and app scraping. Simulator/Emulator/Physical devices like iPhone, Google Pixel, Samsung supported.
Create crafted UI components inspired by the best 21st.dev design engineers.