execute_codeLABSCO SUMMARY
Three tool definitions instead of seventeen.
Code mode is the point: the functions sit behind a namespace that one execute_code call reaches, so the tool list stays small and a single execution can check project health, branch on the answer, and pull the flaky tests without a round trip in between.
What it is
An MCP server over Gaffer's test history and coverage data. It runs in code mode: three tools plus a namespace of 17 functions called from JavaScript, so few tool definitions occupy the context window and one execution can chain several calls.
What you get
- execute_code runs JavaScript against codemode.<function>(), up to 20 API calls with a 30-second timeout
- search_tools finds available functions by keyword; an empty query lists all of them
- list_projects lists your projects, and is registered only when the token is a user API key
- Test health functions — get_project_health for score, pass rate and trend, get_test_history for one test, get_flaky_tests by flip rate, list_test_runs, get_test_run_details, get_failure_clusters grouped by root cause, get_slowest_tests by P95 duration, compare_test_metrics between commits or runs, search_failures by error or test-name pattern
- Coverage functions — get_coverage_summary, get_coverage_for_file, get_untested_files below a threshold, find_uncovered_failure_areas for files with low coverage and failures at once
- Reports — get_report for a run's report files, get_report_browser_url for a signed browser link valid 30 minutes, get_upload_status for whether CI results have landed
- Every function is read-only except upload_test_results, which is rate-limited and audit-logged
Requirements
The npm package @gaffer-sh/mcp over stdio; one claude mcp add command wires it in. GAFFER_API_KEY is required — either a gaf_ user key or a gfr_ project token from Account Settings under API Keys, and the project-token case does not register list_projects. GAFFER_API_URL overrides the base URL, defaulting to https://app.gaffer.sh. You need a Gaffer account with test results already uploaded.
Setup effort
One command plus a key — npx -y @gaffer-sh/mcp, then supply credentials
USE CASES
Finding out whether a failing test is actually flaky
One execution calls get_flaky_tests and get_test_history, so the flip rate and the run history arrive together.
Understanding what broke in a run
get_failure_clusters groups failures by root cause; get_test_run_details gives the individual results behind them.
Finding untested code that is already failing
find_uncovered_failure_areas returns the files with both low coverage and test failures.
Checking CI actually uploaded results
get_upload_status answers before you go looking for data that was never sent.
Discovering what you can ask for
An empty keyword search lists every available function; project listing needs a user key rather than a project token.
3 tools
Listed in project docs. Your client may show a different list.
search_toolslist_projectsBEFORE YOU INSTALL
What to know first
Tools you get
3 tools named in the project's documentation.
Requires
- npx on PATH
- GAFFER_API_KEY in your environment
Where it runs
All 3 documented setups run the server on your machine.
INSTALLATION
Connect your client
Server setup
npx -y @gaffer-sh/mcpMCP Clients
Claude Code
claude mcp add gaffer -e GAFFER_API_KEY=<YOUR_GAFFER_API_KEY> -- npx -y @gaffer-sh/mcpCursor
{
"mcpServers": {
"gaffer": {
"command": "npx",
"args": [
"-y",
"@gaffer-sh/mcp"
],
"env": {
"GAFFER_API_KEY": "<YOUR_GAFFER_API_KEY>"
}
}
}
}Claude Code — local build
{
"mcpServers": {
"gaffer": {
"command": "node",
"args": [
"<YOUR_PATH_TO_DIST>/index.js"
],
"env": {
"GAFFER_API_KEY": "<YOUR_GAFFER_API_KEY>"
}
}
}
}