@gaffer-sh/mcp 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +86 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1612 -1190
- package/dist/index.js.map +1 -0
- package/package.json +6 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Gaffer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -85,6 +85,13 @@ Add to `.cursor/mcp.json` in your project:
|
|
|
85
85
|
| `get_flaky_tests` | Get tests with high flip rates (pass↔fail) |
|
|
86
86
|
| `get_slowest_tests` | Get slowest tests by P95 duration |
|
|
87
87
|
| `compare_test_metrics` | Compare test performance between commits |
|
|
88
|
+
| `get_failure_clusters` | Group failed tests by root cause (error similarity) |
|
|
89
|
+
|
|
90
|
+
### Upload & Status Tools
|
|
91
|
+
|
|
92
|
+
| Tool | Description |
|
|
93
|
+
|------|-------------|
|
|
94
|
+
| `get_upload_status` | Check if CI results are uploaded and processed |
|
|
88
95
|
|
|
89
96
|
### Coverage Tools
|
|
90
97
|
|
|
@@ -209,6 +216,79 @@ Find code areas with both low coverage AND test failures (high risk).
|
|
|
209
216
|
- **Returns:** Risk areas ranked by score, with file path, coverage %, failure count
|
|
210
217
|
- **Example:** "Where should we focus our testing efforts?"
|
|
211
218
|
|
|
219
|
+
### `get_failure_clusters`
|
|
220
|
+
|
|
221
|
+
Group failed tests by root cause using error message similarity.
|
|
222
|
+
|
|
223
|
+
- **Input:** `projectId` (required), `testRunId` (required)
|
|
224
|
+
- **Returns:** Clusters of failed tests grouped by similar error messages, with representative error and test count
|
|
225
|
+
- **Example:** "Are these 15 failures from the same bug?"
|
|
226
|
+
|
|
227
|
+
### `get_upload_status`
|
|
228
|
+
|
|
229
|
+
Check if CI results have been uploaded and processed.
|
|
230
|
+
|
|
231
|
+
- **Input:** `projectId` (required), `sessionId` (optional), `commitSha` (optional), `branch` (optional)
|
|
232
|
+
- **Returns:** Upload session(s) with processing status, linked test runs and coverage reports
|
|
233
|
+
- **Example:** "Are my test results ready for commit abc123?"
|
|
234
|
+
|
|
235
|
+
## Agentic CI Workflows
|
|
236
|
+
|
|
237
|
+
These workflows show how an AI agent can use Gaffer tools to diagnose CI failures, wait for results, and find coverage gaps.
|
|
238
|
+
|
|
239
|
+
### Workflow: Diagnose CI Failures
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
list_test_runs(projectId, status="failed")
|
|
243
|
+
→ get_test_run_details(projectId, testRunId, status="failed")
|
|
244
|
+
→ get_failure_clusters(projectId, testRunId)
|
|
245
|
+
→ get_test_history(projectId, testName="...")
|
|
246
|
+
→ compare_test_metrics(projectId, testName, beforeCommit, afterCommit)
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
1. Find the failed test run
|
|
250
|
+
2. Get individual failure details with stack traces
|
|
251
|
+
3. Group failures by root cause — often 15 failures are 2-3 bugs
|
|
252
|
+
4. Check if each failure is new (regression) or recurring
|
|
253
|
+
5. Verify fixes by comparing before/after
|
|
254
|
+
|
|
255
|
+
### Workflow: Wait for Results
|
|
256
|
+
|
|
257
|
+
```
|
|
258
|
+
get_upload_status(projectId, commitSha="abc123")
|
|
259
|
+
→ poll until processingStatus="completed"
|
|
260
|
+
→ get_test_run_details(projectId, testRunId)
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
1. Check if results for a commit have been uploaded
|
|
264
|
+
2. Wait for processing to complete
|
|
265
|
+
3. Use linked test run IDs to get results
|
|
266
|
+
|
|
267
|
+
### Workflow: Find Coverage Gaps
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
find_uncovered_failure_areas(projectId)
|
|
271
|
+
→ get_untested_files(projectId)
|
|
272
|
+
→ get_coverage_for_file(projectId, filePath="src/critical/")
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
1. Find files with both low coverage and test failures (highest risk)
|
|
276
|
+
2. Find files with no coverage at all
|
|
277
|
+
3. Drill into specific directories for targeted analysis
|
|
278
|
+
|
|
279
|
+
### Tool Quick Reference
|
|
280
|
+
|
|
281
|
+
| Agent Question | Tool |
|
|
282
|
+
|---|---|
|
|
283
|
+
| "What failed?" | `get_test_run_details` |
|
|
284
|
+
| "Same root cause?" | `get_failure_clusters` |
|
|
285
|
+
| "Is it flaky?" | `get_flaky_tests` |
|
|
286
|
+
| "Is this new?" | `get_test_history` |
|
|
287
|
+
| "Did my fix work?" | `compare_test_metrics` |
|
|
288
|
+
| "Are results ready?" | `get_upload_status` |
|
|
289
|
+
| "What's untested?" | `find_uncovered_failure_areas` |
|
|
290
|
+
| "What's slow?" | `get_slowest_tests` |
|
|
291
|
+
|
|
212
292
|
## Prioritizing Coverage Improvements
|
|
213
293
|
|
|
214
294
|
When using coverage tools to improve your test suite, combine coverage data with codebase exploration for best results:
|
|
@@ -268,16 +348,18 @@ Project Upload Tokens (`gfr_` prefix) are designed for uploading test results an
|
|
|
268
348
|
## Local Development
|
|
269
349
|
|
|
270
350
|
```bash
|
|
271
|
-
# From monorepo root
|
|
272
351
|
pnpm install
|
|
273
|
-
pnpm
|
|
352
|
+
pnpm build
|
|
353
|
+
```
|
|
274
354
|
|
|
275
|
-
|
|
355
|
+
Test locally with Claude Code (use absolute path to built file):
|
|
356
|
+
|
|
357
|
+
```json
|
|
276
358
|
{
|
|
277
359
|
"mcpServers": {
|
|
278
360
|
"gaffer": {
|
|
279
361
|
"command": "node",
|
|
280
|
-
"args": ["/path/to/
|
|
362
|
+
"args": ["/absolute/path/to/dist/index.js"],
|
|
281
363
|
"env": {
|
|
282
364
|
"GAFFER_API_KEY": "gaf_..."
|
|
283
365
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export {
|
|
2
|
+
export { };
|