Test analytics for AI agents: test history, flaky tests, failure clusters, coverage.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
MCP (Model Context Protocol) server for Gaffer - give your AI assistant memory of your tests.
This MCP server connects AI coding assistants like Claude Code and Cursor to your Gaffer test history and coverage data. It runs in code mode: three MCP tools over a namespace of 17 functions β 16 read-only analytics functions plus upload_test_results. It allows AI to:
The easiest way to add the Gaffer MCP server is via the Claude Code CLI:
Alternatively, add to your Claude Code settings (~/.claude.json or project .claude/settings.json):
Add to .cursor/mcp.json in your project:
This server uses code mode. Instead of exposing one MCP tool per API call, it exposes three tools plus a codemode namespace you call from JavaScript. Fewer tool definitions occupy the context window, and a single execution can chain several calls.
| MCP tool | What it does |
|---|---|
execute_code | Run JavaScript against codemode.<function>(). Max 20 API calls, 30s timeout. |
search_tools | Find available functions by keyword. An empty query lists all of them. |
list_projects | List projects. Registered only when the token is a user API Key (gaf_). |
execute_code| Function | Category | Description |
|---|---|---|
get_project_health | health | Health score, pass rate, flaky count, trend |
get_test_history | testing | Pass/fail history for a specific test |
get_flaky_tests | testing | Tests with high flip rates (passβfail) |
list_test_runs | testing | Recent test runs, filterable by commit/branch/status |
get_test_run_details | testing | Parsed individual results for one run |
get_failure_clusters | testing | Failed tests grouped by root cause |
get_slowest_tests | testing | Slowest tests by P95 duration |
compare_test_metrics | testing | Compare test performance between commits or runs |
search_failures | testing | Search failures by error or test-name pattern, or list all recent failures |
get_coverage_summary | coverage | Overall coverage metrics and trend |
get_coverage_for_file | coverage | Coverage for specific files or paths |
get_untested_files | coverage | Files below a coverage threshold |
find_uncovered_failure_areas | coverage | Files with low coverage AND test failures |
get_report | reports | Report file URLs for a test run |
get_report_browser_url | reports | Signed browser-navigable report URL (30 min) |
get_upload_status | uploads | Whether CI results are uploaded and processed |
upload_test_results | uploads | Upload test results (write) β rate-limited and audit-logged |
Every function except upload_test_results is read-only.
list_projectsList all projects you have access to.
organizationId (optional), limit (optional, default: 50)get_project_healthGet the health metrics for a project.
projectId (required), days (optional, default: 30)get_test_historyGet the pass/fail history for a specific test.
projectId (required), testName or filePath (one required), limit (optional)get_flaky_testsGet the list of flaky tests in a project.
projectId (required), threshold (optional, default: 0.1), days (optional), limit (optional)list_test_runsList recent test runs with optional filtering.
projectId (required), commitSha (optional), branch (optional), status (optional), limit (optional)get_test_run_detailsGet parsed test results for a specific test run.
testRunId (required), projectId (required), status (optional filter), limit (optional)get_reportGet URLs for report files uploaded with a test run.
testRunId (required)get_report_browser_urlGet a browser-navigable URL for viewing a test report.
projectId (required), testRunId (required), filename (optional)get_slowest_testsGet the slowest tests in a project, sorted by P95 duration.
projectId (required), days (optional), limit (optional), framework (optional), branch (optional)compare_test_metricsCompare test metrics between two commits or test runs.
projectId (required), testName (required), beforeCommit/afterCommit OR beforeRunId/afterRunIdget_coverage_summaryGet the coverage metrics summary for a project.
projectId (required), days (optional, default: 30)get_coverage_for_fileGet coverage metrics for specific files or paths.
projectId (required), filePath (required - exact or partial match)get_untested_filesGet files with little or no test coverage.
projectId (required), maxCoverage (optional, default: 10%), limit (optional)find_uncovered_failure_areasFind code areas with both low coverage AND test failures (high risk).
projectId (required), days (optional), coverageThreshold (optional, default: 80%)get_failure_clustersGroup failed tests by root cause using error message similarity.
projectId (required), testRunId (required)search_failuresSearch past failures by error message, stack trace, or test name β or list every failure in the window.
query (optional β omit to return all failures), projectId (required for gaf_ keys), searchIn (optional: errors/names/all, default all), days (optional, default: 30), branch (optional), limit (optional, default: 20)truncated when scan caps cut the list shortget_upload_statusCheck if CI results have been uploaded and processed.
projectId (required), sessionId (optional), commitSha (optional), branch (optional)upload_test_resultsUpload structured test results. This is the only function that writes.
Use it when you have results in hand β parsed from CI output or a runner's JSON report β and no Gaffer CLI is available to upload them.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/gaffer)<a href="https://allmcps.com/mcp/gaffer"><img src="https://allmcps.com/api/badge/gaffer?style=directory" alt="Gaffer on AllMCPs" /></a>