
Product
PHP and Composer Support Is Now in Beta
Socket’s PHP and Composer support is now in Beta for all customers, with PHP reachability analysis generally available.
@gaffer-sh/mcp
Advanced tools
MCP server for Gaffer test history - give your AI assistant memory of your tests
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 16 analytics functions. It allows AI to:
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
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"
}
}
}
}
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"
}
}
}
}
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_). |
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 };
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 |
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)These workflows show how an AI agent diagnoses CI failures, waits for results, and finds coverage gaps. Each step is a codemode function, so a whole chain runs inside one execute_code call rather than one round-trip per step.
list_test_runs(projectId, status="failed")
→ get_test_run_details(projectId, testRunId, status="failed")
→ get_failure_clusters(projectId, testRunId)
→ get_test_history(projectId, testName="...")
→ compare_test_metrics(projectId, testName, beforeCommit, afterCommit)
get_upload_status(projectId, commitSha="abc123")
→ poll until processingStatus="completed"
→ get_test_run_details(projectId, testRunId)
find_uncovered_failure_areas(projectId)
→ get_untested_files(projectId)
→ get_coverage_for_file(projectId, filePath="src/critical/")
| Agent Question | Function |
|---|---|
| "What failed?" | get_test_run_details |
| "Same root cause?" | get_failure_clusters |
| "Seen this error before?" | search_failures |
| "Is it flaky?" | get_flaky_tests |
| "Is this new?" | get_test_history |
| "Did my fix work?" | compare_test_metrics |
| "Are results ready?" | get_upload_status |
| "What's untested?" | find_uncovered_failure_areas |
| "What's slow?" | get_slowest_tests |
When using coverage tools to improve your test suite, combine coverage data with codebase exploration for best results:
Before targeting files purely by coverage percentage, explore which code is actually critical:
Low coverage alone doesn't indicate priority. Consider:
find_uncovered_failure_areas for thisThe get_untested_files tool may return many frontend components. For backend or specific areas:
# Query specific paths with get_coverage_for_file
get_coverage_for_file(filePath="server/services")
get_coverage_for_file(filePath="src/api")
get_coverage_for_file(filePath="lib/core")
get_coverage_summaryget_coverage_for_file on critical pathsUser API Keys (gaf_ prefix) provide read-only access to all projects across your organizations. Get your API Key from: Account Settings > API Keys
Project Tokens (gfr_ prefix) are designed for uploading test results and only provide access to a single project. When you use one, omit projectId — it resolves automatically. User API Keys are preferred for the MCP server because they enable list_projects and read across projects.
| Variable | Required | Description |
|---|---|---|
GAFFER_API_KEY | Yes | Your Gaffer API Key (starts with gaf_) |
GAFFER_API_URL | No | API base URL (default: https://app.gaffer.sh) |
pnpm install
pnpm build
Test locally with Claude Code (use absolute path to built file):
{
"mcpServers": {
"gaffer": {
"command": "node",
"args": ["/absolute/path/to/dist/index.js"],
"env": {
"GAFFER_API_KEY": "gaf_..."
}
}
}
}
MIT
FAQs
MCP server for Gaffer test history - give your AI assistant memory of your tests
The npm package @gaffer-sh/mcp receives a total of 155 weekly downloads. As such, @gaffer-sh/mcp popularity was classified as not popular.
We found that @gaffer-sh/mcp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Product
Socket’s PHP and Composer support is now in Beta for all customers, with PHP reachability analysis generally available.

Product
Socket is bringing experimental protection to Firefox, scanning 97,000+ extensions in Mozilla's official directory for malware and risky updates.

Research
/Security News
Three compromised Rust crates pulled in a malicious dependency that downloaded and executed cross-platform malware during Cargo builds.