C

CircleCI MCP Server

Manage CircleCI pipelines and debug build failures through MCP. View build logs, rerun failed jobs, analyze test results, and get AI-assisted fix suggestions for common CI/CD failures.

MCPCommunitydevopsv1.0.0MIT
0 views0 copies

MCP Server Configuration

Add to .claude/settings.json:

{ "mcpServers": { "circleci": { "command": "npx", "args": ["-y", "@circleci/mcp-server-circleci"], "env": { "CIRCLECI_TOKEN": "${CIRCLECI_TOKEN}" } } } }

Available Tools

ToolDescription
get-pipeline-statusCheck the status of a pipeline by ID or project
get-build-logsRetrieve logs for a specific job/step
get-test-resultsGet test results with failure details
rerun-workflowRerun a failed workflow (full or from-failed)
list-pipelinesList recent pipelines for a project
get-configRetrieve the processed CircleCI config for a pipeline
get-artifactsDownload build artifacts from a job

Common Workflows

Diagnose Build Failure

1. list-pipelines β†’ find the failing pipeline
2. get-pipeline-status β†’ identify which job failed
3. get-build-logs β†’ read the failure output
4. Analyze the error and suggest a fix
5. After fix is committed, rerun-workflow from-failed

Test Failure Analysis

1. get-test-results β†’ get all failing test names and messages
2. Cross-reference with local code to identify the root cause
3. Suggest specific code fixes
4. Verify fix locally, then push and monitor pipeline

CircleCI Config Best Practices

# .circleci/config.yml version: 2.1 orbs: node: circleci/[email protected] docker: circleci/[email protected] jobs: test: docker: - image: cimg/node:20.11 - image: cimg/postgres:16.2 # Service container environment: POSTGRES_DB: test_db POSTGRES_PASSWORD: test resource_class: medium steps: - checkout - node/install-packages: cache-path: node_modules pkg-manager: npm - run: name: Run tests command: npm test -- --ci --coverage - store_test_results: path: test-results # Required for test insights - store_artifacts: path: coverage build: docker: - image: cimg/node:20.11 steps: - checkout - node/install-packages - run: npm run build - persist_to_workspace: root: . paths: [dist] workflows: build-and-test: jobs: - test - build: requires: [test] - deploy: requires: [build] filters: branches: only: main

Common Failure Patterns & Fixes

Error PatternLikely CauseFix
ENOMEM / OOM killedInsufficient memoryUpgrade resource_class to large
npm ERR! cacheCorrupted cacheClear cache: add - run: npm cache clean --force
ETIMEOUT on installNetwork issuesAdd retry logic or use orb with built-in retry
Flaky test failuresNon-deterministic testsRun with --retry 2, fix test isolation
Docker pull rate limitDocker Hub limitsUse docker/docker-login orb with credentials

Setup

  1. Generate a CircleCI personal API token at https://app.circleci.com/settings/user/tokens
  2. Set the environment variable:
    export CIRCLECI_TOKEN="your-token-here"
  3. Add the MCP configuration to .claude/settings.json

Security Notes

  • The CircleCI token grants access to all projects you have access to -- use project-scoped tokens when possible
  • Build logs may contain sensitive environment variables -- review before sharing
  • The MCP server only reads data and reruns workflows -- it cannot modify your config or settings
  • Store the token in your shell profile or a secrets manager, never in version control
Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates