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 orgfr_project token asAuthorization: Bearer <key>. execute_coderuns 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 a429withRetry-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 thecommand,argsandenvblock in your MCP config with the hostedurlandAuthorizationheader 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
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
- 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.
- Enter a name and
https://app.gaffer.sh/mcpas the URL, then click Add and sign in to Gaffer. - 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.
{
"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:
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:
{
"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 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 for a user API Key (gaf_) and for sign-in, not for a project token (gfr_). |
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
| 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 that fail some runs and pass others |
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_test_run_logs | reports | List a run's attached log files, or read one a page at a time with a text filter |
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.
Authentication
There are three credentials.
| Credential | Prefix | Scope | What it can do |
|---|---|---|---|
| OAuth sign-in | none | One organization, chosen at sign-in | Read functions only. No upload_test_results. list_projects lists that organization's projects. |
| User API key | gaf_ | Every project your account can reach | Read functions, plus upload_test_results. list_projects lists projects in every organization you belong to. |
| Project token | gfr_ | One project | Read 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