@testingbot/mcp-server 1.0.1 โ†’ 1.1.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.
Files changed (62) hide show
  1. package/README.md +266 -8
  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/app-automate-client.d.ts +201 -0
  10. package/dist/lib/app-automate-client.d.ts.map +1 -0
  11. package/dist/lib/app-automate-client.js +179 -0
  12. package/dist/lib/app-automate-client.js.map +1 -0
  13. package/dist/lib/credentials.d.ts +19 -0
  14. package/dist/lib/credentials.d.ts.map +1 -0
  15. package/dist/lib/credentials.js +128 -0
  16. package/dist/lib/credentials.js.map +1 -0
  17. package/dist/lib/logger.d.ts.map +1 -1
  18. package/dist/lib/logger.js +45 -19
  19. package/dist/lib/logger.js.map +1 -1
  20. package/dist/lib/types.d.ts +9 -3
  21. package/dist/lib/types.d.ts.map +1 -1
  22. package/dist/server-factory.d.ts +15 -1
  23. package/dist/server-factory.d.ts.map +1 -1
  24. package/dist/server-factory.js +140 -10
  25. package/dist/server-factory.js.map +1 -1
  26. package/dist/silence-wdio.d.ts +2 -0
  27. package/dist/silence-wdio.d.ts.map +1 -0
  28. package/dist/silence-wdio.js +17 -0
  29. package/dist/silence-wdio.js.map +1 -0
  30. package/dist/tools/app-automate.d.ts +3 -0
  31. package/dist/tools/app-automate.d.ts.map +1 -0
  32. package/dist/tools/app-automate.js +250 -0
  33. package/dist/tools/app-automate.js.map +1 -0
  34. package/dist/tools/auth.d.ts +43 -0
  35. package/dist/tools/auth.d.ts.map +1 -0
  36. package/dist/tools/auth.js +571 -0
  37. package/dist/tools/auth.js.map +1 -0
  38. package/dist/tools/browsers.d.ts.map +1 -1
  39. package/dist/tools/browsers.js +2 -1
  40. package/dist/tools/browsers.js.map +1 -1
  41. package/dist/tools/logs.d.ts +3 -0
  42. package/dist/tools/logs.d.ts.map +1 -0
  43. package/dist/tools/logs.js +135 -0
  44. package/dist/tools/logs.js.map +1 -0
  45. package/dist/tools/maestro.d.ts +3 -0
  46. package/dist/tools/maestro.d.ts.map +1 -0
  47. package/dist/tools/maestro.js +625 -0
  48. package/dist/tools/maestro.js.map +1 -0
  49. package/dist/tools/project.d.ts +16 -0
  50. package/dist/tools/project.d.ts.map +1 -0
  51. package/dist/tools/project.js +589 -0
  52. package/dist/tools/project.js.map +1 -0
  53. package/dist/tools/storage.d.ts.map +1 -1
  54. package/dist/tools/storage.js +94 -8
  55. package/dist/tools/storage.js.map +1 -1
  56. package/dist/tools/tests.d.ts.map +1 -1
  57. package/dist/tools/tests.js +8 -6
  58. package/dist/tools/tests.js.map +1 -1
  59. package/dist/tools/user.d.ts.map +1 -1
  60. package/dist/tools/user.js +24 -6
  61. package/dist/tools/user.js.map +1 -1
  62. package/package.json +11 -3
package/README.md CHANGED
@@ -2,11 +2,21 @@
2
2
 
3
3
  [![NPM Version](https://img.shields.io/npm/v/@testingbot/mcp-server)](https://www.npmjs.com/package/@testingbot/mcp-server)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![MCP Badge](https://lobehub.com/badge/mcp/testingbot-mcp-server)](https://lobehub.com/mcp/testingbot-mcp-server)
5
6
 
6
7
  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
8
 
9
+ ## โšก One-Click Install
10
+
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
+
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.
14
+
15
+ After install, set your credentials from [TestingBot account settings](https://testingbot.com/members/user/security).
16
+
8
17
  ## Features
9
18
 
19
+ - ๐Ÿ“ฑ **App Automate** - Run Maestro, Espresso, and XCUITest suites on real devices and emulators, straight from the agent
10
20
  - ๐Ÿ–ฅ๏ธ **Live Testing** - Start interactive manual testing sessions on real browsers and devices
11
21
  - ๐ŸŒ **Browser & Device Management** - Query available browsers and real devices
12
22
  - ๐Ÿงช **Test Management** - Create, retrieve, update, and delete tests with comprehensive details
@@ -42,9 +52,42 @@ npm install @testingbot/mcp-server
42
52
 
43
53
  ### Configuration
44
54
 
55
+ #### Recommended: log in with `tb_login` (no key/secret to copy)
56
+
57
+ You don't have to find and paste API credentials. Install the server, leave the
58
+ credentials blank, and just ask the agent:
59
+
60
+ > Log me in to TestingBot.
61
+
62
+ The agent calls the **`tb_login`** tool. It uses OAuth-style browser
63
+ authentication โ€” no secret ever leaves the browser โ€” and picks the right
64
+ mechanism for your environment automatically:
65
+
66
+ - **Browser (loopback, the default on a desktop):** your browser opens to a
67
+ TestingBot authorization page. Sign in if needed and click **Authorize**; the
68
+ credentials are captured on a local callback and the agent finishes the
69
+ sign-in. Nothing to type. (RFC 8252.)
70
+ - **Device code (automatic fallback on SSH / remote / dev containers / web):**
71
+ the tool prints a short URL and code instead:
72
+ 1. Open the URL in your browser (e.g. `https://testingbot.com/device`).
73
+ 2. Enter the code, sign in if needed, and click **Authorize**.
74
+ 3. Tell the agent you've authorized โ€” it calls `tb_login` again to finish.
75
+
76
+ (RFC 8628.)
77
+
78
+ You can force a mechanism by passing `mode: "loopback"` or `mode: "device"` to
79
+ `tb_login` (the default is `"auto"`).
80
+
81
+ Your credentials are written to `~/.testingbot/credentials` (mode `0600`) and
82
+ used by every subsequent tool call โ€” no restart and no JSON editing. This works
83
+ in any MCP client (VS Code, Cursor, Cline, Claude Desktop, โ€ฆ). To use a different
84
+ account, set `TESTINGBOT_PROFILE`; to relocate the file, set
85
+ `TESTINGBOT_CONFIG_DIR`.
86
+
45
87
  #### Environment Variables
46
88
 
47
- Set your TestingBot credentials as environment variables:
89
+ Alternatively (or for CI, where env vars take precedence over the file), set your
90
+ TestingBot credentials as environment variables:
48
91
 
49
92
  ```bash
50
93
  export TESTINGBOT_KEY="your-api-key"
@@ -58,6 +101,21 @@ TESTINGBOT_KEY=your-api-key
58
101
  TESTINGBOT_SECRET=your-api-secret
59
102
  ```
60
103
 
104
+ The key also accepts the aliases `TB_KEY` / `TESTINGBOT_USERNAME`, and the secret
105
+ accepts `TB_SECRET` / `TESTINGBOT_ACCESS_KEY`.
106
+
107
+ #### How credentials are resolved
108
+
109
+ Credentials are resolved in this order, highest priority first:
110
+
111
+ 1. **Environment variables** (above) โ€” both a key and a secret must be set. This
112
+ lets CI and per-client config override everything else.
113
+ 2. **The `~/.testingbot/credentials` file** written by `tb_login`, for the active
114
+ profile (`default`, or `TESTINGBOT_PROFILE`).
115
+ 3. **Neither set:** the server starts in a degraded mode where every tool except
116
+ `tb_login` reports "Run tb_login to authenticate" โ€” so first run is
117
+ self-healing rather than a hard error.
118
+
61
119
  #### Claude Desktop
62
120
 
63
121
  Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%/Claude/claude_desktop_config.json` (Windows):
@@ -116,6 +174,15 @@ Add to `.cursor/mcp.json`:
116
174
  }
117
175
  ```
118
176
 
177
+ ## ๐Ÿค– Let an AI Agent Drive a Remote Browser or Device
178
+
179
+ 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.
180
+
181
+ Just ask:
182
+ > Open Safari 17 on macOS on TestingBot. Navigate to example.com and click the "More information" link.
183
+
184
+ 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.
185
+
119
186
  ## Available Tools
120
187
 
121
188
  ### Live Testing
@@ -310,6 +377,108 @@ Delete a file from TestingBot storage.
310
377
  **Example prompt:**
311
378
  > "Delete app tb://app123 from storage"
312
379
 
380
+ ### App Automate โ€” Maestro
381
+
382
+ Run [Maestro](https://maestro.dev) flows on TestingBot real devices, emulators, and simulators. Runs are **asynchronous**: start one, poll its status, then fetch results โ€” the agent is never blocked while devices execute.
383
+
384
+ #### `uploadMaestroApp`
385
+ Upload the app under test (`.apk`, `.aab`, `.ipa`, or zipped `.app`). Uploads are deduplicated by checksum โ€” re-running with the same binary is instant.
386
+
387
+ **Parameters:**
388
+ - `localFilePath`: Local path to the app file
389
+
390
+ Returns a **Project ID** used by the other Maestro tools.
391
+
392
+ **Example prompt:**
393
+ > "Upload ./build/app.apk for Maestro testing"
394
+
395
+ #### `uploadMaestroFlows`
396
+ Upload the Maestro flow YAML files for a project. Accepts a directory (structure preserved, so `runFlow` subflows keep working), a pre-built `.zip`, or **inline YAML** written by the agent. Replaces previously uploaded flows.
397
+
398
+ **Parameters:**
399
+ - `projectId`: Project ID from `uploadMaestroApp`
400
+ - `flowsPath` (optional): Directory or `.zip` of flow YAML files
401
+ - `flows` (optional): Inline flows as `[{ fileName, content }]`
402
+
403
+ #### `runMaestroTest`
404
+ Start a Maestro run. Returns immediately with the run ID โ€” poll with `getMaestroRunStatus`.
405
+
406
+ **Parameters:**
407
+ - `projectId`: Project ID
408
+ - `platformName`: "Android" or "iOS"
409
+ - `deviceName` (optional): Device name, wildcards/regex supported (e.g. `"Pixel 8"`, `"iPhone 1[4-6]"`, `"*"`)
410
+ - `version` (optional): OS version
411
+ - `realDevice` (optional): Run on a physical device (required for `.ipa`)
412
+ - `name` (optional): Run name shown in the dashboard
413
+ - `env` (optional): Environment variables passed to the flows
414
+ - `includeTags` / `excludeTags` (optional): Filter flows by Maestro tags
415
+ - `shardSplit` (optional): Split flows across parallel devices
416
+ - `otherApps` (optional): Up to 4 companion app URLs to install alongside the app
417
+
418
+ **Example prompt:**
419
+ > "Run my Maestro flows on a real Pixel 8 with Android 14"
420
+
421
+ #### `getMaestroRunStatus`
422
+ Poll run progress. Lists per-flow statuses (WAITING, READY, DONE, FAILED, CANCELLED), failures first.
423
+
424
+ #### `getMaestroRunResults`
425
+ Final results of a completed run: per-flow outcomes plus the JUnit XML report.
426
+
427
+ #### `getMaestroFlowDetails`
428
+ Deep-dive into one flow: error messages, step-level JUnit report, and links to the video, screenshots, and device logs. This is the debugging tool โ€” fetch it for a failed flow, fix the YAML, then retry.
429
+
430
+ **Parameters:** `projectId`, `runId`, `flowId`
431
+
432
+ #### `cancelMaestroRun` / `retryMaestroRun`
433
+ Cancel a running run, or retry a run โ€” pass `flowId` to retry only a single failed flow.
434
+
435
+ #### `uploadMaestroCompanionApp`
436
+ Upload a supplementary app installed alongside the app under test. Returns a `tb://` URL for `runMaestroTest`'s `otherApps`.
437
+
438
+ #### `listMaestroProjects` / `listMaestroRuns`
439
+ Discover existing projects (app, flows, run IDs) and runs across the account. `listMaestroRuns` accepts a `buildName` to look up runs by name โ€” e.g. "rerun whatever failed in last night's `nightly` build".
440
+
441
+ #### `maestroCheatSheet`
442
+ Returns a Maestro YAML syntax reference (commands, selectors, flow structure, and the TestingBot workflow). Agents call this before writing or fixing flows.
443
+
444
+ **Example workflow:**
445
+ ```
446
+ User: "Run the Maestro flows in ./flows against ./app.apk on a real Pixel 8. Fix any failures."
447
+ Assistant: [uploadMaestroApp โ†’ uploadMaestroFlows โ†’ runMaestroTest]
448
+ Assistant: [polls getMaestroRunStatus until complete]
449
+ Assistant: [getMaestroFlowDetails for the failed flow, reads the error + screenshots]
450
+ Assistant: [fixes the flow YAML, uploadMaestroFlows, retryMaestroRun]
451
+ ```
452
+
453
+ ### App Automate โ€” Espresso & XCUITest
454
+
455
+ Run pre-built Espresso (Android) and XCUITest (iOS) suites on TestingBot devices. Same async pattern: start, poll, fetch results.
456
+
457
+ #### `uploadAppAutomateApp`
458
+ Upload the app under test: `.apk`/`.aab` for Espresso, `.ipa` for XCUITest.
459
+
460
+ **Parameters:** `framework` ("espresso" or "xcuitest"), `localFilePath`
461
+
462
+ #### `uploadAppAutomateTests`
463
+ Upload the test suite: the instrumented test `.apk` for Espresso, or the zipped XCUITest runner bundle.
464
+
465
+ **Parameters:** `framework`, `projectId`, `localFilePath`
466
+
467
+ #### `runAppAutomateTest`
468
+ Start a run. Returns immediately with the run ID.
469
+
470
+ **Parameters:**
471
+ - `framework`, `projectId`
472
+ - `deviceName`, `version`, `realDevice`, `name`, `build` (optional): device selection and metadata
473
+ - `testClasses`, `skipTestClasses`, `packages`, `annotations`, `testRunner` (optional, Espresso only): test filtering
474
+ - `locale`, `timeZone` (optional)
475
+
476
+ **Example prompt:**
477
+ > "Run the Espresso suite on a real Galaxy S23, only the com.example.LoginTest class"
478
+
479
+ #### `getAppAutomateRunStatus` / `getAppAutomateRunResults`
480
+ 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.
481
+
313
482
  ### Screenshot Testing
314
483
 
315
484
  #### `takeScreenshot`
@@ -460,7 +629,22 @@ User: "Show me the last 10 tests"
460
629
  Assistant: [Shows recent test results]
461
630
  ```
462
631
 
463
- ### Example 3: Build Management
632
+ ### Example 3: Agent-Driven Maestro Testing on Real Devices
633
+
634
+ ```
635
+ User: "Write a Maestro flow that logs into my app and run it on a real Pixel 8"
636
+ Assistant: [maestroCheatSheet for syntax, writes the flow YAML]
637
+ Assistant: [uploadMaestroApp ./app.apk โ†’ project 42]
638
+ Assistant: [uploadMaestroFlows with the inline flow]
639
+ Assistant: [runMaestroTest on Pixel 8 with realDevice: true โ†’ run 101]
640
+ Assistant: [polls getMaestroRunStatus, then getMaestroRunResults]
641
+
642
+ User: "The checkout flow failed โ€” figure out why and fix it"
643
+ Assistant: [getMaestroFlowDetails โ†’ reads error + screenshots + video]
644
+ Assistant: [fixes the YAML, uploadMaestroFlows, retryMaestroRun]
645
+ ```
646
+
647
+ ### Example 4: Build Management
464
648
 
465
649
  ```
466
650
  User: "Show me my recent builds"
@@ -473,7 +657,7 @@ User: "Mark test xyz789 as passed with build name 'Release 1.0'"
473
657
  Assistant: [Updates test]
474
658
  ```
475
659
 
476
- ### Example 4: Team & Tunnel Management
660
+ ### Example 5: Team & Tunnel Management
477
661
 
478
662
  ```
479
663
  User: "Show me my team information"
@@ -486,7 +670,7 @@ User: "Show me all active tunnels"
486
670
  Assistant: [Lists active TestingBot tunnels]
487
671
  ```
488
672
 
489
- ### Example 5: CDP Automation
673
+ ### Example 6: CDP Automation
490
674
 
491
675
  ```
492
676
  User: "Create a CDP session on Chrome latest with Windows 11"
@@ -530,6 +714,9 @@ npm run lint
530
714
 
531
715
  # Format code
532
716
  npm run format
717
+
718
+ # Build the .mcpb bundle for Claude Desktop (see section below)
719
+ npm run mcpb
533
720
  ```
534
721
 
535
722
  ### Running Locally
@@ -552,6 +739,73 @@ npx @modelcontextprotocol/inspector node dist/index.js
552
739
 
553
740
  Then open http://localhost:5173 in your browser.
554
741
 
742
+ ### Building the `.mcpb` bundle (Claude Desktop release)
743
+
744
+ 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.
745
+
746
+ ```bash
747
+ # Prerequisites: mcpb CLI (one-time)
748
+ npm install -g @anthropic-ai/mcpb
749
+
750
+ # Build the bundle
751
+ npm run mcpb
752
+ ```
753
+
754
+ This runs `scripts/build-mcpb.sh`, which:
755
+
756
+ 1. Runs the full quality pipeline (`npm run build` โ†’ lint โ†’ format โ†’ test โ†’ tsc).
757
+ 2. Stages a clean tree in a temp directory (only `dist/`, `manifest.json`, `package.json`, `LICENSE`, `README.md`, `icon.png` if present).
758
+ 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`.
759
+ 4. Validates the manifest and runs `mcpb pack` honoring `.mcpbignore` (strips test fixtures, source maps, dependency changelogs).
760
+ 5. Writes `releases/testingbot-mcp-server-<version>.mcpb` and runs `mcpb info` on it.
761
+
762
+ 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.
763
+
764
+ #### Sibling repo during development
765
+
766
+ 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.
767
+
768
+ 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.
769
+
770
+ #### Releasing
771
+
772
+ The release flow has two coordinated publish steps:
773
+
774
+ 1. **Publish `@testingbot/automation-mcp` to npm** (from `../testingbot-automation-mcp`):
775
+ ```bash
776
+ npm version patch # or minor / major
777
+ npm publish # publishConfig.access is "public" โ€” handles scoped-pkg defaults
778
+ ```
779
+ 2. **Bump this repo to consume the new automation-mcp** and cut a release:
780
+ ```bash
781
+ npm install @testingbot/automation-mcp@latest # updates package-lock.json
782
+ npm version patch # also syncs manifest.json + server.json
783
+ git push --follow-tags
784
+ # โ†’ Create a GitHub release at the new tag. The Build MCPB workflow
785
+ # fires on release:published and attaches releases/*.mcpb to it.
786
+ ```
787
+
788
+ 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.
789
+
790
+ 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.
791
+
792
+ To validate the manifest without building:
793
+
794
+ ```bash
795
+ npm run mcpb:validate
796
+ ```
797
+
798
+ To inspect a built bundle:
799
+
800
+ ```bash
801
+ mcpb info releases/testingbot-mcp-server-<version>.mcpb
802
+ mcpb unpack releases/testingbot-mcp-server-<version>.mcpb /tmp/unpacked # see what's inside
803
+ ```
804
+
805
+ 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`.
806
+
807
+ `releases/*.mcpb` is gitignored โ€” upload the artefact to the GitHub releases page (or wherever your install URL points at) after building.
808
+
555
809
  ## Project Structure
556
810
 
557
811
  ```
@@ -566,8 +820,11 @@ testingbot-mcp-server/
566
820
  โ”‚ โ”‚ โ”œโ”€โ”€ error.ts # Error classes
567
821
  โ”‚ โ”‚ โ”œโ”€โ”€ logger.ts # Logging setup
568
822
  โ”‚ โ”‚ โ”œโ”€โ”€ utils.ts # Utility functions
569
- โ”‚ โ”‚ โ””โ”€โ”€ get-auth.ts # Authentication helpers
823
+ โ”‚ โ”‚ โ”œโ”€โ”€ get-auth.ts # Authentication helpers
824
+ โ”‚ โ”‚ โ””โ”€โ”€ app-automate-client.ts # REST client for Maestro/Espresso/XCUITest
570
825
  โ”‚ โ””โ”€โ”€ tools/
826
+ โ”‚ โ”œโ”€โ”€ maestro.ts # Maestro run tools (upload, run, poll, diagnose)
827
+ โ”‚ โ”œโ”€โ”€ app-automate.ts # Espresso & XCUITest run tools
571
828
  โ”‚ โ”œโ”€โ”€ browsers.ts # Browser & device tools
572
829
  โ”‚ โ”œโ”€โ”€ tests.ts # Test management tools
573
830
  โ”‚ โ”œโ”€โ”€ builds.ts # Build management tools
@@ -589,9 +846,10 @@ testingbot-mcp-server/
589
846
  ### Authentication Errors
590
847
 
591
848
  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
849
+ 1. Run the `tb_login` tool (just ask the agent to "log me in to TestingBot") โ€” the simplest fix, no key/secret needed
850
+ 2. Or verify your credentials at https://testingbot.com/members/user/security
851
+ 3. Ensure environment variables are set correctly (env vars override the `tb_login` credentials file)
852
+ 4. Check that there are no extra spaces in your credentials
595
853
 
596
854
  ### Connection Issues
597
855
 
@@ -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,M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C,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,gB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