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
- A Gaffer account with test results uploaded
- 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),testNameorfilePath(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 toget_project_healthGet health metrics (pass rate, flaky count, trends)list_test_runsList recent test runs with optional filteringget_test_run_detailsGet parsed test results for a specific test runget_reportGet report file URLs for a test runget_test_historyGet pass/fail history for a specific testget_flaky_testsGet tests with high flip rates (pass↔fail)Environment Variables
GAFFER_API_KEYrequiredAPI Key from Gaffer Account SettingsConfiguration
{"mcpServers": {"gaffer": {"command": "npx", "args": ["-y", "@gaffer-sh/mcp"], "env": {"GAFFER_API_KEY": "gaf_your_api_key_here"}}}}