@keepsnappy/mcp 0.0.0-stage → 0.1.0-alpha.11
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/README.md +70 -2
- package/dist/keepsnappy-mcp.js +23249 -0
- package/package.json +24 -4
package/README.md
CHANGED
|
@@ -1,3 +1,71 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @keepsnappy/mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
KeepSnappy's MCP server for coding agents (Claude Code and others): it answers "what got slower, where, how sure, why, and
|
|
4
|
+
what do I do" from the performance findings KeepSnappy measured on real phones. Read-only: it never starts a measurement,
|
|
5
|
+
writes or recomputes anything (plan 48 §4).
|
|
6
|
+
|
|
7
|
+
It gives the same answers as the `perflab` CLI (`perflab findings | finding | compare | history | commits | layers`):
|
|
8
|
+
both use this package's API client and answer layout, so a person and an agent read the same words.
|
|
9
|
+
|
|
10
|
+
## Set it up in an app repo (TapIn)
|
|
11
|
+
|
|
12
|
+
1. Ask the KeepSnappy owner for a project key with **read** scope (`bun run create-key -- <org> <app> read` in
|
|
13
|
+
`apps/api`; it refuses an org or app that does not exist). Setup → Keys on the dashboard lists read keys and revokes
|
|
14
|
+
them. A CI key (`run` scope) works too; an SDK key (`ingest`) does not.
|
|
15
|
+
2. Put the key in your shell environment, not in the repo: `export PERFLAB_KEY=pl_rk_…` (for example in `~/.zshenv`).
|
|
16
|
+
3. Add `.mcp.json` at the repo root:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"mcpServers": {
|
|
21
|
+
"perflab": {
|
|
22
|
+
"command": "npx",
|
|
23
|
+
"args": ["-y", "@keepsnappy/mcp"],
|
|
24
|
+
"env": {
|
|
25
|
+
"PERFLAB_KEY": "${PERFLAB_KEY}",
|
|
26
|
+
"PERFLAB_API": "https://perflab-api-864539138788.europe-west1.run.app"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Claude Code expands `${PERFLAB_KEY}` from your environment. `PERFLAB_API` is optional (the hosted API is the default).
|
|
34
|
+
From a KeepSnappy checkout instead of npm: `"command": "bun", "args": ["<perflab>/packages/mcp/src/bin.ts"]`.
|
|
35
|
+
|
|
36
|
+
## Tools
|
|
37
|
+
|
|
38
|
+
| Tool | Answers | API |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| `list_findings` | Whether and when the branch was measured (`measured`: run sets, the newest set of each journey × phone with its commit, word and runs), then what got worse (Worse / Warning) or better, worst first. Filters: `branch` or `main`, `journey`, `phone`, `state` (`present` default, `not-judged`, `resolved`, `all`), `limit` (≤ 200), `offset` (the answer gives `next_offset`). | `GET /v1/findings` |
|
|
41
|
+
| `get_finding` | One finding by id: what changed, where (journey, phone, branch, commit title and author, PR), how sure (runs per side, session spread, measured differently / not blocking, setup notes), why (components that rendered longer with their cause, counts that moved), what to do (a prompt for a coding agent), lifecycle (first and last seen; present, resolved, or not judged when the newest run set did not judge the measure; seen in N PRs). The prompt ends with the finding's id and page. | `GET /v1/findings/:id` |
|
|
42
|
+
| `compare_runs` | Two runs side by side, window by window, and what differs in how they were measured. No statistics. | `GET /v1/compare?a=&b=` |
|
|
43
|
+
| `window_history` | One window (screen, tap, scroll) of a journey on main over time, run by run, with commit titles, plus the findings on it. | `GET /v1/history` |
|
|
44
|
+
| `commits_between` | The commits KeepSnappy measured between two points (run set ids or commit hashes), one entry per commit with its sessions. | `GET /v1/commits` |
|
|
45
|
+
| `explain_layers` | Which of KeepSnappy's layers answers which question, and each layer's certificate (none issued yet). | `GET /v1/layers` |
|
|
46
|
+
|
|
47
|
+
Besides measures, a run in which the phone heated up (iOS thermal state nominal or fair at the start, serious or worse at
|
|
48
|
+
its peak, or critical from a lower state) is a finding of its own (`kind: "heat"`, layer 3), invalid runs included
|
|
49
|
+
(REQ-MET-20). The comparison warning "Phone heats up" is a measure finding whose values are shares of cool-started runs.
|
|
50
|
+
|
|
51
|
+
An empty list is a clean result only when `measured.newest` exists and was judged: the answer's first line says "No
|
|
52
|
+
KeepSnappy measurement on branch X" or "the newest run set was not judged" otherwise. Query parameters the API does not know
|
|
53
|
+
are dropped, not refused (there is no `?commit=` filter).
|
|
54
|
+
|
|
55
|
+
Every tool returns the text the CLI prints and the API's JSON as structured content. Every finding names its layer
|
|
56
|
+
(4 = PR vs main, 5 = main over time), its certificate (null until plan 51 certifies the layer) and its limits.
|
|
57
|
+
|
|
58
|
+
## Words
|
|
59
|
+
|
|
60
|
+
The one word table of `packages/verdicts/src/headline.ts` (REQ-VER-24): **Worse / Warning / Better / No change /
|
|
61
|
+
Can't compare / Not enough data yet**, and "not blocking" as a badge on a Worse measured differently from main
|
|
62
|
+
("Worse (not blocking)"). The evidence ranks likely causes; it does not prove them.
|
|
63
|
+
|
|
64
|
+
## Develop
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
bun install
|
|
68
|
+
bunx vitest run # the server against a fake API serving findings built by the API's own finding module
|
|
69
|
+
bunx tsc --noEmit
|
|
70
|
+
PERFLAB_KEY=… bun src/bin.ts # stdio
|
|
71
|
+
```
|