@testingbot/mcp-server 1.2.0 → 1.3.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/README.md CHANGED
@@ -10,7 +10,7 @@ TestingBot's official Model Context Protocol (MCP) server implementation. This s
10
10
 
11
11
  [![Install in VS Code](https://img.shields.io/badge/Install-VS_Code-007ACC?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://testingbot.com/mcp/install?client=vscode) [![Install in Cursor](https://img.shields.io/badge/Install-Cursor-000000?style=for-the-badge&logo=cursor&logoColor=white)](https://testingbot.com/mcp/install?client=cursor)
12
12
 
13
- **Claude Desktop**: download `mcp-server.mcpb` from the [releases page](https://github.com/testingbot/mcp-server/releases) and double-click it. Claude will set up the TestingBot MCP server automatically.
13
+ **Claude Desktop**: download `testingbot-mcp-server-<version>.mcpb` from the [latest release](https://github.com/testingbot/mcp-server/releases/latest) and double-click it. Claude will set up the TestingBot MCP server automatically.
14
14
 
15
15
  After install, set your credentials from [TestingBot account settings](https://testingbot.com/members/user/security).
16
16
 
@@ -331,6 +331,27 @@ Stop a running test by session ID.
331
331
  **Example prompt:**
332
332
  > "Stop test abc123"
333
333
 
334
+ ### AI Failure Analysis
335
+
336
+ Explanations from [TestingBot AI Insights](https://testingbot.com/support/ai/insights): summary, root cause, timeline, log evidence, suggested fixes, a failure category, the likely owner and a confidence score. The account owner must first enable **AI Analysis** in Account Settings, which records consent to sending curated, secret-masked test logs to TestingBot's AI provider; until then both tools say how to turn it on and nothing is sent.
337
+
338
+ #### `analyzeTestFailure`
339
+ Start (or reuse) an AI failure analysis of a finished test and wait for the result. A current analysis is returned without extra cost.
340
+
341
+ **Parameters:**
342
+ - `sessionId`: Session ID (or numeric test ID)
343
+ - `force` (optional): Run a fresh analysis even if one exists
344
+ - `waitSeconds` (optional): How long to wait for the result (default 90, 0 returns immediately)
345
+
346
+ **Example prompt:**
347
+ > "Why did test abc123 fail?"
348
+
349
+ #### `getAiFailureAnalysis`
350
+ Read an existing analysis. Never starts one.
351
+
352
+ **Parameters:**
353
+ - `sessionId`: Session ID (or numeric test ID)
354
+
334
355
  ### Build Management
335
356
 
336
357
  #### `getBuilds`
@@ -503,6 +524,44 @@ Start a run. Returns immediately with the run ID.
503
524
  #### `getAppAutomateRunStatus` / `getAppAutomateRunResults`
504
525
  Poll run progress, then fetch per-run outcomes and the JUnit XML report. Each run's Appium session ID is surfaced, so `getTestDetails` / `getFailureLogs` work for logs and video.
505
526
 
527
+ ### Visual Testing Review
528
+
529
+ Review [hosted visual tests](https://testingbot.com/support/visual-testing/ci#review-api): find failed runs, see what changed, approve or reject. When the account owner has turned on AI region names, each changed region carries a one-line AI description of the change; reading a run never sends anything to an AI provider.
530
+
531
+ #### `getVisualTests`
532
+ List hosted visual tests. **Parameters:** `offset`, `limit` (optional)
533
+
534
+ #### `getVisualRuns`
535
+ List visual runs, newest first. **Parameters:** `testId`, `state` (`failed`, `unreviewed`, `passed`), `offset`, `limit` (all optional)
536
+
537
+ #### `explainVisualRun`
538
+ What changed in a run: regions with names, AI change descriptions, text and CSS changes, and image links. **Parameters:** `runId`
539
+
540
+ **Example prompt:**
541
+ > "Which visual tests failed today, and what changed on the pricing page?"
542
+
543
+ #### `reviewVisualRun`
544
+ Approve or reject a run. **Parameters:** `runId`, `decision` (`approve`/`reject`), `makeBaseline` (optional, with approve)
545
+
546
+ ### Accessibility Testing
547
+
548
+ Results of scheduled [accessibility scans](https://testingbot.com/support/accessibility), scored like the dashboard: WCAG A/AA violations decide pass/fail; needs-review items and best-practice recommendations do not. Automated checks cover only part of WCAG.
549
+
550
+ #### `getAccessibilityTests`
551
+ Scheduled accessibility tests with their latest result. **Parameters:** `offset`, `limit` (optional)
552
+
553
+ #### `getAccessibilityRuns`
554
+ Scans of one test, newest first. **Parameters:** `testId`, `offset`, `limit`
555
+
556
+ #### `getAccessibilityFindings`
557
+ Failing rules with the elements (selector, HTML, how to fix) and what is new or resolved since the previous scan. **Parameters:** `runId`, `elementsPerRule` (optional, default 5)
558
+
559
+ **Example prompt:**
560
+ > "What accessibility issues does our checkout page have, and which are new since the last scan?"
561
+
562
+ #### `runAccessibilityTest`
563
+ Start a scan now. **Parameters:** `testId`
564
+
506
565
  ### Screenshot Testing
507
566
 
508
567
  #### `takeScreenshot`
@@ -566,11 +625,12 @@ Update user account information.
566
625
  ### Team Management
567
626
 
568
627
  #### `getTeam`
569
- Get team information including concurrency limits, allowed parallel VMs, and mobile concurrency.
628
+ Get team information including concurrency: parallel sessions allowed, running right now and queued (waiting for a free slot), for VMs and physical devices. Counts are team-wide and match the dashboard.
570
629
 
571
630
  **Example prompt:**
572
631
  > "Show my team information"
573
632
  > "What are my team's concurrency limits?"
633
+ > "How many of my tests are running or queued right now?"
574
634
 
575
635
  #### `getUsersInTeam`
576
636
  List all users in your team with their roles and access levels.
@@ -648,6 +708,27 @@ Delete an active TestingBot tunnel by ID. This terminates the tunnel connection.
648
708
  **Example prompt:**
649
709
  > "Delete tunnel 12345"
650
710
 
711
+ ## Prompts, Resources and Agent Skills
712
+
713
+ Besides tools, the server offers MCP **prompts**: task recipes your client can show as slash commands:
714
+
715
+ | Prompt | Arguments | What it does |
716
+ | --- | --- | --- |
717
+ | `why-did-my-test-fail` | `sessionId` | Test status, AI failure analysis when enabled, failing log lines, likely cause and fixes |
718
+ | `summarise-build` | `buildId` | Pass/fail counts, failures grouped by shared cause, what to fix first |
719
+ | `find-flaky-tests` | `timeRange` (optional, default `30d`) | Tests that both passed and failed, and why each is unstable |
720
+
721
+ and read-only **resources** a client can attach to a conversation:
722
+
723
+ | URI | Content |
724
+ | --- | --- |
725
+ | `testingbot://tests/{sessionId}` | Test details (JSON) |
726
+ | `testingbot://tests/{sessionId}/logs/{logType}` | One log file, last 200 KB (`selenium`, `browser`, `chrome`, `vm`, `appium`) |
727
+ | `testingbot://builds/{buildId}` | Tests in a build (JSON) |
728
+ | `testingbot://insights/flaky-tests` | Flaky tests over the last 30 days; `?time_range=7d` to change it |
729
+
730
+ The same recipes ship as agent skills in [`skills/`](skills/) (one `SKILL.md` per task) for agents that load skills from files.
731
+
651
732
  ## Usage Examples
652
733
 
653
734
  ### Example 1: Running Cross-Browser Tests
@@ -0,0 +1,30 @@
1
+ export interface PromptArgument {
2
+ name: string;
3
+ description: string;
4
+ required: boolean;
5
+ }
6
+ export interface PromptDefinition {
7
+ name: string;
8
+ title: string;
9
+ description: string;
10
+ arguments: PromptArgument[];
11
+ build: (args: Record<string, string>) => string;
12
+ }
13
+ export declare const PROMPTS: PromptDefinition[];
14
+ export declare function listPrompts(): {
15
+ name: string;
16
+ title: string;
17
+ description: string;
18
+ arguments: PromptArgument[];
19
+ }[];
20
+ export declare function getPrompt(name: string, args?: Record<string, string>): {
21
+ description: string;
22
+ messages: {
23
+ role: "user";
24
+ content: {
25
+ type: "text";
26
+ text: string;
27
+ };
28
+ }[];
29
+ };
30
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC;CACjD;AAOD,eAAO,MAAM,OAAO,EAAE,gBAAgB,EA0ErC,CAAC;AAEF,wBAAgB,WAAW;;;;;IAO1B;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;;;;;;;;;EAcxE"}
@@ -0,0 +1,105 @@
1
+ // MCP prompts (prompts/list, prompts/get): ready-made task recipes a client can
2
+ // offer as slash commands. Each one returns a single user message that tells the
3
+ // model which TestingBot tools and resources to use, in which order, and what to
4
+ // report. They only reference tools by name; nothing is called here.
5
+ function arg(args, name, fallback = "") {
6
+ const value = args[name];
7
+ return typeof value === "string" && value.trim() ? value.trim() : fallback;
8
+ }
9
+ export const PROMPTS = [
10
+ {
11
+ name: "why-did-my-test-fail",
12
+ title: "Why did my test fail?",
13
+ description: "Investigate one failed TestingBot test: status, AI failure analysis when enabled, and the failing log lines.",
14
+ arguments: [
15
+ {
16
+ name: "sessionId",
17
+ description: "Session ID (or numeric test ID) of the failed test.",
18
+ required: true,
19
+ },
20
+ ],
21
+ build: (args) => {
22
+ const id = arg(args, "sessionId");
23
+ return [
24
+ `Find out why TestingBot test ${id} failed.`,
25
+ "",
26
+ `1. Call getTestDetails for ${id} (or read the resource testingbot://tests/${id}) to get its status, status message, environment and which logs exist.`,
27
+ `2. If the analyzeTestFailure tool is available, call it for ${id}. If it reports that AI Analysis is not enabled, do not ask to enable it; carry on with the logs.`,
28
+ `3. Call getFailureLogs for ${id} with failuresOnly=true. Read the full log of one type only if the failing lines are not enough.`,
29
+ "4. Report: what the test was doing, the step that failed, the most likely cause (application bug, test script, environment or flaky), the log lines that show it, and one to three concrete fixes. Quote the evidence; say how sure you are and do not guess beyond it.",
30
+ ].join("\n");
31
+ },
32
+ },
33
+ {
34
+ name: "summarise-build",
35
+ title: "Summarise a build",
36
+ description: "Summarise a TestingBot build: pass/fail counts, the failures grouped by cause, and what to fix first.",
37
+ arguments: [
38
+ {
39
+ name: "buildId",
40
+ description: "ID of the build (from getBuilds).",
41
+ required: true,
42
+ },
43
+ ],
44
+ build: (args) => {
45
+ const id = arg(args, "buildId");
46
+ return [
47
+ `Summarise TestingBot build ${id}.`,
48
+ "",
49
+ `1. Call getTestsForBuild for build ${id} (or read testingbot://builds/${id}).`,
50
+ "2. Count passed, failed and unknown tests, and list the environments (browser/OS or device) they ran on.",
51
+ "3. For each failed test (at most 10), call getFailureLogs with failuresOnly=true. If analyzeTestFailure is available and enabled, use getAiFailureAnalysis to read existing analyses first; only start new ones for up to 3 tests.",
52
+ "4. Group the failures by shared cause (same error message, same environment, same step).",
53
+ "5. Report a short summary line, a table of failure groups with the affected tests and environments, and what to fix first. Mention tests that failed in one environment only.",
54
+ ].join("\n");
55
+ },
56
+ },
57
+ {
58
+ name: "find-flaky-tests",
59
+ title: "Find flaky tests",
60
+ description: "Find tests that both passed and failed recently and suggest why they are unstable.",
61
+ arguments: [
62
+ {
63
+ name: "timeRange",
64
+ description: "How far back to look, e.g. 7d or 30d (default 30d).",
65
+ required: false,
66
+ },
67
+ ],
68
+ build: (args) => {
69
+ const range = arg(args, "timeRange", "30d");
70
+ return [
71
+ `Find flaky TestingBot tests over the last ${range}.`,
72
+ "",
73
+ `1. Read the resource testingbot://insights/flaky-tests?time_range=${encodeURIComponent(range)}. It lists test names with their pass rate and a flaky flag, most flaky first.`,
74
+ "2. For the top 5 flaky tests, call getTests and pick one recent failed and one recent passed run of each; call getFailureLogs with failuresOnly=true on the failed run.",
75
+ "3. Look for timing problems (timeouts, waits, animations), order dependence, shared test data, or one environment failing more than others.",
76
+ "4. Report a ranked list: test name, pass rate, runs, the likely reason it is unstable, and a concrete change to make it stable.",
77
+ ].join("\n");
78
+ },
79
+ },
80
+ ];
81
+ export function listPrompts() {
82
+ return PROMPTS.map(({ name, title, description, arguments: args }) => ({
83
+ name,
84
+ title,
85
+ description,
86
+ arguments: args,
87
+ }));
88
+ }
89
+ export function getPrompt(name, args = {}) {
90
+ const prompt = PROMPTS.find((p) => p.name === name);
91
+ if (!prompt)
92
+ throw new Error(`Unknown prompt: ${name}`);
93
+ for (const a of prompt.arguments) {
94
+ if (a.required && !arg(args, a.name)) {
95
+ throw new Error(`Prompt ${name} needs the argument "${a.name}"`);
96
+ }
97
+ }
98
+ return {
99
+ description: prompt.description,
100
+ messages: [
101
+ { role: "user", content: { type: "text", text: prompt.build(args) } },
102
+ ],
103
+ };
104
+ }
105
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,iFAAiF;AACjF,iFAAiF;AACjF,qEAAqE;AAgBrE,SAAS,GAAG,CAAC,IAA4B,EAAE,IAAY,EAAE,QAAQ,GAAG,EAAE;IACpE,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC7E,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAuB;IACzC;QACE,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EACT,8GAA8G;QAChH,SAAS,EAAE;YACT;gBACE,IAAI,EAAE,WAAW;gBACjB,WAAW,EAAE,qDAAqD;gBAClE,QAAQ,EAAE,IAAI;aACf;SACF;QACD,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;YACd,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YAClC,OAAO;gBACL,gCAAgC,EAAE,UAAU;gBAC5C,EAAE;gBACF,8BAA8B,EAAE,6CAA6C,EAAE,wEAAwE;gBACvJ,+DAA+D,EAAE,mGAAmG;gBACpK,8BAA8B,EAAE,kGAAkG;gBAClI,yQAAyQ;aAC1Q,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACf,CAAC;KACF;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EACT,uGAAuG;QACzG,SAAS,EAAE;YACT;gBACE,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE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,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACpD,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;IACxD,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,UAAU,IAAI,wBAAwB,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IACD,OAAO;QACL,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,QAAQ,EAAE;YACR,EAAE,IAAI,EAAE,MAAe,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE;SACxF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,24 @@
1
+ export declare const RESOURCE_TEMPLATES: {
2
+ uriTemplate: string;
3
+ name: string;
4
+ title: string;
5
+ description: string;
6
+ mimeType: string;
7
+ }[];
8
+ export declare const STATIC_RESOURCES: {
9
+ uri: string;
10
+ name: string;
11
+ title: string;
12
+ description: string;
13
+ mimeType: string;
14
+ }[];
15
+ type Contents = {
16
+ uri: string;
17
+ mimeType: string;
18
+ text: string;
19
+ };
20
+ export declare function readResource(testingBotApi: any, uri: string): Promise<{
21
+ contents: Contents[];
22
+ }>;
23
+ export {};
24
+ //# sourceMappingURL=resources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../src/resources.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,kBAAkB;;;;;;GAuB9B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;GAS5B,CAAC;AAEF,KAAK,QAAQ,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAoBhE,wBAAsB,YAAY,CAChC,aAAa,EAAE,GAAG,EAClB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,QAAQ,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAC,CAiDnC"}
@@ -0,0 +1,110 @@
1
+ import { sanitizeSessionId } from "./lib/utils.js";
2
+ // MCP resources (resources/list, resources/templates/list, resources/read):
3
+ // read-only TestingBot data a client can attach to a conversation.
4
+ //
5
+ // testingbot://tests/{sessionId} test details (JSON)
6
+ // testingbot://tests/{sessionId}/logs/{logType} one session log (text, tail)
7
+ // testingbot://builds/{buildId} tests in a build (JSON)
8
+ // testingbot://insights/flaky-tests most flaky tests (JSON)
9
+ const LOG_TYPES = ["selenium", "browser", "chrome", "vm", "appium"];
10
+ const MAX_LOG_BYTES = 200_000;
11
+ const LOG_TIMEOUT_MS = 15_000;
12
+ export const RESOURCE_TEMPLATES = [
13
+ {
14
+ uriTemplate: "testingbot://tests/{sessionId}",
15
+ name: "test",
16
+ title: "TestingBot test",
17
+ description: "Status, environment, duration, build and asset links of one test (session ID or numeric test ID).",
18
+ mimeType: "application/json",
19
+ },
20
+ {
21
+ uriTemplate: "testingbot://tests/{sessionId}/logs/{logType}",
22
+ name: "test-log",
23
+ title: "TestingBot test log",
24
+ description: `One log file of a test, the last ${MAX_LOG_BYTES / 1000} KB. logType: ${LOG_TYPES.join(", ")}.`,
25
+ mimeType: "text/plain",
26
+ },
27
+ {
28
+ uriTemplate: "testingbot://builds/{buildId}",
29
+ name: "build",
30
+ title: "TestingBot build",
31
+ description: "The tests in a build with their status.",
32
+ mimeType: "application/json",
33
+ },
34
+ ];
35
+ export const STATIC_RESOURCES = [
36
+ {
37
+ uri: "testingbot://insights/flaky-tests",
38
+ name: "flaky-tests",
39
+ title: "Flaky tests",
40
+ description: "Tests that both passed and failed in the last 30 days, most flaky first. Add ?time_range=7d to change the window.",
41
+ mimeType: "application/json",
42
+ },
43
+ ];
44
+ function json(uri, body) {
45
+ return { uri, mimeType: "application/json", text: JSON.stringify(body, null, 2) };
46
+ }
47
+ function cleanId(raw) {
48
+ const id = sanitizeSessionId(decodeURIComponent(raw));
49
+ if (!id)
50
+ throw new Error("Empty ID in resource URI");
51
+ return id;
52
+ }
53
+ async function fetchLogTail(url) {
54
+ const response = await fetch(url, { signal: AbortSignal.timeout(LOG_TIMEOUT_MS) });
55
+ if (!response.ok)
56
+ throw new Error(`HTTP ${response.status} fetching log`);
57
+ const text = await response.text();
58
+ if (text.length <= MAX_LOG_BYTES)
59
+ return text;
60
+ return `… (truncated ${text.length - MAX_LOG_BYTES} bytes) …\n` + text.slice(-MAX_LOG_BYTES);
61
+ }
62
+ export async function readResource(testingBotApi, uri) {
63
+ let parsed;
64
+ try {
65
+ parsed = new URL(uri);
66
+ }
67
+ catch {
68
+ throw new Error(`Invalid resource URI: ${uri}`);
69
+ }
70
+ if (parsed.protocol !== "testingbot:")
71
+ throw new Error(`Unknown resource URI: ${uri}`);
72
+ // For testingbot://tests/abc the "host" is "tests" and the path is "/abc".
73
+ const parts = [parsed.host, ...parsed.pathname.split("/").filter(Boolean)];
74
+ if (parts[0] === "tests" && parts.length === 2) {
75
+ const test = await testingBotApi.getTestDetails(cleanId(parts[1]), {
76
+ skip_fields: "steps",
77
+ });
78
+ return { contents: [json(uri, test)] };
79
+ }
80
+ if (parts[0] === "tests" && parts.length === 4 && parts[2] === "logs") {
81
+ const id = cleanId(parts[1]);
82
+ const logType = parts[3];
83
+ if (!LOG_TYPES.includes(logType)) {
84
+ throw new Error(`Unknown log type "${logType}". Use one of: ${LOG_TYPES.join(", ")}`);
85
+ }
86
+ const test = await testingBotApi.getTestDetails(id);
87
+ const url = test?.logs && typeof test.logs === "object" ? test.logs[logType] : undefined;
88
+ if (!url)
89
+ throw new Error(`Test ${id} has no ${logType} log`);
90
+ return { contents: [{ uri, mimeType: "text/plain", text: await fetchLogTail(url) }] };
91
+ }
92
+ if (parts[0] === "builds" && parts.length === 2) {
93
+ const tests = await testingBotApi.getTestsForBuild(cleanId(parts[1]));
94
+ return { contents: [json(uri, tests)] };
95
+ }
96
+ if (parts[0] === "insights" && parts[1] === "flaky-tests" && parts.length === 2) {
97
+ const range = parsed.searchParams.get("time_range") || "30d";
98
+ if (!/^\d{1,3}[hdw]$/.test(range))
99
+ throw new Error("time_range must look like 24h, 7d or 4w");
100
+ const body = await testingBotApi.request({
101
+ method: "GET",
102
+ url: "/insights/test-cases",
103
+ data: { sort: "flaky", sort_order: "desc", time_range: range, count: 50 },
104
+ });
105
+ const rows = Array.isArray(body?.data) ? body.data.filter((r) => r?.flaky) : [];
106
+ return { contents: [json(uri, { time_range: range, flaky_tests: rows, meta: body?.meta })] };
107
+ }
108
+ throw new Error(`Unknown resource URI: ${uri}`);
109
+ }
110
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["../src/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,4EAA4E;AAC5E,mEAAmE;AACnE,EAAE;AACF,wEAAwE;AACxE,iFAAiF;AACjF,4EAA4E;AAC5E,4EAA4E;AAE5E,MAAM,SAAS,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AACpE,MAAM,aAAa,GAAG,OAAO,CAAC;AAC9B,MAAM,cAAc,GAAG,MAAM,CAAC;AAE9B,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC;QACE,WAAW,EAAE,gCAAgC;QAC7C,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,iBAAiB;QACxB,WAAW,EACT,mGAAmG;QACrG,QAAQ,EAAE,kBAAkB;KAC7B;IACD;Q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C,CAAC,KAAK,aAAa,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChF,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC;QAC7D,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC9F,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC;YACvC,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,sBAAsB;YAC3B,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;SAC1E,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACrF,OAAO,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;IAC/F,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,EAAE,CAAC,CAAC;AAClD,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { Server as McpServer } from "@modelcontextprotocol/sdk/server/index.js";
2
2
  import { TestingBotConfig } from "./lib/types.js";
3
+ import { toolInputSchema } from "@testingbot/automation-mcp";
3
4
  export declare class TestingBotMcpServer {
4
5
  server: McpServer;
5
6
  tools: Record<string, any>;
@@ -9,6 +10,13 @@ export declare class TestingBotMcpServer {
9
10
  private closing;
10
11
  constructor(testingBotApi: any, config: TestingBotConfig);
11
12
  private setupHandlers;
13
+ handleResourceRead(uri: string): Promise<{
14
+ contents: {
15
+ uri: string;
16
+ mimeType: string;
17
+ text: string;
18
+ }[];
19
+ }>;
12
20
  listTools(): Array<{
13
21
  name: string;
14
22
  description: string;
@@ -35,5 +43,5 @@ export declare class TestingBotMcpServer {
35
43
  run(): Promise<void>;
36
44
  close(): Promise<void>;
37
45
  }
38
- export declare function toolInputSchema(shape: Record<string, any> | undefined): any;
46
+ export { toolInputSchema };
39
47
  //# sourceMappingURL=server-factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-factory.d.ts","sourceRoot":"","sources":["../src/server-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAGhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA2BlD,qBAAa,mBAAmB;IACvB,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACvC,OAAO,CAAC,aAAa,CAAM;IAC3B,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,UAAU,CAAiC;IACnD,OAAO,CAAC,OAAO,CAAS;gBAEZ,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB;IAsBxD,OAAO,CAAC,aAAa;IAsBd,SAAS,IAAI,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,GAAG,CAAA;KAAE,CAAC;IAUrE,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAyB1E,OAAO,CAAC,cAAc;IAST,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IAkCpD,OAAO,CAAC,kBAAkB;IA2B1B;;;;;OAKG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C;IAgC1E,OAAO,CAAC,cAAc;IAST,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IAkCpD,OAAO,CAAC,kBAAkB;IA8B1B;;;;;OAKG;YACW,uBAAuB;IAM9B,IAAI,CACT,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,GAAG,EACX,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC;;;;wBAApB,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC;;IAezB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAgC1B,GAAG;IAQH,KAAK;CA0BnB;AAID,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import { Server as McpServer } from "@modelcontextprotocol/sdk/server/index.js";
2
2
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
- import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
3
+ import { CallToolRequestSchema, GetPromptRequestSchema, ListPromptsRequestSchema, ListResourceTemplatesRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
4
+ import { getPrompt, listPrompts } from "./prompts.js";
5
+ import { RESOURCE_TEMPLATES, STATIC_RESOURCES, readResource } from "./resources.js";
4
6
  import logger from "./lib/logger.js";
5
7
  import { createRequire } from "module";
6
- import { z } from "zod";
7
- import { zodToJsonSchema } from "zod-to-json-schema";
8
8
  const require = createRequire(import.meta.url);
9
9
  const packageJson = require("../package.json");
10
10
  import addBrowserTools from "./tools/browsers.js";
@@ -19,11 +19,14 @@ import addCdpTools from "./tools/cdp.js";
19
19
  import addTunnelTools from "./tools/tunnels.js";
20
20
  import { tunnelManager } from "./lib/tunnel-manager.js";
21
21
  import addLogTools from "./tools/logs.js";
22
+ import addVisualTools from "./tools/visual.js";
23
+ import addAccessibilityTools from "./tools/accessibility.js";
24
+ import addAiAnalysisTools from "./tools/ai-analysis.js";
22
25
  import addProjectTools from "./tools/project.js";
23
26
  import addMaestroTools from "./tools/maestro.js";
24
27
  import addAppAutomateTools from "./tools/app-automate.js";
25
28
  import addAuthTools from "./tools/auth.js";
26
- import { addAutomationTools } from "@testingbot/automation-mcp";
29
+ import { addAutomationTools, invalidArgsResult, parseToolArgs, toolInputSchema, } from "@testingbot/automation-mcp";
27
30
  export class TestingBotMcpServer {
28
31
  server;
29
32
  tools = {};
@@ -42,6 +45,11 @@ export class TestingBotMcpServer {
42
45
  // listChanged lets us notify clients when tb_login re-registers
43
46
  // credential-dependent (automation) tools after a successful login.
44
47
  tools: { listChanged: true },
48
+ // Task recipes ("why did my test fail", "summarise a build", "find
49
+ // flaky tests") and read-only test/build/log data (src/prompts.ts,
50
+ // src/resources.ts).
51
+ prompts: {},
52
+ resources: {},
45
53
  },
46
54
  });
47
55
  this.registerLocalTools();
@@ -59,6 +67,25 @@ export class TestingBotMcpServer {
59
67
  logger.info({ tool: toolName, args: toolArgs }, "Tool called");
60
68
  return this.handleToolCall(toolName, toolArgs);
61
69
  });
70
+ this.server.setRequestHandler(ListPromptsRequestSchema, async () => ({
71
+ prompts: listPrompts(),
72
+ }));
73
+ this.server.setRequestHandler(GetPromptRequestSchema, async (request) => getPrompt(request.params.name, (request.params.arguments ?? {})));
74
+ this.server.setRequestHandler(ListResourcesRequestSchema, async () => ({
75
+ resources: STATIC_RESOURCES,
76
+ }));
77
+ this.server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => ({
78
+ resourceTemplates: RESOURCE_TEMPLATES,
79
+ }));
80
+ this.server.setRequestHandler(ReadResourceRequestSchema, async (request) => this.handleResourceRead(request.params.uri));
81
+ }
82
+ // Same degraded-mode rule as tools: without credentials, say how to log in.
83
+ async handleResourceRead(uri) {
84
+ if (!this.hasCredentials()) {
85
+ throw new Error("No TestingBot credentials configured. Run the tb_login tool to authenticate, or set TESTINGBOT_KEY and TESTINGBOT_SECRET.");
86
+ }
87
+ logger.info({ uri }, "Resource read");
88
+ return readResource(this.testingBotApi, uri);
62
89
  }
63
90
  // The tools/list payload. Proxied tools (e.g. appium-mcp) pre-stash a raw
64
91
  // JSON Schema on the tool object; honor it. Local tools carry a dict of Zod
@@ -94,7 +121,16 @@ export class TestingBotMcpServer {
94
121
  isError: true,
95
122
  };
96
123
  }
97
- return tool.handler(toolArgs);
124
+ // Proxied tools (appium-mcp) carry a raw JSON Schema and check their own
125
+ // arguments. Local tools are parsed against their Zod shape, so a missing
126
+ // or wrong argument comes back as a clear message instead of a crash
127
+ // inside the handler, and handlers get defaults and coercions applied.
128
+ if (tool.inputSchema)
129
+ return tool.handler(toolArgs);
130
+ const parsed = parseToolArgs(tool.schema, toolArgs);
131
+ if (!parsed.success)
132
+ return invalidArgsResult(toolName, parsed.message);
133
+ return tool.handler(parsed.data);
98
134
  }
99
135
  hasCredentials() {
100
136
  return Boolean(this.config["testingbot-key"] && this.config["testingbot-secret"]);
@@ -149,6 +185,9 @@ export class TestingBotMcpServer {
149
185
  addCdpTools,
150
186
  addTunnelTools,
151
187
  addLogTools,
188
+ addVisualTools,
189
+ addAccessibilityTools,
190
+ addAiAnalysisTools,
152
191
  addProjectTools,
153
192
  addMaestroTools,
154
193
  addAppAutomateTools,
@@ -243,16 +282,7 @@ export class TestingBotMcpServer {
243
282
  }
244
283
  }
245
284
  }
246
- // Converts a tool's Zod shape (`{ arg: z.string(), ... }`) to the JSON Schema
247
- // object MCP expects as `inputSchema`. Inline everything ($refStrategy none):
248
- // MCP clients do not resolve $ref, and a reused sub-schema would otherwise be
249
- // emitted as a reference to a definition that is not part of the payload.
250
- export function toolInputSchema(shape) {
251
- const converted = zodToJsonSchema(z.object(shape ?? {}), {
252
- target: "jsonSchema7",
253
- $refStrategy: "none",
254
- });
255
- delete converted.$schema;
256
- return converted;
257
- }
285
+ // Shared with @testingbot/automation-mcp: one Zod → JSON Schema conversion for
286
+ // every tool this server lists, and the same argument checks.
287
+ export { toolInputSchema };
258
288
  //# sourceMappingURL=server-factory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-factory.js","sourceRoot":"","sources":["../src/server-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAEnG,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE/C,OAAO,eAAe,MAAM,qBAAqB,CAAC;AAClD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,eAAe,MAAM,oBAAoB,CAAC;AACjD,OAAO,kBAAkB,MAAM,wBAAwB,CAAC;AACxD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,eAAe,MAAM,oBAAoB,CAAC;AACjD,OAAO,eAAe,MAAM,oBAAoB,CAAC;AACjD,OAAO,mBAAmB,MAAM,yBAAyB,CAA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