Gaffer README

The full upstream README, mirrored for reference. Install config, tool schemas, adoption signals and our own overview live on the Gaffer listing page.

Gaffer MCP server

Give your AI assistant memory of your tests. The Gaffer MCP server connects Claude Code, claude.ai, Claude Desktop, Cursor and any other MCP client to your test history, flaky tests, failure clusters and coverage.

It is hosted at https://app.gaffer.sh/mcp (Streamable HTTP). There is nothing to install. Full guide: gaffer.sh/docs/mcp.

  • Sign in with OAuth, or send a gaf_ user key or gfr_ project token as Authorization: Bearer <key>.
  • execute_code runs in an isolated sandbox with no network access.
  • Each credential is limited to 1,000 requests per hour. A request without a valid credential gets a 401; one over the limit gets a 429 with Retry-After.

You need a Gaffer account with test results uploaded. Keys are under Account Settings > API Keys.

Moving from npx -y @gaffer-sh/mcp? The local npm package is deprecated. Replace the command, args and env block in your MCP config with the hosted url and Authorization header shown below. Existing installs keep working in the meantime.

Sign in, no key

Claude Code, claude.ai and Claude Desktop sign in with OAuth. You do not create an API key.

Claude Code

Terminal
claude mcp add --transport http gaffer https://app.gaffer.sh/mcp

Then run /mcp inside Claude Code, select gaffer, and finish the sign-in in your browser.

claude.ai and Claude Desktop

  1. Open Customize > Connectors, click + Add, then Add custom connector. On Team and Enterprise plans an owner adds it under Organization settings > Connectors, and each member then clicks Connect.
  2. Enter a name and https://app.gaffer.sh/mcp as the URL, then click Add and sign in to Gaffer.
  3. On the consent page, pick the organization to connect and approve.

Anthropic's steps for custom connectors are the reference if the menu names change.

Share it with your team

Commit this .mcp.json at the root of your repository. It holds no secret. Each teammate signs in once with /mcp and Claude Code asks them to approve the project server first.

config.json
{
  "mcpServers": {
    "gaffer": {
      "type": "http",
      "url": "https://app.gaffer.sh/mcp"
    }
  }
}

What signing in grants

  • Access to one organization, the one you pick on the consent page. To use another organization, connect again and pick it.
  • Read access only. A signed-in assistant can read test runs, failures, flaky tests and coverage. It cannot call upload_test_results.
  • The same limit of 1,000 requests per hour, counted per connected app.

To revoke access, open Account Settings > AI assistants at app.gaffer.sh/account/ai-assistants and click Disconnect next to the app under Connected apps.

With an API key

Use a key for CI, Cursor, or if you prefer one. A key can also upload results.

Claude Code:

Terminal
claude mcp add --transport http gaffer https://app.gaffer.sh/mcp --header "Authorization: Bearer gaf_YOUR_KEY"

Cursor: add to .cursor/mcp.json in your project, or ~/.cursor/mcp.json for every project:

config.json
{
  "mcpServers": {
    "gaffer": {
      "url": "https://app.gaffer.sh/mcp",
      "headers": {
        "Authorization": "Bearer gaf_YOUR_KEY"
      }
    }
  }
}

How this server works

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 toolWhat it does
execute_codeRun JavaScript against codemode.<function>(). Max 20 API calls, 30s timeout.
search_toolsFind available functions by keyword. An empty query lists all of them.
list_projectsList projects. Registered for a user API Key (gaf_) and for sign-in, not for a project token (gfr_).
server.ts
const health = await codemode.get_project_health({ projectId: "proj_abc" });
if (health.flakyTestCount > 0) {
  const flaky = await codemode.get_flaky_tests({ projectId: "proj_abc" });
  return { health, flaky };
}
return { health };

Functions available via execute_code

FunctionCategoryDescription
get_project_healthhealthHealth score, pass rate, flaky count, trend
get_test_historytestingPass/fail history for a specific test
get_flaky_teststestingTests that fail some runs and pass others
list_test_runstestingRecent test runs, filterable by commit/branch/status
get_test_run_detailstestingParsed individual results for one run
get_failure_clusterstestingFailed tests grouped by root cause
get_slowest_teststestingSlowest tests by P95 duration
compare_test_metricstestingCompare test performance between commits or runs
search_failurestestingSearch failures by error or test-name pattern, or list all recent failures
get_coverage_summarycoverageOverall coverage metrics and trend
get_coverage_for_filecoverageCoverage for specific files or paths
get_untested_filescoverageFiles below a coverage threshold
find_uncovered_failure_areascoverageFiles with low coverage AND test failures
get_reportreportsReport file URLs for a test run
get_test_run_logsreportsList a run's attached log files, or read one a page at a time with a text filter
get_report_browser_urlreportsSigned browser-navigable report URL (30 min)
get_upload_statusuploadsWhether CI results are uploaded and processed
upload_test_resultsuploadsUpload test results (write) — rate-limited and audit-logged

Every function except upload_test_results is read-only.

Authentication

There are three credentials.

CredentialPrefixScopeWhat it can do
OAuth sign-innoneOne organization, chosen at sign-inRead functions only. No upload_test_results. list_projects lists that organization's projects.
User API keygaf_Every project your account can reachRead functions, plus upload_test_results. list_projects lists projects in every organization you belong to.
Project tokengfr_One projectRead functions and upload_test_results for that project. Omit projectId.

Registry

This repository holds the MCP registry entry sh.gaffer/mcp (server.json). Pushing a change to server.json on main publishes it.

License

MIT