@mushi-mushi/mcp 0.13.1 → 0.14.1

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.
@@ -0,0 +1,595 @@
1
+ // src/catalog.ts
2
+ var ALL_SCOPES = ["mcp:read", "mcp:write"];
3
+ var TOOL_CATALOG = [
4
+ {
5
+ name: "get_recent_reports",
6
+ title: "Recent bug reports",
7
+ description: "List recent bug reports with optional filters (status / category / severity). Use this to survey what the triage queue looks like right now.",
8
+ scope: "mcp:read",
9
+ hints: { readOnly: true, idempotent: true, openWorld: true },
10
+ useCase: "What landed in my triage queue today?"
11
+ },
12
+ {
13
+ name: "get_report_detail",
14
+ title: "Report detail",
15
+ description: "Full payload for a single report \u2014 description, console logs, network requests, screenshot URL, classification, fix history.",
16
+ scope: "mcp:read",
17
+ hints: { readOnly: true, idempotent: true, openWorld: true },
18
+ useCase: "Show me everything you know about this report."
19
+ },
20
+ {
21
+ name: "get_report_timeline",
22
+ title: "Unified report timeline",
23
+ description: "Ordered timeline merging reporter comments, fix events, QA runs, skill pipeline steps, and Ask Mushi turns for one report.",
24
+ scope: "mcp:read",
25
+ hints: { readOnly: true, idempotent: true, openWorld: true },
26
+ useCase: "What happened on this report thread end-to-end?"
27
+ },
28
+ {
29
+ name: "search_reports",
30
+ title: "Search reports",
31
+ description: "Semantic + keyword search over reports. Uses pgvector similarity server-side \u2014 falls back to description/summary substring only if embeddings are unavailable for the project.",
32
+ scope: "mcp:read",
33
+ hints: { readOnly: true, idempotent: true, openWorld: true },
34
+ useCase: 'Find reports mentioning "checkout flakiness".'
35
+ },
36
+ {
37
+ name: "get_similar_bugs",
38
+ title: "Similar bugs",
39
+ description: 'Find bugs related to a component, page, or description via pgvector nearest-neighbour search. Same backend as search_reports but tuned for "have we seen this before?".',
40
+ scope: "mcp:read",
41
+ hints: { readOnly: true, idempotent: true, openWorld: true },
42
+ useCase: "Have we seen a bug like this before?"
43
+ },
44
+ {
45
+ name: "get_fix_context",
46
+ title: "Fix context bundle",
47
+ description: "Bundle the full context an agent needs to fix a bug: report detail, reproduction steps, component, root cause, ontology tags. One call instead of several.",
48
+ scope: "mcp:read",
49
+ hints: { readOnly: true, idempotent: true, openWorld: true },
50
+ useCase: "Give me everything I need to fix this in one payload."
51
+ },
52
+ {
53
+ name: "get_fix_timeline",
54
+ title: "Fix timeline",
55
+ description: 'Ordered timeline of a fix attempt \u2014 dispatched \u2192 started \u2192 branch \u2192 commit \u2192 PR opened \u2192 CI \u2192 completed/failed. Use this to debug "why did this fix fail?".',
56
+ scope: "mcp:read",
57
+ hints: { readOnly: true, idempotent: true, openWorld: true },
58
+ useCase: "Why did this fix attempt fail \u2014 show me every step."
59
+ },
60
+ {
61
+ name: "get_blast_radius",
62
+ title: "Blast radius",
63
+ description: "Graph traversal showing other components / pages a bug group touches. Use before dispatching a fix so the agent can scope its changes.",
64
+ scope: "mcp:read",
65
+ hints: { readOnly: true, idempotent: true, openWorld: true },
66
+ useCase: "What else might break if I change this component?"
67
+ },
68
+ {
69
+ name: "get_knowledge_graph",
70
+ title: "Knowledge graph traversal",
71
+ description: "Traverse the knowledge graph from a seed component or page. Returns nodes + edges within a depth budget (max 4 hops).",
72
+ scope: "mcp:read",
73
+ hints: { readOnly: true, idempotent: true, openWorld: true },
74
+ useCase: "Show me how this component connects to the rest of the app."
75
+ },
76
+ {
77
+ name: "run_nl_query",
78
+ title: "Ask your data (NL \u2192 SQL)",
79
+ description: "Natural-language question \u2192 SQL query run against your project data. Read-only, 60/hour rate-limited, no privileged schemas.",
80
+ scope: "mcp:read",
81
+ hints: { readOnly: true, idempotent: true, openWorld: true },
82
+ useCase: "Which components had the most critical bugs this week?"
83
+ },
84
+ // --- Inventory v2 (whitepaper §6.8) -------------------------------------
85
+ {
86
+ name: "inventory_get",
87
+ title: "Inventory snapshot",
88
+ description: "Current inventory.yaml snapshot for a project (latest ingest, validation errors, per-action status summary). Requires inventory_v2 on the project plan.",
89
+ scope: "mcp:read",
90
+ hints: { readOnly: true, idempotent: true, openWorld: true },
91
+ useCase: "What does the live inventory claim for this repo right now?"
92
+ },
93
+ {
94
+ name: "inventory_diff",
95
+ title: "Inventory diff",
96
+ description: "Diff two ingested inventory commits (fromSha \u2192 toSha) \u2014 added/removed nodes and edges. Use before merging a PR that touches inventory.yaml.",
97
+ scope: "mcp:read",
98
+ hints: { readOnly: true, idempotent: true, openWorld: true },
99
+ useCase: "What changed in inventory between these two SHAs?"
100
+ },
101
+ {
102
+ name: "inventory_findings",
103
+ title: "Gate findings",
104
+ description: "Latest gate runs + findings (dead-handler, mock-leak, crawl, status-claim, \u2026). Filter by gate name or severity.",
105
+ scope: "mcp:read",
106
+ hints: { readOnly: true, idempotent: true, openWorld: true },
107
+ useCase: "Show me what CI gates failed on the last run."
108
+ },
109
+ {
110
+ name: "graph_neighborhood",
111
+ title: "Graph neighborhood",
112
+ description: 'BFS neighborhood around a graph node id or label \u2014 nodes + edges within a depth budget (max 4). Same backend as knowledge-graph traversal, tuned for "what touches this action?".',
113
+ scope: "mcp:read",
114
+ hints: { readOnly: true, idempotent: true, openWorld: true },
115
+ useCase: "What nodes connect to this inventory Action within 2 hops?"
116
+ },
117
+ {
118
+ name: "graph_node_status",
119
+ title: "Graph node detail",
120
+ description: "Fetch a single graph node row (label, type, metadata \u2014 includes v2 derived status on Action nodes).",
121
+ scope: "mcp:read",
122
+ hints: { readOnly: true, idempotent: true, openWorld: true },
123
+ useCase: "What status does the graph store on this node id?"
124
+ },
125
+ {
126
+ name: "fix_suggest",
127
+ title: "Suggested fix (from triage)",
128
+ description: "Read-only slice of a report focused on Stage 2 suggested fix + root cause + reproduction \u2014 faster than pulling the full blob when you only need the human-readable hint.",
129
+ scope: "mcp:read",
130
+ hints: { readOnly: true, idempotent: true, openWorld: true },
131
+ useCase: "What did Stage 2 say we should try for this report?"
132
+ },
133
+ // --- Setup / admin -------------------------------------------------------
134
+ {
135
+ name: "setup_check",
136
+ title: "Dispatch preflight check",
137
+ description: "Run the 4 **dispatch-readiness** checks for a project and return their pass/fail status (GitHub repo connected, codebase indexed, Anthropic BYOK key present, autofix enabled). Also returns the target repo URL when GitHub is connected. Use this before calling dispatch_fix to understand why a dispatch might fail. For SDK ingest health (API key \u2192 heartbeat \u2192 first report), call ingest_setup_check instead.",
138
+ scope: "mcp:read",
139
+ hints: { readOnly: true, idempotent: true, openWorld: true },
140
+ useCase: "Is this project ready to auto-fix bugs? What is blocking dispatch?"
141
+ },
142
+ {
143
+ name: "ingest_setup_check",
144
+ title: "Ingest setup check",
145
+ description: "Run the 4 **required ingest** checks for the project tied to this API key: project exists, active API key, SDK heartbeat (or real report), and at least one ingested report. Returns per-step pass/fail plus last_sdk_seen_at and endpoint host diagnostics. Use after wiring env vars or pasting the SDK snippet to confirm the banner will work.",
146
+ scope: "mcp:read",
147
+ hints: { readOnly: true, idempotent: true, openWorld: true },
148
+ useCase: "Is the SDK installed and ingesting reports? Why is my banner still missing?"
149
+ },
150
+ {
151
+ name: "diagnose_connection",
152
+ title: "Connection diagnose (CLI + MCP + SDK)",
153
+ description: `Validate the MCP server credentials (endpoint, API key, projectId), ping /health, run ingest-setup and dispatch preflight, and return the single best next action when anything fails. Use when the user asks "why aren't my reports showing up?".`,
154
+ scope: "mcp:read",
155
+ hints: { readOnly: true, idempotent: true, openWorld: true },
156
+ useCase: "Why is my Mushi setup broken \u2014 what exact step should I fix next?"
157
+ },
158
+ // --- Write / agentic ----------------------------------------------------
159
+ {
160
+ name: "submit_fix_result",
161
+ title: "Record a fix outcome",
162
+ description: "Record a fix outcome (branch, PR, files, lines) from an external agent. Creates a fix_attempt then patches it to completed.",
163
+ scope: "mcp:write",
164
+ // Not idempotent: re-running creates a second fix_attempt row.
165
+ hints: { readOnly: false, destructive: false, idempotent: false, openWorld: true },
166
+ useCase: "I just opened a PR \u2014 log it against the report."
167
+ },
168
+ {
169
+ name: "dispatch_fix",
170
+ title: "Dispatch Mushi fix agent",
171
+ description: 'Dispatch the Mushi agentic fix orchestrator for a classified report. Set agent="cursor_cloud" to dispatch a Cursor Cloud Agent that opens a signed draft PR. Returns a fix_attempt id; poll get_fix_timeline for progress.',
172
+ scope: "mcp:write",
173
+ hints: { readOnly: false, destructive: false, idempotent: false, openWorld: true },
174
+ useCase: "Let the in-repo agent attempt this fix for me (or: dispatch a Cursor Cloud Agent)."
175
+ },
176
+ {
177
+ name: "trigger_judge",
178
+ title: "Run Sonnet-as-Judge",
179
+ description: "Run the Sonnet-as-Judge over a batch of classified reports. Returns a batch id; results land in judge_results.",
180
+ scope: "mcp:write",
181
+ hints: { readOnly: false, destructive: false, idempotent: true, openWorld: true },
182
+ useCase: "Grade the latest batch of fixes before I ship."
183
+ },
184
+ {
185
+ name: "test_gen_from_report",
186
+ title: "Generate Playwright test from report",
187
+ description: "POST to inventory test-gen: uses the project BYOK LLM to author a Playwright spec from a classified report and opens a draft PR (internal service orchestration). Requires inventory_v2 + GitHub + LLM keys.",
188
+ scope: "mcp:write",
189
+ hints: { readOnly: false, destructive: false, idempotent: false, openWorld: true },
190
+ useCase: "Turn this regression report into an E2E test PR."
191
+ },
192
+ {
193
+ name: "transition_status",
194
+ title: "Move report between states",
195
+ description: "Move a report between workflow states (new \u2192 classified \u2192 grouped \u2192 fixing \u2192 fixed \u2192 verified \u2192 reopened \u2192 dismissed). Enforces the same transition rules as the admin UI.",
196
+ scope: "mcp:write",
197
+ hints: { readOnly: false, destructive: true, idempotent: true, openWorld: true },
198
+ useCase: "Dismiss this duplicate / mark it fixed."
199
+ },
200
+ {
201
+ name: "merge_fix",
202
+ title: "Merge fix PR",
203
+ description: "Squash-merge a fix attempt PR and mark the linked report fixed.",
204
+ scope: "mcp:write",
205
+ hints: { readOnly: false, destructive: true, idempotent: true, openWorld: true },
206
+ useCase: "Merge the draft PR and notify the reporter."
207
+ },
208
+ {
209
+ name: "refresh_ci",
210
+ title: "Refresh fix CI status",
211
+ description: "Pull the latest GitHub check-run status for a fix attempt.",
212
+ scope: "mcp:read",
213
+ hints: { readOnly: true, idempotent: true, openWorld: true },
214
+ useCase: "Check whether CI is green before merging."
215
+ },
216
+ {
217
+ name: "reopen_report",
218
+ title: "Reopen report (operator)",
219
+ description: "Move a report to reopened for regression triage.",
220
+ scope: "mcp:write",
221
+ hints: { readOnly: false, destructive: false, idempotent: true, openWorld: true },
222
+ useCase: "Reopen a regression the reporter flagged as not fixed."
223
+ },
224
+ // --- Rewards (P3) -------------------------------------------------------
225
+ {
226
+ name: "list_top_contributors",
227
+ title: "Top contributors leaderboard",
228
+ description: "Return the top N contributors for the organization, ranked by points in a time window (30d | 90d | all). Each row includes display name, tier, total points, report count, and anti-fraud flag. Use this to identify your most engaged power users, write them a thank-you message, or decide who deserves a bonus.",
229
+ scope: "mcp:read",
230
+ hints: { readOnly: true, idempotent: true, openWorld: true },
231
+ useCase: "Who are my top 10 contributors this month?"
232
+ },
233
+ {
234
+ name: "award_bonus_points",
235
+ title: "Award bonus points",
236
+ description: "Award ad-hoc bonus points to a contributor by their external user id (as passed to Mushi.identify()). Points are applied server-side, audit-logged, and trigger tier re-evaluation. Requires mcp:write scope. Use this to thank a contributor who found a critical bug or to run a one-off promotional campaign.",
237
+ scope: "mcp:write",
238
+ hints: { readOnly: false, destructive: false, idempotent: false, openWorld: true },
239
+ useCase: "Give this contributor 500 bonus points for the critical bug they found."
240
+ },
241
+ {
242
+ name: "set_tier",
243
+ title: "Override contributor tier",
244
+ description: `Override a contributor's tier by tier slug (e.g. "champion"). This is an admin escape hatch for manual promotions \u2014 normal tier transitions happen automatically via point thresholds. The override is logged in end_user_activity with action=tier_override_manual. Requires mcp:write scope.`,
245
+ scope: "mcp:write",
246
+ hints: { readOnly: false, destructive: false, idempotent: true, openWorld: true },
247
+ useCase: "Manually promote this user to Champion tier as a thank-you."
248
+ },
249
+ {
250
+ name: "setup_repo_for_mushi",
251
+ title: "Bootstrap repo for Mushi",
252
+ description: "Writes the three Mushi bootstrap files into the current repo root: `.cursorrules` (Cursor evolution-loop coding rules), `.mushi/lessons.json` (initial empty lesson cache), and `MUSHI.md` (one-page project contract for agents). Idempotent \u2014 safe to re-run after lessons sync. Requires mcp:write scope. Call this once after connecting the repo; subsequently use `mushi sync-lessons` from CI to keep lessons current.",
253
+ scope: "mcp:write",
254
+ hints: { readOnly: false, destructive: false, idempotent: true, openWorld: false },
255
+ useCase: "Set up this repo for the Mushi evolution loop in one step."
256
+ },
257
+ // ── Sentry-like triage and project context ────────────────────────────────
258
+ {
259
+ name: "list_projects",
260
+ title: "List accessible projects",
261
+ description: "List the Mushi projects accessible to this API key. For project-scoped keys (the typical case), returns a single-item list with the bound project's id, name, slug, plan tier, and ingest status. For org-level tokens, returns all projects in the org. Use this when MUSHI_PROJECT_ID is not configured \u2014 call list_projects first, then pass the id to other tools.",
262
+ scope: "mcp:read",
263
+ hints: { readOnly: true, idempotent: true, openWorld: true },
264
+ useCase: "Which projects can I access with this API key?"
265
+ },
266
+ {
267
+ name: "get_project_context",
268
+ title: "Project context snapshot",
269
+ description: "Return a rich context snapshot for a project: name, repo URL, SDK heartbeat, ingest status, open report count, autofix readiness, BYOK LLM config, plan tier, and active integration health. Equivalent to a merged preflight + activation + settings read. Agents should call this at the start of a triage session to orient themselves.",
270
+ scope: "mcp:read",
271
+ hints: { readOnly: true, idempotent: true, openWorld: true },
272
+ useCase: "Give me a status overview of this project before I start triaging."
273
+ },
274
+ {
275
+ name: "get_pipeline_logs",
276
+ title: "Recent pipeline logs",
277
+ description: "Pull recent log entries from the Mushi pipeline services: fix-worker, qa-story-runner, pipeline, or all. Accepts project_id, service, since (ISO-8601), limit (max 200), and level (info | warn | error | fatal) filters. Returns structured log rows with timestamp, level, service, message, and a trace_id/report_id when available. Use this when a fix failed, a QA story keeps erroring, or an ingest pipeline went silent.",
278
+ scope: "mcp:read",
279
+ hints: { readOnly: true, idempotent: true, openWorld: true },
280
+ useCase: "Why did the last fix attempt fail? Show me recent pipeline errors."
281
+ },
282
+ {
283
+ name: "get_report_evidence",
284
+ title: "Bug report evidence",
285
+ description: "Return the full evidence package for a single bug report: screenshot URL, console logs, network excerpts, browser environment (user agent, URL, viewport, SDK version), user replay link if available, breadcrumb trail, and the reporter's own comments thread. This is the same data an engineer would collect for a root-cause investigation. Faster than calling get_report_detail + report timeline separately.",
286
+ scope: "mcp:read",
287
+ hints: { readOnly: true, idempotent: true, openWorld: true },
288
+ useCase: "I need all the evidence for this bug report to diagnose the root cause."
289
+ },
290
+ {
291
+ name: "triage_issue",
292
+ title: "Triage issue end-to-end",
293
+ description: 'Read-only orchestration tool: combines report detail, evidence, similar bugs, fix context, blast radius, and recent pipeline logs for a report into a single structured triage packet. Returns a prioritised list of recommended next actions (investigate, dispatch_fix, group_with, dismiss). Equivalent to a Sentry "Analyze with Seer" flow grounded in user-felt reports. Pass report_id to kick off triage. Call this before dispatch_fix.',
294
+ scope: "mcp:read",
295
+ hints: { readOnly: true, idempotent: true, openWorld: true },
296
+ useCase: "Analyze this bug report end-to-end and tell me what to do."
297
+ },
298
+ // ── Lessons / evolution loop ─────────────────────────────────────────────
299
+ {
300
+ name: "query_lessons",
301
+ title: "Query lessons for diff context",
302
+ description: 'Token-budget retrieval of relevant learning rules (lessons) for a given code diff or PR context. Returns ranked lessons packed within max_tokens using bi-encoder retrieval + severity-weighted scoring. Use this before opening a PR, writing a fix, or asking "what mistakes should I avoid in this area of code?"',
303
+ scope: "mcp:read",
304
+ hints: { readOnly: true, idempotent: true, openWorld: true },
305
+ useCase: "What past mistakes should I avoid when making this change?"
306
+ },
307
+ {
308
+ name: "list_lessons",
309
+ title: "List project lessons",
310
+ description: "List promoted learning rules (lessons) for the current project. Each lesson represents a named pattern of mistakes that has been encoded from bug reports. Use this to understand what systemic issues have been identified and encoded as heuristics.",
311
+ scope: "mcp:read",
312
+ hints: { readOnly: true, idempotent: true, openWorld: true },
313
+ useCase: "What systemic patterns has Mushi identified for this project?"
314
+ }
315
+ ];
316
+ var RESOURCE_CATALOG = [
317
+ {
318
+ name: "project_dashboard",
319
+ uri: "project://dashboard",
320
+ title: "PDCA dashboard snapshot",
321
+ description: "PDCA health snapshot \u2014 stage counts, bottleneck, recent activity (same payload the admin console polls).",
322
+ scope: "mcp:read"
323
+ },
324
+ {
325
+ name: "project_stats",
326
+ uri: "project://stats",
327
+ title: "Project stats",
328
+ description: "Report counts, category breakdown, severity distribution.",
329
+ scope: "mcp:read"
330
+ },
331
+ {
332
+ name: "project_settings",
333
+ uri: "project://settings",
334
+ title: "Project settings",
335
+ description: "Project configuration \u2014 autofix agent, plugins enabled, ontology, LLM budgets.",
336
+ scope: "mcp:read"
337
+ },
338
+ {
339
+ name: "privacy_status",
340
+ uri: "privacy://status",
341
+ title: "Privacy posture",
342
+ description: "Returns the privacy posture for this project: storage region, LLM provider, whether BYOK is configured, data retention window, and last audit timestamp. Agents should read this before dispatching a fix to confirm that client data stays within the expected boundary. Reads as project data does not leave the project's own LLM account when byok_configured=true.",
343
+ scope: "mcp:read"
344
+ },
345
+ {
346
+ name: "evolution_history",
347
+ uri: "evolution://history",
348
+ title: "Evolution history",
349
+ description: "Returns the project's last 30 days of judge scores, prompt promotions, fixed-bug count, and lesson inductions. Agents can read this to see whether the loop is converging (rising judge scores, falling recurrence) or stalling (flat scores, same bugs re-appearing). Use before triage to understand which bug classes the loop has already learned to handle, and which still need human attention.",
350
+ scope: "mcp:read"
351
+ },
352
+ {
353
+ name: "activation_status",
354
+ uri: "mushi://activation",
355
+ title: "Activation cockpit status",
356
+ description: "Unified setup posture \u2014 SDK heartbeat, reports, GitHub, MCP readiness, QA stories, and the next best action. Agents should read this before guessing which onboarding step is blocking the user.",
357
+ scope: "mcp:read"
358
+ },
359
+ {
360
+ name: "project_integration_health",
361
+ uri: "project://integration-health",
362
+ title: "Integration health",
363
+ description: "Live health status of every configured BYOK channel (Sentry, GitHub, LangFuse, PagerDuty, \u2026). Orchestrators should check this before dispatching a fix to fail-fast on broken channels rather than burning LLM budget and discovering the failure mid-run.",
364
+ scope: "mcp:read"
365
+ },
366
+ {
367
+ name: "inventory_current",
368
+ uri: "inventory://current",
369
+ title: "Current inventory snapshot",
370
+ description: "Current inventory snapshot for the active project \u2014 all Action nodes with their spec contract (expected_outcome), build-gate status, linked reports, and fix attempts. Subscribe to this resource to receive notifications/resources/updated when the inventory is re-crawled. Orchestrators can use this to enumerate work items and pick the next Action to fix.",
371
+ scope: "mcp:read"
372
+ }
373
+ ];
374
+ var PROMPT_CATALOG = [
375
+ {
376
+ name: "summarize_report_for_fix",
377
+ title: "Summarize report for fix",
378
+ description: "Turn a Mushi report into a one-line root cause, smallest file set, repro steps, and blast-radius warnings.",
379
+ useCase: "/summarize_report_for_fix \u2014 agent builds a fix plan before coding."
380
+ },
381
+ {
382
+ name: "explain_judge_result",
383
+ title: "Explain judge result",
384
+ description: "Turn raw Sonnet-as-Judge scores into ship / iterate / dismiss guidance.",
385
+ useCase: "/explain_judge_result \u2014 agent gives a verdict after CI/judge runs."
386
+ },
387
+ {
388
+ name: "triage_next_steps",
389
+ title: "What should I focus on?",
390
+ description: "Five-item priority list drawn from the dashboard + recent classified queue.",
391
+ useCase: "/triage_next_steps \u2014 agent tells you where to start your day."
392
+ },
393
+ {
394
+ name: "mushi_setup",
395
+ title: "Diagnose Mushi setup",
396
+ description: "Walk through activation status, integration health, and the single next command to unblock setup.",
397
+ useCase: "/mushi_setup \u2014 agent diagnoses why setup is stuck without guessing."
398
+ }
399
+ ];
400
+ var TDD_TOOL_CATALOG = [
401
+ {
402
+ name: "map_user_stories",
403
+ title: "Map user stories from live app",
404
+ description: 'Crawl a live application URL with Firecrawl/Browserbase and ask Claude to draft an inventory.yaml with pages and user stories. Creates a story_map_run row for progress tracking, then writes an inventory_proposals row (source=live_crawl). Optionally dispatches a Cursor Cloud agent to refine the draft and open a PR. Returns { runId, status: "pending" } immediately \u2014 poll get_map_run_status for progress.',
405
+ scope: "mcp:write",
406
+ hints: { readOnly: false, destructive: false, idempotent: false, openWorld: true },
407
+ useCase: "Map the user stories in my live app automatically without writing YAML by hand."
408
+ },
409
+ {
410
+ name: "get_map_run_status",
411
+ title: "Story map run status",
412
+ description: "Get the status and results of a story_map_run (pending \u2192 running \u2192 completed/failed). Returns pages_crawled, proposal_id (once done), and cursor_pr_url if Cursor Cloud refined the draft.",
413
+ scope: "mcp:read",
414
+ hints: { readOnly: true, idempotent: true, openWorld: true },
415
+ useCase: "Is my story mapping crawl done yet?"
416
+ },
417
+ {
418
+ name: "generate_tdd_from_story",
419
+ title: "Generate TDD test from user story",
420
+ description: "Given a user story id (from the accepted inventory), ask Claude to write a full Playwright TypeScript test. Inserts a qa_stories row (source=test_gen_from_story) with approval_status driven by automation_mode. Optionally opens a draft GitHub PR. Returns { qaStoryId, prUrl, approvalStatus, needsHumanReview }.",
421
+ scope: "mcp:write",
422
+ hints: { readOnly: false, destructive: false, idempotent: false, openWorld: true },
423
+ useCase: "Generate a Playwright test for this user story."
424
+ },
425
+ {
426
+ name: "improve_qa_story",
427
+ title: "PDCA auto-improve a failing QA story",
428
+ description: "Trigger the PDCA improver for a specific project. Finds recently failed qa_story_runs and uses Claude to write improved test scripts. New tests are created with source=pdca and approval gated by the original story's automation_mode.",
429
+ scope: "mcp:write",
430
+ hints: { readOnly: false, destructive: false, idempotent: false, openWorld: true },
431
+ useCase: "Fix my failing QA tests automatically."
432
+ },
433
+ {
434
+ name: "run_qa_story",
435
+ title: "Trigger a manual QA story run",
436
+ description: 'Queue a manual run for an enabled + approved qa_story. Returns the run id immediately; poll qa_story_runs or use get_report_detail for progress. Equivalent to "Run now" in the console.',
437
+ scope: "mcp:write",
438
+ hints: { readOnly: false, destructive: false, idempotent: false, openWorld: true },
439
+ useCase: "Run the login flow test right now."
440
+ },
441
+ {
442
+ name: "list_byok_keys",
443
+ title: "List BYOK API key pool",
444
+ description: "List all BYOK API keys for the project, grouped by provider. Shows label, priority, status, and cooldown. Never returns the raw key value \u2014 only metadata. Use this to see which keys are active or exhausted.",
445
+ scope: "mcp:read",
446
+ hints: { readOnly: true, idempotent: true, openWorld: true },
447
+ useCase: "Which API keys are active and which are rate-limited?"
448
+ },
449
+ {
450
+ name: "add_byok_key",
451
+ title: "Add a BYOK API key",
452
+ description: "Add a new API key to the project's BYOK pool for a given provider (anthropic, openai, firecrawl, browserbase, cursor). Specify label and priority for ordering. The key is stored encrypted in Supabase Vault.",
453
+ scope: "mcp:write",
454
+ hints: { readOnly: false, destructive: false, idempotent: false, openWorld: true },
455
+ useCase: "Add a backup Anthropic key to the pool."
456
+ },
457
+ {
458
+ name: "list_pending_review_stories",
459
+ title: "List QA stories pending review",
460
+ description: "Get the queue of TDD tests that were auto-generated and are waiting for human approval before they run in the QA schedule.",
461
+ scope: "mcp:read",
462
+ hints: { readOnly: true, idempotent: true, openWorld: true },
463
+ useCase: "What TDD tests need my approval today?"
464
+ },
465
+ {
466
+ name: "approve_qa_story",
467
+ title: "Approve or reject a pending QA story",
468
+ description: "Approve or reject a qa_story that is in pending_review. Approved stories are enabled in the QA schedule immediately.",
469
+ scope: "mcp:write",
470
+ hints: { readOnly: false, destructive: false, idempotent: true, openWorld: true },
471
+ useCase: "Approve this auto-generated test."
472
+ },
473
+ {
474
+ name: "reply_to_reporter",
475
+ title: "Reply to a reporter",
476
+ description: "Send a visible message to the end-user who filed a bug report. The reply appears in the in-app Mushi widget as an admin comment and creates an unread notification badge so the reporter sees it immediately. Use this to answer questions, request reproduction steps, or confirm a fix \u2014 without leaving the Cursor IDE.",
477
+ scope: "mcp:write",
478
+ hints: { readOnly: false, destructive: false, idempotent: false, openWorld: false },
479
+ useCase: "Reply to a reporter asking for more info or confirming a fix."
480
+ },
481
+ {
482
+ name: "get_two_way_comms_health",
483
+ title: "Two-way communication health",
484
+ description: "Summarize SDK \u2194 admin two-way reporter health for a host app: last SDK heartbeat, app version/platform last seen, unread reporter messages, recent reporter replies, and pending QA/TDD follow-ups. Use after wiring @mushi-mushi/web in a Vite/Capacitor app to confirm reports land in the console and admin/MCP replies reach the in-app widget.",
485
+ scope: "mcp:read",
486
+ hints: { readOnly: true, idempotent: true, openWorld: true },
487
+ useCase: "Is two-way reporter communication working for this host app?"
488
+ },
489
+ {
490
+ name: "list_qa_story_runs",
491
+ title: "Recent QA story runs",
492
+ description: "Return the most recent runs for a given QA story, newest first. Each row includes status (passed/failed/error/running), latency_ms, created_at, error_message headline, and assertion_failures (up to 10). Use this to understand whether a story is currently healthy, what the last failure was, and whether a manual run has completed.",
493
+ scope: "mcp:read",
494
+ hints: { readOnly: true, idempotent: true, openWorld: true },
495
+ useCase: 'Show me the last 10 runs for the "home page loads" story and why they failed.'
496
+ },
497
+ {
498
+ name: "get_qa_story_run",
499
+ title: "QA story run detail",
500
+ description: "Fetch the full detail for a single qa_story_run: status, error_message, assertion_failures, latency_ms, provider_session_url (Browserbase replay link when available), and screenshot URLs from qa_story_evidence. Use this to drill into a specific failing run and understand the exact error before deciding whether to improve the story script or fix the app.",
501
+ scope: "mcp:read",
502
+ hints: { readOnly: true, idempotent: true, openWorld: true },
503
+ useCase: "What exactly happened in this failed QA run? Show me the error and screenshots."
504
+ },
505
+ {
506
+ name: "test_notification_channel",
507
+ title: "Send a test notification",
508
+ description: 'Send a test notification to a configured notification channel for the project. Supported channel kinds: "slack" (posts a test Block Kit message to the configured channel), "discord" (posts to the project discord_webhook_url). Returns ok=true if the message was accepted. Use this to verify the integration is working after setup or after changing credentials.',
509
+ scope: "mcp:write",
510
+ hints: { readOnly: false, destructive: false, idempotent: false, openWorld: true },
511
+ useCase: 'Did "Add to Slack" work? Send a test ping to confirm.'
512
+ },
513
+ // ── Skill Pipeline tools ─────────────────────────────────────────────────────
514
+ {
515
+ name: "list_skills",
516
+ title: "List agent skills",
517
+ description: "List the agent skills available in the catalog, optionally filtered by category. Returns slug, title, description, category, and chain_slugs for each skill. Use before start_skill_pipeline to find the right skill slug for a given type of work.",
518
+ scope: "mcp:read",
519
+ hints: { readOnly: true, idempotent: true, openWorld: true },
520
+ useCase: "What skills are available for debugging production errors?"
521
+ },
522
+ {
523
+ name: "get_skill",
524
+ title: "Get skill detail",
525
+ description: "Fetch the full detail for a single agent skill by slug, including the complete SKILL.md body and resolved chain. Use before executing a step to understand what the skill expects you to do.",
526
+ scope: "mcp:read",
527
+ hints: { readOnly: true, idempotent: true, openWorld: true },
528
+ useCase: "What does workflow-fix-and-ship actually instruct me to do?"
529
+ },
530
+ {
531
+ name: "start_skill_pipeline",
532
+ title: "Start a skill pipeline",
533
+ description: "Start a new skill pipeline run for a report. Pass root_skill_slug and optionally report_id. Returns run_id, context_packet (full instructions + report context), and step list. Read the context_packet \u2014 it contains skill instructions plus full report context (repro steps, root cause, RAG files). After executing each step, call checkin_pipeline_step. The PM watching the console sees progress live.",
534
+ scope: "mcp:write",
535
+ hints: { readOnly: false, destructive: false, idempotent: false, openWorld: true },
536
+ useCase: "Start the workflow-fix-and-ship pipeline for this bug report."
537
+ },
538
+ {
539
+ name: "get_pipeline_run",
540
+ title: "Get pipeline run detail",
541
+ description: "Fetch the full detail for a skill pipeline run: status, context_packet, and all step statuses. Call to retrieve the context_packet after a pipeline was started from the console or another agent.",
542
+ scope: "mcp:read",
543
+ hints: { readOnly: true, idempotent: true, openWorld: true },
544
+ useCase: "Give me the context packet and step status for this pipeline run."
545
+ },
546
+ {
547
+ name: "checkin_pipeline_step",
548
+ title: "Check in a pipeline step",
549
+ description: "Report the completion status of a pipeline step (passed, failed, running, or skipped). Optionally include notes, a PR URL, or the Cursor agentId. Updates the live React Flow canvas in the Mushi console so PMs see real-time progress.",
550
+ scope: "mcp:write",
551
+ hints: { readOnly: false, destructive: false, idempotent: true, openWorld: true },
552
+ useCase: "I just opened the PR \u2014 mark step 2 as passed and link the PR."
553
+ },
554
+ {
555
+ name: "get_activation_status",
556
+ title: "Activation cockpit status",
557
+ description: "Unified setup posture for the active project: required steps, SDK heartbeat, dispatch preflight, and the next best action. Use this first when the user says setup is broken or they cannot connect.",
558
+ scope: "mcp:read",
559
+ hints: { readOnly: true, idempotent: true, openWorld: true },
560
+ useCase: "What is blocking this project from going live?"
561
+ },
562
+ {
563
+ name: "get_reporter_thread",
564
+ title: "Reporter feedback thread",
565
+ description: "Fetch the unified timeline for a report \u2014 the reporter/admin comment thread (including verify/reopen signals) plus fix, QA, and status lanes. Use when triaging whether an end user still sees a bug as unfixed.",
566
+ scope: "mcp:read",
567
+ hints: { readOnly: true, idempotent: true, openWorld: true },
568
+ useCase: "What did the reporter say after we marked this fixed?"
569
+ },
570
+ // ── Full-Stack Audit tools (Phase 5) ────────────────────────────────────────
571
+ {
572
+ name: "run_fullstack_audit",
573
+ title: "Run a full-stack health audit",
574
+ description: "Fan out a full-stack health audit for the current project: DB schema + advisors, API contract gate results (Gates 3\u20138), recent backend error logs, and RLS gap detection. Returns a PM-readable scorecard with severity-ranked findings and fix hints. Requires the project to have a Supabase PAT configured (Settings \u2192 API Keys, slug: supabase) and supabase_project_ref set in project settings for backend analysis. The audit completes synchronously in ~10 s. Triggers a background gate run for orphan_endpoint and unknown_call gates if they have not run today.",
575
+ scope: "mcp:write",
576
+ hints: { readOnly: false, destructive: false, idempotent: true, openWorld: true },
577
+ useCase: "Is this project healthy? Run a one-click full-stack audit to find API contract mismatches, unlinked backend features, schema drift, and security gaps."
578
+ },
579
+ {
580
+ name: "get_backend_health",
581
+ title: "Get backend health for a project",
582
+ description: 'Return the current backend health state for a linked Supabase project: table list (with RLS enabled status), recent API and Postgres error logs, and DB advisor findings. Uses the read-only Supabase MCP client via the stored PAT. Returns { tables, logs, advisors, projectRef } when the backend is linked, or { reason: "no_supabase_pat" | "no_project_ref" } when it is not configured. This is the read-only fast path \u2014 use run_fullstack_audit for the full scorecard including gate results.',
583
+ scope: "mcp:read",
584
+ hints: { readOnly: true, idempotent: true, openWorld: true },
585
+ useCase: "Are there any tables without RLS? Show me recent backend errors for this project."
586
+ }
587
+ ];
588
+
589
+ export {
590
+ ALL_SCOPES,
591
+ TOOL_CATALOG,
592
+ RESOURCE_CATALOG,
593
+ PROMPT_CATALOG,
594
+ TDD_TOOL_CATALOG
595
+ };