# Gaffer [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/gaffer-sh/mcp  
**GitHub Stars:** 1  
**npm Downloads (last month):** 1147  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/gaffer

## Description
Test analytics for AI agents: test history, flaky tests, failure clusters, coverage.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "gaffer": {
    "command": "npx",
    "args": ["-y","@gaffer-sh/mcp"],
    "env": {
      "GAFFER_API_KEY": ""
    }
  }
}
```

**Requires environment variables:** `GAFFER_API_KEY` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What Gaffer does

Gaffer connects an AI coding assistant to data stored in Gaffer. The assistant can inspect project health, pass rates, trends, flaky tests, individual test histories, recent runs, failure patterns, test durations, coverage, report links, and upload processing status. These capabilities help an agent investigate unstable tests, understand recurring failures, compare metrics across commits or runs, and locate files that need more tests.

The function set contains 17 operations. Sixteen are read-only analytics or reporting functions. `upload_test_results` is the only write operation and sends test results to Gaffer for processing. Access to projects and data is controlled by the selected organization, API key, or project token permissions.

## How it works

The server uses code mode rather than publishing one MCP tool for every Gaffer API operation. Its three MCP tools are `execute_code`, `search_tools`, and `list_projects`. `execute_code` runs JavaScript that calls functions in the `codemode` namespace, allowing one execution to combine related queries. Each execution can make up to 20 API calls and runs with a 30-second timeout.

For example, an agent can retrieve project health and then request flaky tests only when the health response reports a nonzero flaky-test count. `search_tools` finds namespace functions by keyword, while an empty search lists them. `list_projects` returns accessible projects for user API keys and signed-in connections, but not for project tokens.

The hosted service is available at `https://app.gaffer.sh/mcp` over Streamable HTTP and accepts POST requests. OAuth sign-in provides read-only access to one selected organization. An API key can also authenticate the hosted endpoint and enables the upload function. Hosted requests are limited to 1,000 per hour per credential or connected app.

## Setup and configuration

A Gaffer account with uploaded test results is required. For the hosted option, connect the endpoint from Claude Code, claude.ai, or Claude Desktop and complete the browser sign-in flow. With an API key, send an `Authorization: Bearer gaf_YOUR_KEY` header; this is the option documented for Cursor, CI, and other API-key workflows.

The local option runs the `@gaffer-sh/mcp` npm package through `npx` and communicates over stdio. Set `GAFFER_API_KEY` in the MCP client's environment, then configure the command as `npx -y @gaffer-sh/mcp`. Claude Code, Cursor, and Claude Desktop configuration examples use this arrangement. Node.js must be installed for the local package.

The hosted endpoint can be shared in a project configuration without storing a secret when users authenticate individually. Each signed-in connection can read data only from its selected organization. Access can be revoked from Gaffer's AI assistant account settings.

## Tools and capabilities

Functions available through `execute_code` include:

- `get_project_health` for health score, pass rate, flaky count, and trends
- `get_test_history`, `get_flaky_tests`, `list_test_runs`, and `get_test_run_details` for test analysis
- `get_failure_clusters`, `search_failures`, and `get_slowest_tests` for debugging and performance review
- `compare_test_metrics` for comparisons between commits or runs
- `get_coverage_summary`, `get_coverage_for_file`, and `get_untested_files` for coverage analysis
- `find_uncovered_failure_areas` to find low-coverage files that also have test failures
- `get_report` and `get_report_browser_url` for test report access
- `get_upload_status` and `upload_test_results` for CI result processing

Time-range parameters default to 30 days and accept up to 365 days. Gaffer reduces the requested range to the plan's analytics window: 30 days on Free, 90 on Pro, and 180 on Team. Report browser URLs are signed and remain usable for 30 minutes.

## Limitations and notes

OAuth-connected sessions are read-only, so `upload_test_results` is listed but rejected for those sessions. API-key access is required for uploads. Project tokens beginning with `gfr_` cannot use `list_projects`; user API keys beginning with `gaf_` can list projects across the user's organizations.

The hosted service returns `401` for missing or invalid credentials and `429` after the hourly request limit, including a `Retry-After` header. In hosted code mode, `execute_code` runs in an isolated sandbox without network access. The npm package runs code in a local Node process instead. Larger date ranges do not expand the analytics data beyond the connected Gaffer plan's allowed window.

_Full upstream README: https://allmcps.com/mcp/gaffer/readme_

