@testingbot/mcp-server 1.0.1 → 1.0.2

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.
Files changed (50) hide show
  1. package/README.md +112 -4
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/config.js +21 -8
  4. package/dist/config.js.map +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +39 -16
  8. package/dist/index.js.map +1 -1
  9. package/dist/lib/credentials.d.ts +19 -0
  10. package/dist/lib/credentials.d.ts.map +1 -0
  11. package/dist/lib/credentials.js +128 -0
  12. package/dist/lib/credentials.js.map +1 -0
  13. package/dist/lib/logger.d.ts.map +1 -1
  14. package/dist/lib/logger.js +45 -19
  15. package/dist/lib/logger.js.map +1 -1
  16. package/dist/lib/types.d.ts +9 -3
  17. package/dist/lib/types.d.ts.map +1 -1
  18. package/dist/server-factory.d.ts +15 -1
  19. package/dist/server-factory.d.ts.map +1 -1
  20. package/dist/server-factory.js +136 -10
  21. package/dist/server-factory.js.map +1 -1
  22. package/dist/silence-wdio.d.ts +2 -0
  23. package/dist/silence-wdio.d.ts.map +1 -0
  24. package/dist/silence-wdio.js +17 -0
  25. package/dist/silence-wdio.js.map +1 -0
  26. package/dist/tools/auth.d.ts +43 -0
  27. package/dist/tools/auth.d.ts.map +1 -0
  28. package/dist/tools/auth.js +571 -0
  29. package/dist/tools/auth.js.map +1 -0
  30. package/dist/tools/browsers.d.ts.map +1 -1
  31. package/dist/tools/browsers.js +2 -1
  32. package/dist/tools/browsers.js.map +1 -1
  33. package/dist/tools/logs.d.ts +3 -0
  34. package/dist/tools/logs.d.ts.map +1 -0
  35. package/dist/tools/logs.js +135 -0
  36. package/dist/tools/logs.js.map +1 -0
  37. package/dist/tools/project.d.ts +16 -0
  38. package/dist/tools/project.d.ts.map +1 -0
  39. package/dist/tools/project.js +457 -0
  40. package/dist/tools/project.js.map +1 -0
  41. package/dist/tools/storage.d.ts.map +1 -1
  42. package/dist/tools/storage.js +94 -8
  43. package/dist/tools/storage.js.map +1 -1
  44. package/dist/tools/tests.d.ts.map +1 -1
  45. package/dist/tools/tests.js +8 -6
  46. package/dist/tools/tests.js.map +1 -1
  47. package/dist/tools/user.d.ts.map +1 -1
  48. package/dist/tools/user.js +24 -6
  49. package/dist/tools/user.js.map +1 -1
  50. package/package.json +10 -3
package/README.md CHANGED
@@ -5,6 +5,14 @@
5
5
 
6
6
  TestingBot's official Model Context Protocol (MCP) server implementation. This server enables AI assistants to interact with TestingBot's testing infrastructure, allowing you to manage tests, browsers, devices, and more through conversational interfaces.
7
7
 
8
+ ## ⚡ One-Click Install
9
+
10
+ [![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)
11
+
12
+ **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
+
14
+ After install, set your credentials from [TestingBot account settings](https://testingbot.com/members/user/security).
15
+
8
16
  ## Features
9
17
 
10
18
  - 🖥️ **Live Testing** - Start interactive manual testing sessions on real browsers and devices
@@ -42,9 +50,29 @@ npm install @testingbot/mcp-server
42
50
 
43
51
  ### Configuration
44
52
 
53
+ #### Recommended: log in with `tb_login` (no key/secret to copy)
54
+
55
+ You don't have to find and paste API credentials. Install the server, leave the
56
+ credentials blank, and just ask the agent:
57
+
58
+ > Log me in to TestingBot.
59
+
60
+ The agent calls the **`tb_login`** tool, which prints a short URL and code:
61
+
62
+ 1. Open the URL in your browser (e.g. `https://testingbot.com/device`).
63
+ 2. Enter the code, sign in if needed, and click **Authorize**.
64
+ 3. Tell the agent you've authorized — it calls `tb_login` again to finish.
65
+
66
+ Your credentials are written to `~/.testingbot/credentials` (mode `0600`) and
67
+ used by every subsequent tool call — no restart, no JSON editing, and no secret
68
+ ever leaves the browser. This works in any MCP client (VS Code, Cursor, Cline,
69
+ Claude Desktop, …). To use a different account, set `TESTINGBOT_PROFILE`; to
70
+ relocate the file, set `TESTINGBOT_CONFIG_DIR`.
71
+
45
72
  #### Environment Variables
46
73
 
47
- Set your TestingBot credentials as environment variables:
74
+ Alternatively (or for CI, where env vars take precedence over the file), set your
75
+ TestingBot credentials as environment variables:
48
76
 
49
77
  ```bash
50
78
  export TESTINGBOT_KEY="your-api-key"
@@ -116,6 +144,15 @@ Add to `.cursor/mcp.json`:
116
144
  }
117
145
  ```
118
146
 
147
+ ## 🤖 Let an AI Agent Drive a Remote Browser or Device
148
+
149
+ This server already includes the automation tools from [`@testingbot/automation-mcp`](https://github.com/testingbot/automation-mcp) — installing this package gives the agent the ability to **actually drive** a remote browser or real mobile device on TestingBot's grid, not just manage resources.
150
+
151
+ Just ask:
152
+ > Open Safari 17 on macOS on TestingBot. Navigate to example.com and click the "More information" link.
153
+
154
+ The agent will call `tb_openBrowser`, `tb_navigate`, `tb_snapshot`, `tb_click` — and surface a **live-view URL** so you can watch it in real time. For real iOS / Android devices, the bundled [`appium-mcp`](https://github.com/appium/appium-mcp) child gives the agent the full `appium_*` toolbelt (`appium_session_management`, `appium_gesture`, `appium_set_value`, `appium_screenshot`, ~30 more) — no separate install or config required. Just ask: _"Open an iPhone 15 Pro on iOS 17 on TestingBot, tap the login button, take a screenshot."_ See the [`@testingbot/automation-mcp` README](https://github.com/testingbot/automation-mcp#readme) for the full tool list, caveats (sessions are metered), and configuration options.
155
+
119
156
  ## Available Tools
120
157
 
121
158
  ### Live Testing
@@ -530,6 +567,9 @@ npm run lint
530
567
 
531
568
  # Format code
532
569
  npm run format
570
+
571
+ # Build the .mcpb bundle for Claude Desktop (see section below)
572
+ npm run mcpb
533
573
  ```
534
574
 
535
575
  ### Running Locally
@@ -552,6 +592,73 @@ npx @modelcontextprotocol/inspector node dist/index.js
552
592
 
553
593
  Then open http://localhost:5173 in your browser.
554
594
 
595
+ ### Building the `.mcpb` bundle (Claude Desktop release)
596
+
597
+ The `.mcpb` archive is what users double-click to install in Claude Desktop. The installer reads `manifest.json#user_config` and shows a credential prompt — no JSON editing or env-var fiddling.
598
+
599
+ ```bash
600
+ # Prerequisites: mcpb CLI (one-time)
601
+ npm install -g @anthropic-ai/mcpb
602
+
603
+ # Build the bundle
604
+ npm run mcpb
605
+ ```
606
+
607
+ This runs `scripts/build-mcpb.sh`, which:
608
+
609
+ 1. Runs the full quality pipeline (`npm run build` → lint → format → test → tsc).
610
+ 2. Stages a clean tree in a temp directory (only `dist/`, `manifest.json`, `package.json`, `LICENSE`, `README.md`, `icon.png` if present).
611
+ 3. Runs `npm ci --omit=dev` inside staging — dev deps (typescript, eslint, vitest) never enter the bundle. `@testingbot/automation-mcp` is pulled from npm at the version pinned in `package.json`.
612
+ 4. Validates the manifest and runs `mcpb pack` honoring `.mcpbignore` (strips test fixtures, source maps, dependency changelogs).
613
+ 5. Writes `releases/testingbot-mcp-server-<version>.mcpb` and runs `mcpb info` on it.
614
+
615
+ Output is roughly 160 MB — most of that is the bundled `appium-mcp` mobile driver stack (XCUITest, UiAutomator2). The bundle is paid for once at install, not at runtime.
616
+
617
+ #### Sibling repo during development
618
+
619
+ For active development on both `@testingbot/mcp-server` and `@testingbot/automation-mcp` in lockstep, use `npm run dev:rebuild` from this repo. It builds both, then `npm link`s the sibling into this repo's `node_modules` so edits in `../testingbot-automation-mcp/src/` take effect on the next rebuild without a republish.
620
+
621
+ The link is one-shot — once set up, `dev:rebuild` notices it's in place and just builds. If you ever run `npm install` in this repo, the link is replaced with the registry copy; rerun `dev:rebuild` to restore.
622
+
623
+ #### Releasing
624
+
625
+ The release flow has two coordinated publish steps:
626
+
627
+ 1. **Publish `@testingbot/automation-mcp` to npm** (from `../testingbot-automation-mcp`):
628
+ ```bash
629
+ npm version patch # or minor / major
630
+ npm publish # publishConfig.access is "public" — handles scoped-pkg defaults
631
+ ```
632
+ 2. **Bump this repo to consume the new automation-mcp** and cut a release:
633
+ ```bash
634
+ npm install @testingbot/automation-mcp@latest # updates package-lock.json
635
+ npm version patch # also syncs manifest.json + server.json
636
+ git push --follow-tags
637
+ # → Create a GitHub release at the new tag. The Build MCPB workflow
638
+ # fires on release:published and attaches releases/*.mcpb to it.
639
+ ```
640
+
641
+ The release CI (`.github/workflows/build-mcpb.yml`) runs `npm run mcpb` on `macos-latest` and uploads the bundle as both a workflow artifact (30-day retention) and a release asset. Manual re-build: trigger via the Actions tab → "Build MCPB bundle" → enter the tag.
642
+
643
+ macOS is chosen so the bundled `appium-xcuitest-driver` carries its native bits. If you only target Linux/Windows users, you can switch the runner to `ubuntu-latest` for ~10× cheaper minutes — at the cost of iOS support in the bundled mobile path. Browser tools (via WebDriver) work cross-platform regardless.
644
+
645
+ To validate the manifest without building:
646
+
647
+ ```bash
648
+ npm run mcpb:validate
649
+ ```
650
+
651
+ To inspect a built bundle:
652
+
653
+ ```bash
654
+ mcpb info releases/testingbot-mcp-server-<version>.mcpb
655
+ mcpb unpack releases/testingbot-mcp-server-<version>.mcpb /tmp/unpacked # see what's inside
656
+ ```
657
+
658
+ The bundle is unsigned. To sign for distribution, run `mcpb sign --self-signed` (smoke-test) or `mcpb sign` with a real cert. See `mcpb sign --help`.
659
+
660
+ `releases/*.mcpb` is gitignored — upload the artefact to the GitHub releases page (or wherever your install URL points at) after building.
661
+
555
662
  ## Project Structure
556
663
 
557
664
  ```
@@ -589,9 +696,10 @@ testingbot-mcp-server/
589
696
  ### Authentication Errors
590
697
 
591
698
  If you see authentication errors:
592
- 1. Verify your credentials at https://testingbot.com/members/user/edit
593
- 2. Ensure environment variables are set correctly
594
- 3. Check that there are no extra spaces in your credentials
699
+ 1. Run the `tb_login` tool (just ask the agent to "log me in to TestingBot") — the simplest fix, no key/secret needed
700
+ 2. Or verify your credentials at https://testingbot.com/members/user/security
701
+ 3. Ensure environment variables are set correctly (env vars override the `tb_login` credentials file)
702
+ 4. Check that there are no extra spaces in your credentials
595
703
 
596
704
  ### Connection Issues
597
705
 
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKlD,wBAAgB,SAAS,IAAI,gBAAgB,CAmB5C"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAwBlD,wBAAgB,SAAS,IAAI,gBAAgB,CAY5C"}
package/dist/config.js CHANGED
@@ -1,18 +1,31 @@
1
1
  import dotenv from "dotenv";
2
- import { AuthenticationError } from "./lib/error.js";
2
+ import { loadFromCredentialsFile } from "./lib/credentials.js";
3
3
  dotenv.config();
4
- export function getConfig() {
4
+ function fromEnv() {
5
5
  const key = process.env.TESTINGBOT_KEY || process.env.TB_KEY || process.env.TESTINGBOT_USERNAME || "";
6
6
  const secret = process.env.TESTINGBOT_SECRET ||
7
7
  process.env.TB_SECRET ||
8
8
  process.env.TESTINGBOT_ACCESS_KEY ||
9
9
  "";
10
- if (!key || !secret) {
11
- throw new AuthenticationError("TestingBot credentials not found. Please set TESTINGBOT_KEY and TESTINGBOT_SECRET environment variables.");
10
+ return { key, secret };
11
+ }
12
+ // Resolve TestingBot credentials. Precedence, highest first:
13
+ // 1. Environment variables (lets CI / MCP-client config override) — both a
14
+ // key and a secret must be present to count.
15
+ // 2. The credentials file written by the `tb_login` device-auth tool
16
+ // (~/.testingbot/credentials, profile `default` or $TESTINGBOT_PROFILE).
17
+ // 3. Neither: return empty strings. The server then runs in a degraded mode
18
+ // where every tool except `tb_login` reports "Run tb_login to authenticate"
19
+ // — making the first-run experience self-healing rather than a hard crash.
20
+ export function getConfig() {
21
+ const env = fromEnv();
22
+ if (env.key && env.secret) {
23
+ return { "testingbot-key": env.key, "testingbot-secret": env.secret };
24
+ }
25
+ const file = loadFromCredentialsFile();
26
+ if (file) {
27
+ return { "testingbot-key": file.key, "testingbot-secret": file.secret };
12
28
  }
13
- return {
14
- "testingbot-key": key,
15
- "testingbot-secret": secret,
16
- };
29
+ return { "testingbot-key": "", "testingbot-secret": "" };
17
30
  }
18
31
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,UAAU,SAAS;IACvB,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,EAAE,CAAC;IAC5F,MAAM,MAAM,GACV,OAAO,CAAC,GAAG,CAAC,iBAAiB;QAC7B,OAAO,CAAC,GAAG,CAAC,SAAS;QACrB,OAAO,CAAC,GAAG,CAAC,qBAAqB;QACjC,EAAE,CAAC;IAEL,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,mBAAmB,CAC3B,0GAA0G,CAC3G,CAAC;IACJ,CAAC;IAED,OAAO;QACL,gBAAgB,EAAE,GAAG;QACrB,mBAAmB,EAAE,MAAM;KAC5B,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,SAAS,OAAO;IACd,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,EAAE,CAAC;IAC5F,MAAM,MAAM,GACV,OAAO,CAAC,GAAG,CAAC,iBAAiB;QAC7B,OAAO,CAAC,GAAG,CAAC,SAAS;QACrB,OAAO,CAAC,GAAG,CAAC,qBAAqB;QACjC,EAAE,CAAC;IACL,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;AACzB,CAAC;AAED,6DAA6D;AAC7D,6EAA6E;AAC7E,kDAAkD;AAClD,uEAAuE;AACvE,8EAA8E;AAC9E,8EAA8E;AAC9E,iFAAiF;AACjF,gFAAgF;AAChF,MAAM,UAAU,SAAS;IACvB,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;IACtB,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QAC1B,OAAO,EAAE,gBAAgB,EAAE,GAAG,CAAC,GAAG,EAAE,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;IACxE,CAAC;IAED,MAAM,IAAI,GAAG,uBAAuB,EAAE,CAAC;IACvC,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,GAAG,EAAE,mBAAmB,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IAC1E,CAAC;IAED,OAAO,EAAE,gBAAgB,EAAE,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE,CAAC;AAC3D,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- export {};
2
+ import "./silence-wdio.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAKA,OAAO,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env node
2
+ // MUST be first: sets WDIO_LOG_LEVEL before any module pulls in `webdriver`, which
3
+ // would otherwise log to stdout and corrupt the stdio JSON-RPC stream. See the
4
+ // module for why a plain top-level assignment here is too late (ESM hoisting).
5
+ import "./silence-wdio.js";
2
6
  import { getConfig } from "./config.js";
3
7
  import { TestingBotMcpServer } from "./server-factory.js";
4
8
  import logger from "./lib/logger.js";
@@ -6,21 +10,40 @@ import { createRequire } from "module";
6
10
  const require = createRequire(import.meta.url);
7
11
  const TestingBot = require("testingbot-api");
8
12
  async function main() {
9
- try {
10
- logger.info("Starting TestingBot MCP Server...");
11
- const config = getConfig();
12
- const testingBotApi = new TestingBot({
13
- api_key: config["testingbot-key"],
14
- api_secret: config["testingbot-secret"],
15
- });
16
- const mcpServer = new TestingBotMcpServer(testingBotApi, config);
17
- await mcpServer.run();
18
- }
19
- catch (error) {
20
- logger.error({ error }, "Failed to start server");
21
- console.error("Error starting TestingBot MCP Server:", error);
22
- process.exit(1);
23
- }
13
+ logger.info("Starting TestingBot MCP Server...");
14
+ const config = getConfig();
15
+ const testingBotApi = new TestingBot({
16
+ api_key: config["testingbot-key"],
17
+ api_secret: config["testingbot-secret"],
18
+ });
19
+ const mcpServer = new TestingBotMcpServer(testingBotApi, config);
20
+ let shuttingDown = false;
21
+ const shutdown = async (signal, exitCode = 0) => {
22
+ if (shuttingDown)
23
+ return;
24
+ shuttingDown = true;
25
+ logger.info({ signal }, "Shutting down TestingBot MCP Server");
26
+ try {
27
+ await mcpServer.close();
28
+ }
29
+ finally {
30
+ process.exit(exitCode);
31
+ }
32
+ };
33
+ process.on("SIGINT", () => void shutdown("SIGINT"));
34
+ process.on("SIGTERM", () => void shutdown("SIGTERM"));
35
+ process.on("unhandledRejection", (reason) => {
36
+ logger.error({ reason }, "Unhandled promise rejection");
37
+ void shutdown("unhandledRejection", 1);
38
+ });
39
+ process.on("uncaughtException", (error) => {
40
+ logger.error({ error }, "Uncaught exception");
41
+ void shutdown("uncaughtException", 1);
42
+ });
43
+ await mcpServer.run();
24
44
  }
25
- main();
45
+ main().catch((error) => {
46
+ logger.error({ error }, "Failed to start server");
47
+ process.exit(1);
48
+ });
26
49
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE7C,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QAEjD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAE3B,MAAM,aAAa,GAAG,IAAI,UAAU,CAAC;YACnC,OAAO,EAAE,MAAM,CAAC,gBAAgB,CAAC;YACjC,UAAU,EAAE,MAAM,CAAC,mBAAmB,CAAC;SACxC,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,IAAI,mBAAmB,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACjE,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC;IACxB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE,wBAAwB,CAAC,CAAC;QAClD,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;QAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAA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AAQ,CAAC,CAAC;QACzB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpD,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;IACtD,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE;QAC1C,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,6BAA6B,CAAC,CAAC;QACxD,KAAK,QAAQ,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;QACxC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE,oBAAoB,CAAC,CAAC;QAC9C,KAAK,QAAQ,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC;AACxB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE,wBAAwB,CAAC,CAAC;IAClD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ export interface Credentials {
2
+ key: string;
3
+ secret: string;
4
+ }
5
+ export interface DeviceCredentials {
6
+ client_key: string;
7
+ client_secret: string;
8
+ user: {
9
+ email: string;
10
+ id?: number;
11
+ };
12
+ }
13
+ export declare function credentialsDir(): string;
14
+ export declare function credentialsPath(): string;
15
+ export declare function activeProfile(): string;
16
+ export declare function parseCredentialsIni(text: string): Record<string, Record<string, string>>;
17
+ export declare function loadFromCredentialsFile(profile?: string): Credentials | null;
18
+ export declare function writeCredentialsFile(creds: DeviceCredentials): string;
19
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/lib/credentials.ts"],"names":[],"mappings":"AAuBA,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACtC;AAID,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAID,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAkBxF;AAKD,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,MAAwB,GAAG,WAAW,GAAG,IAAI,CAa7F;AA4CD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAgCrE"}
@@ -0,0 +1,128 @@
1
+ import { homedir } from "os";
2
+ import { join } from "path";
3
+ import { existsSync, readFileSync, writeFileSync, mkdirSync, chmodSync, renameSync, statSync, } from "fs";
4
+ const DEFAULT_PROFILE = "default";
5
+ export function credentialsDir() {
6
+ return process.env.TESTINGBOT_CONFIG_DIR || join(homedir(), ".testingbot");
7
+ }
8
+ export function credentialsPath() {
9
+ return join(credentialsDir(), "credentials");
10
+ }
11
+ export function activeProfile() {
12
+ return process.env.TESTINGBOT_PROFILE || DEFAULT_PROFILE;
13
+ }
14
+ // Parse an INI document into { profile: { key: value } }. Tolerates comments
15
+ // (`#` / `;`), blank lines, and values containing `=`.
16
+ export function parseCredentialsIni(text) {
17
+ const out = {};
18
+ let current = null;
19
+ for (const raw of text.split("\n")) {
20
+ const line = raw.trim();
21
+ if (!line || line.startsWith("#") || line.startsWith(";"))
22
+ continue;
23
+ const section = /^\[(.+)\]$/.exec(line);
24
+ if (section) {
25
+ current = section[1].trim();
26
+ out[current] = {};
27
+ continue;
28
+ }
29
+ if (!current)
30
+ continue;
31
+ const eq = line.indexOf("=");
32
+ if (eq < 0)
33
+ continue;
34
+ out[current][line.slice(0, eq).trim()] = line.slice(eq + 1).trim();
35
+ }
36
+ return out;
37
+ }
38
+ // Load credentials from the credentials file for the active profile. Returns
39
+ // null when the file is missing, the profile is absent, or it lacks a complete
40
+ // key/secret pair — callers treat null as "no credentials".
41
+ export function loadFromCredentialsFile(profile = activeProfile()) {
42
+ const path = credentialsPath();
43
+ if (!existsSync(path))
44
+ return null;
45
+ let text;
46
+ try {
47
+ text = readFileSync(path, "utf8");
48
+ }
49
+ catch {
50
+ return null;
51
+ }
52
+ const parsed = parseCredentialsIni(text);
53
+ const p = parsed[profile];
54
+ if (!p?.key || !p?.secret)
55
+ return null;
56
+ return { key: p.key, secret: p.secret };
57
+ }
58
+ // Older versions of testingbot-api stored credentials at ~/.testingbot as a
59
+ // single FILE in `key:secret` form (see node_modules/testingbot-api/lib/api.js
60
+ // _loadConfig). Our directory layout collides with that path, so mkdirSync would
61
+ // throw EEXIST. Move the legacy file aside (preserving it) before creating the
62
+ // directory. Returns the backup path, or null if there was nothing to move.
63
+ function relocateLegacyCredentialFile(dir) {
64
+ if (!existsSync(dir) || !statSync(dir).isFile())
65
+ return null;
66
+ for (let i = 0; i < 100; i++) {
67
+ const target = i === 0 ? `${dir}.legacy.bak` : `${dir}.legacy.bak.${i}`;
68
+ if (!existsSync(target)) {
69
+ renameSync(dir, target);
70
+ return target;
71
+ }
72
+ }
73
+ throw new Error(`${dir} exists as a legacy credentials file and could not be moved aside. ` +
74
+ `Rename or remove it manually, then run tb_login again.`);
75
+ }
76
+ function serializeCredentialsIni(profiles, accountEmail) {
77
+ const lines = [
78
+ `# Written by @testingbot/mcp-server tb_login at ${new Date().toISOString()}`,
79
+ `# Account: ${accountEmail}`,
80
+ ];
81
+ for (const [name, kv] of Object.entries(profiles)) {
82
+ lines.push(`[${name}]`);
83
+ for (const [k, v] of Object.entries(kv))
84
+ lines.push(`${k} = ${v}`);
85
+ lines.push("");
86
+ }
87
+ return lines.join("\n");
88
+ }
89
+ // Persist credentials returned by the device-auth flow into the active profile.
90
+ // Creates the directory (0700) and file (0600) with restrictive permissions —
91
+ // same UNIX convention as ~/.aws/credentials and ~/.ssh. Returns the file path.
92
+ //
93
+ // Other profiles already present in the file are preserved (read-merge-write):
94
+ // authenticating under TESTINGBOT_PROFILE=team must not wipe [default].
95
+ export function writeCredentialsFile(creds) {
96
+ const dir = credentialsDir();
97
+ relocateLegacyCredentialFile(dir);
98
+ mkdirSync(dir, { recursive: true, mode: 0o700 });
99
+ try {
100
+ chmodSync(dir, 0o700);
101
+ }
102
+ catch {
103
+ // Best effort — chmod is a no-op / may be unsupported on some platforms.
104
+ }
105
+ const path = credentialsPath();
106
+ const profiles = existsSync(path) ? parseCredentialsIni(readFileSync(path, "utf8")) : {};
107
+ // Merge into the active profile (preserve any extra keys it already held) and
108
+ // leave all other profiles untouched.
109
+ profiles[activeProfile()] = {
110
+ ...profiles[activeProfile()],
111
+ key: creds.client_key,
112
+ secret: creds.client_secret,
113
+ };
114
+ // Write to a fresh temp file (so mode 0600 applies at creation — writeFileSync's
115
+ // mode is ignored for a pre-existing world-readable file) and rename atomically
116
+ // over the target. This guarantees the secret is never briefly world-readable.
117
+ const tmp = `${path}.tmp`;
118
+ writeFileSync(tmp, serializeCredentialsIni(profiles, creds.user.email), { mode: 0o600 });
119
+ try {
120
+ chmodSync(tmp, 0o600);
121
+ }
122
+ catch {
123
+ // Best effort — chmod is a no-op / may be unsupported on some platforms.
124
+ }
125
+ renameSync(tmp, path);
126
+ return path;
127
+ }
128
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/lib/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EACL,UAAU,EACV,YAAY,EACZ,aAAa,EACb,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,GACT,MAAM,IAAI,CAAC;AAwBZ,MAAM,eAAe,GAAG,SAAS,CAAC;AAElC,MAAM,UAAU,cAAc;IAC5B,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,IAAI,CAAC,cAAc,EAAE,EAAE,aAAa,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,eAAe,CAAC;AAC3D,CAAC;AAED,6EAA6E;AAC7E,uDAAuD;AACvD,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,MAAM,GAAG,GAA2C,EAAE,CAAC;IACvD,IAAI,OAAO,GAAkB,IAAI,CAAC;IAClC,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QACxB,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QACpE,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,IAA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E;IAC3E,CAAC;IACD,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACtB,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAwBxB,QAAA,MAAM,MAAM,6BAyBV,CAAC;AAOH,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AA0CxB,QAAA,MAAM,MAAM,6BAoCR,CAAC;AAOL,eAAe,MAAM,CAAC"}
@@ -17,32 +17,58 @@ if (debugToFile) {
17
17
  }
18
18
  logFilePath = path.join(logsDir, `debug.log`);
19
19
  }
20
- // Configure logger based on debug mode
21
- const logger = pino({
22
- level: logLevel,
23
- transport: debugToFile && logFilePath
24
- ? {
25
- target: "pino-pretty",
26
- options: {
27
- colorize: false,
28
- translateTime: "yyyy-mm-dd HH:MM:ss",
29
- ignore: "pid,hostname",
30
- destination: logFilePath,
31
- mkdir: true,
20
+ // Redact known credential / sensitive fields from any logged object.
21
+ const redactPaths = [
22
+ "*.api_key",
23
+ "*.api_secret",
24
+ "*.apiKey",
25
+ "*.apiSecret",
26
+ "*.password",
27
+ "*.authorization",
28
+ "*.Authorization",
29
+ "options.api_key",
30
+ "options.api_secret",
31
+ "args.localFilePath",
32
+ "args.remoteUrl",
33
+ "args.extra",
34
+ "headers.authorization",
35
+ ];
36
+ // MCP servers communicate over stdio — stdout is reserved for JSON-RPC framing.
37
+ // All log output MUST go to stderr (fd 2) or a file; never to stdout.
38
+ const logger = (() => {
39
+ const base = { level: logLevel, redact: { paths: redactPaths, censor: "[redacted]" } };
40
+ if (debugToFile && logFilePath) {
41
+ return pino({
42
+ ...base,
43
+ transport: {
44
+ target: "pino-pretty",
45
+ options: {
46
+ colorize: false,
47
+ translateTime: "yyyy-mm-dd HH:MM:ss",
48
+ ignore: "pid,hostname",
49
+ destination: logFilePath,
50
+ mkdir: true,
51
+ },
32
52
  },
33
- }
34
- : isDevMode
35
- ? {
53
+ });
54
+ }
55
+ if (isDevMode) {
56
+ return pino({
57
+ ...base,
58
+ transport: {
36
59
  target: "pino-pretty",
37
60
  options: {
38
61
  colorize: true,
39
62
  translateTime: "HH:MM:ss Z",
40
63
  ignore: "pid,hostname",
41
- destination: 2, // Write to stderr (fd 2) instead of stdout
64
+ destination: 2,
42
65
  },
43
- }
44
- : undefined,
45
- });
66
+ },
67
+ });
68
+ }
69
+ // Production: raw JSON straight to stderr — never stdout.
70
+ return pino(base, pino.destination(2));
71
+ })();
46
72
  if (debugToFile && logFilePath) {
47
73
  // Log to stderr so it appears in Claude Desktop logs
48
74
  console.error(`🐛 Debug logging enabled: ${logFilePath}`);
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,6DAA6D;AAC7D,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,KAAK,MAAM,CAAC;AAC5D,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC3F,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC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: string;
42
- last_name: string;
43
- email: string;
41
+ first_name?: string;
42
+ last_name?: string;
43
+ email?: string;
44
+ plan?: string;
45
+ company?: string;
46
+ country?: string;
47
+ seconds?: number;
48
+ max_concurrent?: number;
49
+ max_concurrent_mobile?: number;
44
50
  [key: string]: any;
45
51
  }
46
52
  export interface Screenshot {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,OAAO;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,IAAI;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,I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EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,EAAE,EAAE,MAAM,CAAC;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB"}
@@ -5,15 +5,29 @@ export declare class TestingBotMcpServer {
5
5
  tools: Record<string, any>;
6
6
  private testingBotApi;
7
7
  private config;
8
+ private automation;
9
+ private closing;
8
10
  constructor(testingBotApi: any, config: TestingBotConfig);
9
11
  private setupHandlers;
10
- private registerTools;
12
+ handleToolCall(toolName: string, toolArgs: any): Promise<any>;
13
+ private hasCredentials;
14
+ reinitializeAfterLogin(): Promise<void>;
15
+ private registerLocalTools;
16
+ /**
17
+ * Async tool registration. Currently this spawns the appium-mcp child
18
+ * process bundled with @testingbot/automation-mcp and proxies its full
19
+ * mobile tool surface onto this server. Must complete before the MCP
20
+ * client requests its first tools/list.
21
+ */
22
+ private registerAutomationTools;
11
23
  tool(name: string, description: string, schema: any, handler: (args: any) => Promise<any>): {
12
24
  name: string;
13
25
  description: string;
14
26
  schema: any;
15
27
  handler: (args: any) => Promise<any>;
16
28
  };
29
+ preflight(): Promise<void>;
17
30
  run(): Promise<void>;
31
+ close(): Promise<void>;
18
32
  }
19
33
  //# 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;AAkBlD,qBAAa,mBAAmB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