Gaffer MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add -e "GAFFER_API_KEY=${GAFFER_API_KEY}" gaffer -- npx -y @gaffer-sh/mcp
Required:GAFFER_API_KEY
README.md

Connects AI coding assistants to Gaffer test history and coverage data

@gaffer-sh/mcp

MCP (Model Context Protocol) server for Gaffer - give your AI assistant memory of your tests.

What is this?

This MCP server connects AI coding assistants like Claude Code and Cursor to your Gaffer test history and coverage data. It allows AI to:

  • Check your project's test health (pass rate, flaky tests, trends)
  • Look up the history of specific tests to understand stability
  • Get context about test failures when debugging
  • Analyze code coverage and identify untested areas
  • Browse all your projects (with user API Keys)
  • Access test report files (HTML reports, coverage, etc.)

Prerequisites

  1. A Gaffer account with test results uploaded
  2. An API Key from Account Settings > API Keys

Setup

Claude Code (CLI)

The easiest way to add the Gaffer MCP server is via the Claude Code CLI:

claude mcp add gaffer -e GAFFER_API_KEY=gaf_your_api_key_here -- npx -y @gaffer-sh/mcp

Claude Code (Manual)

Alternatively, add to your Claude Code settings (~/.claude.json or project .claude/settings.json):

{
  "mcpServers": {
    "gaffer": {
      "command": "npx",
      "args": ["-y", "@gaffer-sh/mcp"],
      "env": {
        "GAFFER_API_KEY": "gaf_your_api_key_here"
      }
    }
  }
}

Cursor

Add to .cursor/mcp.json in your project:

{
  "mcpServers": {
    "gaffer": {
      "command": "npx",
      "args": ["-y", "@gaffer-sh/mcp"],
      "env": {
        "GAFFER_API_KEY": "gaf_your_api_key_here"
      }
    }
  }
}

Available Tools

Project & Test Run Tools

Tool Description
list_projects List all projects you have access to
get_project_health Get health metrics (pass rate, flaky count, trends)
list_test_runs List recent test runs with optional filtering
get_test_run_details Get parsed test results for a specific test run
get_report Get report file URLs for a test run
get_report_browser_url Get a browser-navigable URL for viewing reports

Test Analysis Tools

Tool Description
get_test_history Get pass/fail history for a specific test
get_flaky_tests Get tests with high flip rates (pass↔fail)
get_slowest_tests Get slowest tests by P95 duration
compare_test_metrics Compare test performance between commits
get_failure_clusters Group failed tests by root cause (error similarity)

Upload & Status Tools

Tool Description
get_upload_status Check if CI results are uploaded and processed

Coverage Tools

Tool Description
get_coverage_summary Get overall coverage metrics and trends
get_coverage_for_file Get coverage for specific files or paths
get_untested_files Get files below a coverage threshold
find_uncovered_failure_areas Find files with low coverage AND test failures

Tool Details

`list_projects`

List all projects you have access to.

  • Input: organizationId (optional), limit (optional, default: 50)
  • Returns: List of projects with IDs, names, and organization info
  • Example: "What projects do I have in Gaffer?"

`get_project_health`

Get the health metrics for a project.

  • Input: projectId (required), days (optional, default: 30)
  • Returns: Health score (0-100), pass rate, test run count, flaky test count, trend
  • Example: "What's the health of my test suite?"

`get_test_history`

Get the pass/fail history for a specific test.

  • Input: projectId (required), testName or filePath (one required), limit (optional)
  • Returns: History of runs with status, duration, branch, commit, errors
  • Example: "Is the login test flaky? Check its history"

`get_flaky_tests`

Get the list of flaky tests in a project.

  • Input: projectId (required), threshold (optional, default: 0.1), days (optional), limit (optional)
  • Returns: List of flaky tests with flip rates, transition counts, run counts
  • Example: "Which tests are flaky in my project?"

`list_test_runs`

List recent test runs with optional filtering.

  • Input: projectId (required), commitSha (optional), branch (optional), status (optional), limit (optional)
  • Returns: List of test runs with pass/fail/skip counts, commit and branch info
  • Example: "What tests failed in the last commit?"

`get_test_run_details`

Get parsed test results for a specific test run.

  • Input: testRunId (required), projectId (required), status (optional filter), limit (optional)
  • Returns: Individual test results with name, status, duration, file path, errors
  • Example: "Show me all failed tests from this test run"

`get_report`

Get URLs for report files uploaded with a test run.

  • Input: testRunId (required)
  • Returns: List of files with filename, size, content type, do

Tools (7)

list_projectsList all projects you have access to
get_project_healthGet health metrics (pass rate, flaky count, trends)
list_test_runsList recent test runs with optional filtering
get_test_run_detailsGet parsed test results for a specific test run
get_reportGet report file URLs for a test run
get_test_historyGet pass/fail history for a specific test
get_flaky_testsGet tests with high flip rates (pass↔fail)

Environment Variables

GAFFER_API_KEYrequiredAPI Key from Gaffer Account Settings

Configuration

claude_desktop_config.json
{"mcpServers": {"gaffer": {"command": "npx", "args": ["-y", "@gaffer-sh/mcp"], "env": {"GAFFER_API_KEY": "gaf_your_api_key_here"}}}}

Try it

What is the current health status of my project and are there any recent trends in test failures?
Can you identify which tests are currently considered flaky in my project?
Show me the history of the login test to see if it has been failing recently.
Which files in my project currently have the lowest test coverage?
List the failed tests from the most recent test run.

Frequently Asked Questions

What are the key features of Gaffer?

Track test stability and pass rates over time. Analyze code coverage trends and identify untested areas. Cluster test failures by root cause for easier debugging. Access test report files and browser-navigable URLs. Monitor project health metrics across multiple projects.

What can I use Gaffer for?

Debugging flaky tests by reviewing their historical pass/fail patterns. Identifying untested code areas to prioritize new test development. Quickly triaging CI failures by analyzing test run details within the AI chat. Monitoring the impact of recent commits on overall test suite health.

How do I install Gaffer?

Install Gaffer by running: claude mcp add gaffer -e GAFFER_API_KEY=gaf_your_api_key_here -- npx -y @gaffer-sh/mcp

What MCP clients work with Gaffer?

Gaffer works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Gaffer docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare