@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.
- package/README.md +112 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +21 -8
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -16
- package/dist/index.js.map +1 -1
- package/dist/lib/credentials.d.ts +19 -0
- package/dist/lib/credentials.d.ts.map +1 -0
- package/dist/lib/credentials.js +128 -0
- package/dist/lib/credentials.js.map +1 -0
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/logger.js +45 -19
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/types.d.ts +9 -3
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/server-factory.d.ts +15 -1
- package/dist/server-factory.d.ts.map +1 -1
- package/dist/server-factory.js +136 -10
- package/dist/server-factory.js.map +1 -1
- package/dist/silence-wdio.d.ts +2 -0
- package/dist/silence-wdio.d.ts.map +1 -0
- package/dist/silence-wdio.js +17 -0
- package/dist/silence-wdio.js.map +1 -0
- package/dist/tools/auth.d.ts +43 -0
- package/dist/tools/auth.d.ts.map +1 -0
- package/dist/tools/auth.js +571 -0
- package/dist/tools/auth.js.map +1 -0
- package/dist/tools/browsers.d.ts.map +1 -1
- package/dist/tools/browsers.js +2 -1
- package/dist/tools/browsers.js.map +1 -1
- package/dist/tools/logs.d.ts +3 -0
- package/dist/tools/logs.d.ts.map +1 -0
- package/dist/tools/logs.js +135 -0
- package/dist/tools/logs.js.map +1 -0
- package/dist/tools/project.d.ts +16 -0
- package/dist/tools/project.d.ts.map +1 -0
- package/dist/tools/project.js +457 -0
- package/dist/tools/project.js.map +1 -0
- package/dist/tools/storage.d.ts.map +1 -1
- package/dist/tools/storage.js +94 -8
- package/dist/tools/storage.js.map +1 -1
- package/dist/tools/tests.d.ts.map +1 -1
- package/dist/tools/tests.js +8 -6
- package/dist/tools/tests.js.map +1 -1
- package/dist/tools/user.d.ts.map +1 -1
- package/dist/tools/user.js +24 -6
- package/dist/tools/user.js.map +1 -1
- package/package.json +10 -3
package/dist/server-factory.js
CHANGED
|
@@ -15,11 +15,17 @@ import addLiveTools from "./tools/live.js";
|
|
|
15
15
|
import addTeamTools from "./tools/team.js";
|
|
16
16
|
import addCdpTools from "./tools/cdp.js";
|
|
17
17
|
import addTunnelTools from "./tools/tunnels.js";
|
|
18
|
+
import addLogTools from "./tools/logs.js";
|
|
19
|
+
import addProjectTools from "./tools/project.js";
|
|
20
|
+
import addAuthTools from "./tools/auth.js";
|
|
21
|
+
import { addAutomationTools } from "@testingbot/automation-mcp";
|
|
18
22
|
export class TestingBotMcpServer {
|
|
19
23
|
server;
|
|
20
24
|
tools = {};
|
|
21
25
|
testingBotApi;
|
|
22
26
|
config;
|
|
27
|
+
automation = null;
|
|
28
|
+
closing = false;
|
|
23
29
|
constructor(testingBotApi, config) {
|
|
24
30
|
this.testingBotApi = testingBotApi;
|
|
25
31
|
this.config = config;
|
|
@@ -28,10 +34,12 @@ export class TestingBotMcpServer {
|
|
|
28
34
|
version: packageJson.version || "1.0.0",
|
|
29
35
|
}, {
|
|
30
36
|
capabilities: {
|
|
31
|
-
|
|
37
|
+
// listChanged lets us notify clients when tb_login re-registers
|
|
38
|
+
// credential-dependent (automation) tools after a successful login.
|
|
39
|
+
tools: { listChanged: true },
|
|
32
40
|
},
|
|
33
41
|
});
|
|
34
|
-
this.
|
|
42
|
+
this.registerLocalTools();
|
|
35
43
|
this.setupHandlers();
|
|
36
44
|
}
|
|
37
45
|
setupHandlers() {
|
|
@@ -41,7 +49,9 @@ export class TestingBotMcpServer {
|
|
|
41
49
|
tools: Object.values(this.tools).map((tool) => ({
|
|
42
50
|
name: tool.name,
|
|
43
51
|
description: tool.description,
|
|
44
|
-
|
|
52
|
+
// Proxied tools (e.g. appium-mcp) pre-stash a raw JSON Schema on the
|
|
53
|
+
// tool object. Honor it; otherwise serialize the Zod-style dict.
|
|
54
|
+
inputSchema: tool.inputSchema ?? {
|
|
45
55
|
type: "object",
|
|
46
56
|
properties: tool.schema,
|
|
47
57
|
required: Object.keys(tool.schema).filter((key) => !tool.schema[key].isOptional?.()),
|
|
@@ -54,15 +64,75 @@ export class TestingBotMcpServer {
|
|
|
54
64
|
const toolName = request.params.name;
|
|
55
65
|
const toolArgs = request.params.arguments || {};
|
|
56
66
|
logger.info({ tool: toolName, args: toolArgs }, "Tool called");
|
|
57
|
-
|
|
58
|
-
if (!tool) {
|
|
59
|
-
throw new Error(`Tool not found: ${toolName}`);
|
|
60
|
-
}
|
|
61
|
-
return tool.handler(toolArgs);
|
|
67
|
+
return this.handleToolCall(toolName, toolArgs);
|
|
62
68
|
});
|
|
63
69
|
}
|
|
64
|
-
|
|
70
|
+
// Dispatch a single tool call, applying the degraded-mode credential gate.
|
|
71
|
+
// Extracted from the request handler so the gate is unit-testable.
|
|
72
|
+
async handleToolCall(toolName, toolArgs) {
|
|
73
|
+
const tool = this.tools[toolName];
|
|
74
|
+
if (!tool) {
|
|
75
|
+
throw new Error(`Tool not found: ${toolName}`);
|
|
76
|
+
}
|
|
77
|
+
// Degraded mode: with no credentials yet, every tool except the device-auth
|
|
78
|
+
// flow reports how to authenticate instead of failing with an opaque API
|
|
79
|
+
// error. Checked per-call so it clears the moment tb_login writes
|
|
80
|
+
// credentials (which mutates this.config) — no restart required.
|
|
81
|
+
if (toolName !== "tb_login" && !this.hasCredentials()) {
|
|
82
|
+
return {
|
|
83
|
+
content: [
|
|
84
|
+
{
|
|
85
|
+
type: "text",
|
|
86
|
+
text: "No TestingBot credentials configured. Run the tb_login tool to authenticate (no API key needed), or set TESTINGBOT_KEY and TESTINGBOT_SECRET.",
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
isError: true,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return tool.handler(toolArgs);
|
|
93
|
+
}
|
|
94
|
+
hasCredentials() {
|
|
95
|
+
return Boolean(this.config["testingbot-key"] && this.config["testingbot-secret"]);
|
|
96
|
+
}
|
|
97
|
+
// Called by the tb_login tool after a successful login. Credential-dependent
|
|
98
|
+
// tools from @testingbot/automation-mcp bind their key/secret at registration,
|
|
99
|
+
// so they're stale (or, in degraded startup, absent). Re-register them with the
|
|
100
|
+
// now-valid credentials and tell the client the tool list changed. Best-effort:
|
|
101
|
+
// failures here must not break the login that just succeeded.
|
|
102
|
+
async reinitializeAfterLogin() {
|
|
103
|
+
if (this.closing)
|
|
104
|
+
return;
|
|
105
|
+
try {
|
|
106
|
+
// Spawn the new automation handle into a local FIRST so this.automation is
|
|
107
|
+
// never null mid-flight (which would let a concurrent close() skip shutting
|
|
108
|
+
// down the old child while a new one is being spawned → orphaned process).
|
|
109
|
+
const previous = this.automation;
|
|
110
|
+
const next = await addAutomationTools(this, this.testingBotApi, this.config);
|
|
111
|
+
// If the server began shutting down while we were spawning, don't install
|
|
112
|
+
// the new handle — tear it down so we don't leak its appium child.
|
|
113
|
+
if (this.closing) {
|
|
114
|
+
await next.shutdown();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
this.automation = next;
|
|
118
|
+
Object.assign(this.tools, next.tools);
|
|
119
|
+
if (previous)
|
|
120
|
+
await previous.shutdown();
|
|
121
|
+
try {
|
|
122
|
+
await this.server.sendToolListChanged();
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// Client may not support list-changed notifications; harmless.
|
|
126
|
+
}
|
|
127
|
+
logger.info("Re-registered credential-dependent tools after login");
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
logger.warn({ error: error instanceof Error ? error.message : String(error) }, "Failed to re-register automation tools after login; a client restart may be needed for them");
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
registerLocalTools() {
|
|
65
134
|
const toolAdders = [
|
|
135
|
+
addAuthTools,
|
|
66
136
|
addBrowserTools,
|
|
67
137
|
addTestTools,
|
|
68
138
|
addBuildTools,
|
|
@@ -73,12 +143,25 @@ export class TestingBotMcpServer {
|
|
|
73
143
|
addTeamTools,
|
|
74
144
|
addCdpTools,
|
|
75
145
|
addTunnelTools,
|
|
146
|
+
addLogTools,
|
|
147
|
+
addProjectTools,
|
|
76
148
|
];
|
|
77
149
|
toolAdders.forEach((adder) => {
|
|
78
150
|
const addedTools = adder(this, this.testingBotApi, this.config);
|
|
79
151
|
Object.assign(this.tools, addedTools);
|
|
80
152
|
});
|
|
81
|
-
logger.info({ toolCount: Object.keys(this.tools).length }, "
|
|
153
|
+
logger.info({ toolCount: Object.keys(this.tools).length }, "Local tools registered");
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Async tool registration. Currently this spawns the appium-mcp child
|
|
157
|
+
* process bundled with @testingbot/automation-mcp and proxies its full
|
|
158
|
+
* mobile tool surface onto this server. Must complete before the MCP
|
|
159
|
+
* client requests its first tools/list.
|
|
160
|
+
*/
|
|
161
|
+
async registerAutomationTools() {
|
|
162
|
+
this.automation = await addAutomationTools(this, this.testingBotApi, this.config);
|
|
163
|
+
Object.assign(this.tools, this.automation.tools);
|
|
164
|
+
logger.info({ toolCount: Object.keys(this.tools).length }, "All tools registered");
|
|
82
165
|
}
|
|
83
166
|
tool(name, description, schema, handler) {
|
|
84
167
|
const tool = {
|
|
@@ -89,10 +172,53 @@ export class TestingBotMcpServer {
|
|
|
89
172
|
};
|
|
90
173
|
return tool;
|
|
91
174
|
}
|
|
175
|
+
// Validates the runtime environment and credentials before accepting MCP
|
|
176
|
+
// traffic. Throws on any blocking issue so the entry point can exit with a
|
|
177
|
+
// clear error instead of letting the first tool call fail mysteriously.
|
|
178
|
+
async preflight() {
|
|
179
|
+
const required = 18;
|
|
180
|
+
const major = Number(process.versions.node.split(".")[0]);
|
|
181
|
+
if (!Number.isFinite(major) || major < required) {
|
|
182
|
+
throw new Error(`Node.js ${required}+ is required; this process is running ${process.versions.node}. Upgrade Node (e.g. via nvm or https://nodejs.org) and re-run.`);
|
|
183
|
+
}
|
|
184
|
+
// No credentials yet: start anyway in degraded mode. The tb_login tool is
|
|
185
|
+
// always available, and every other tool reports "Run tb_login" until creds
|
|
186
|
+
// exist. This makes first-run self-healing instead of a hard crash.
|
|
187
|
+
if (!this.hasCredentials()) {
|
|
188
|
+
logger.warn("No TestingBot credentials configured — starting in degraded mode. Run the tb_login tool to authenticate, or set TESTINGBOT_KEY and TESTINGBOT_SECRET (or TB_KEY/TB_SECRET).");
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
try {
|
|
192
|
+
await this.testingBotApi.getUserInfo();
|
|
193
|
+
logger.info("Credentials verified against TestingBot API");
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
197
|
+
throw new Error(`TestingBot credential check failed: ${message}. Verify TESTINGBOT_KEY / TESTINGBOT_SECRET in the MCP client config.`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
92
200
|
async run() {
|
|
201
|
+
await this.preflight();
|
|
202
|
+
await this.registerAutomationTools();
|
|
93
203
|
const transport = new StdioServerTransport();
|
|
94
204
|
await this.server.connect(transport);
|
|
95
205
|
logger.info("TestingBot MCP Server running on stdio");
|
|
96
206
|
}
|
|
207
|
+
async close() {
|
|
208
|
+
// Signal any in-flight reinitializeAfterLogin to abort before installing /
|
|
209
|
+
// spawning a new automation child, so we don't leak an orphaned process.
|
|
210
|
+
this.closing = true;
|
|
211
|
+
try {
|
|
212
|
+
// Close any live automation sessions first — they hold remote resources
|
|
213
|
+
// (TestingBot minutes) that we want released before the MCP transport drops.
|
|
214
|
+
if (this.automation) {
|
|
215
|
+
await this.automation.shutdown();
|
|
216
|
+
}
|
|
217
|
+
await this.server.close();
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
logger.error({ error }, "Error while closing MCP server");
|
|
221
|
+
}
|
|
222
|
+
}
|
|
97
223
|
}
|
|
98
224
|
//# 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;AAEvC,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;
|
|
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,MA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d.ts","sourceRoot":"","sources":["../src/silence-wdio.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Side-effect module: silence @wdio/logger BEFORE the `webdriver` module loads.
|
|
2
|
+
//
|
|
3
|
+
// The `webdriver` package creates its logger at module-evaluation time
|
|
4
|
+
// (`var log = logger("webdriver")`), and @wdio/logger reads WDIO_LOG_LEVEL once,
|
|
5
|
+
// at that moment, then caches the logger. The default level is "info", which it
|
|
6
|
+
// writes to process.stdout — and for a stdio MCP server stdout is reserved for
|
|
7
|
+
// JSON-RPC framing, so those lines corrupt the protocol stream (the client throws
|
|
8
|
+
// "Unexpected non-whitespace character after JSON").
|
|
9
|
+
//
|
|
10
|
+
// ESM hoists `import` statements above top-level code, so setting this env var in
|
|
11
|
+
// the body of index.ts (even textually "above" the imports) runs too late —
|
|
12
|
+
// webdriver has already cached an info-level logger by then. Importing THIS module
|
|
13
|
+
// before any module that transitively imports `webdriver` guarantees the env var
|
|
14
|
+
// is in place in time. An operator can still override the level.
|
|
15
|
+
process.env.WDIO_LOG_LEVEL = process.env.WDIO_LOG_LEVEL || "silent";
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=silence-wdio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"silence-wdio.js","sourceRoot":"","sources":["../src/silence-wdio.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,EAAE;AACF,uEAAuE;AACvE,iFAAiF;AACjF,gFAAgF;AAChF,+EAA+E;AAC/E,kFAAkF;AAClF,qDAAqD;AACrD,EAAE;AACF,kFAAkF;AAClF,4EAA4E;AAC5E,mFAAmF;AACnF,iFAAiF;AACjF,iEAAiE;AACjE,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,QAAQ,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createServer } from "node:http";
|
|
2
|
+
import { TestingBotConfig } from "../lib/types.js";
|
|
3
|
+
import { type DeviceCredentials } from "../lib/credentials.js";
|
|
4
|
+
export type PollResult = {
|
|
5
|
+
status: "approved";
|
|
6
|
+
creds: DeviceCredentials;
|
|
7
|
+
} | {
|
|
8
|
+
status: "denied";
|
|
9
|
+
} | {
|
|
10
|
+
status: "expired";
|
|
11
|
+
} | {
|
|
12
|
+
status: "pending";
|
|
13
|
+
intervalMs: number;
|
|
14
|
+
};
|
|
15
|
+
interface PollDeps {
|
|
16
|
+
sleep?: (ms: number) => Promise<void>;
|
|
17
|
+
now?: () => number;
|
|
18
|
+
fetchImpl?: typeof fetch;
|
|
19
|
+
}
|
|
20
|
+
export declare function pollDeviceToken(baseUrl: string, deviceCode: string, deadline: number, intervalMs: number, deps?: PollDeps): Promise<PollResult>;
|
|
21
|
+
export type LoopbackResult = {
|
|
22
|
+
status: "success";
|
|
23
|
+
clientKey: string;
|
|
24
|
+
clientSecret: string;
|
|
25
|
+
} | {
|
|
26
|
+
status: "denied";
|
|
27
|
+
message: string;
|
|
28
|
+
} | {
|
|
29
|
+
status: "timeout";
|
|
30
|
+
};
|
|
31
|
+
interface LoopbackHandle {
|
|
32
|
+
port: number;
|
|
33
|
+
result: Promise<LoopbackResult>;
|
|
34
|
+
close: () => void;
|
|
35
|
+
}
|
|
36
|
+
export declare function startLoopback(lifetimeMs: number, expectedState: string, createServerImpl?: typeof createServer): Promise<LoopbackHandle | null>;
|
|
37
|
+
interface AuthDeps {
|
|
38
|
+
openBrowser?: (url: string) => void;
|
|
39
|
+
createServer?: typeof createServer;
|
|
40
|
+
}
|
|
41
|
+
export default function addAuthTools(server: any, testingBotApi: any, config: TestingBotConfig, deps?: AuthDeps): Record<string, any>;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/tools/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAA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