@testingbot/mcp-server 1.0.0 → 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 (98) hide show
  1. package/README.md +114 -7
  2. package/dist/config.d.ts +3 -0
  3. package/dist/config.d.ts.map +1 -0
  4. package/dist/config.js +31 -0
  5. package/dist/config.js.map +1 -0
  6. package/dist/index.d.ts +3 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +49 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/lib/constants.d.ts +32 -0
  11. package/dist/lib/constants.d.ts.map +1 -0
  12. package/dist/lib/constants.js +32 -0
  13. package/dist/lib/constants.js.map +1 -0
  14. package/dist/lib/credentials.d.ts +19 -0
  15. package/dist/lib/credentials.d.ts.map +1 -0
  16. package/dist/lib/credentials.js +128 -0
  17. package/dist/lib/credentials.js.map +1 -0
  18. package/dist/lib/error.d.ts +14 -0
  19. package/dist/lib/error.d.ts.map +1 -0
  20. package/dist/lib/error.js +27 -0
  21. package/dist/lib/error.js.map +1 -0
  22. package/dist/lib/get-auth.d.ts +6 -0
  23. package/dist/lib/get-auth.d.ts.map +1 -0
  24. package/dist/lib/get-auth.js +7 -0
  25. package/dist/lib/get-auth.js.map +1 -0
  26. package/dist/lib/logger.d.ts +4 -0
  27. package/dist/lib/logger.d.ts.map +1 -0
  28. package/dist/lib/logger.js +77 -0
  29. package/dist/lib/logger.js.map +1 -0
  30. package/dist/lib/types.d.ts +70 -0
  31. package/dist/lib/types.d.ts.map +1 -0
  32. package/dist/lib/types.js +2 -0
  33. package/dist/lib/types.js.map +1 -0
  34. package/dist/lib/utils.d.ts +12 -0
  35. package/dist/lib/utils.d.ts.map +1 -0
  36. package/dist/lib/utils.js +40 -0
  37. package/dist/lib/utils.js.map +1 -0
  38. package/dist/server-factory.d.ts +33 -0
  39. package/dist/server-factory.d.ts.map +1 -0
  40. package/dist/server-factory.js +224 -0
  41. package/dist/server-factory.js.map +1 -0
  42. package/dist/silence-wdio.d.ts +2 -0
  43. package/dist/silence-wdio.d.ts.map +1 -0
  44. package/dist/silence-wdio.js +17 -0
  45. package/dist/silence-wdio.js.map +1 -0
  46. package/dist/tools/auth.d.ts +43 -0
  47. package/dist/tools/auth.d.ts.map +1 -0
  48. package/dist/tools/auth.js +571 -0
  49. package/dist/tools/auth.js.map +1 -0
  50. package/dist/tools/browsers.d.ts +3 -0
  51. package/dist/tools/browsers.d.ts.map +1 -0
  52. package/dist/tools/browsers.js +74 -0
  53. package/dist/tools/browsers.js.map +1 -0
  54. package/dist/tools/builds.d.ts +3 -0
  55. package/dist/tools/builds.d.ts.map +1 -0
  56. package/dist/tools/builds.js +115 -0
  57. package/dist/tools/builds.js.map +1 -0
  58. package/dist/tools/cdp.d.ts +3 -0
  59. package/dist/tools/cdp.d.ts.map +1 -0
  60. package/dist/tools/cdp.js +78 -0
  61. package/dist/tools/cdp.js.map +1 -0
  62. package/dist/tools/live.d.ts +3 -0
  63. package/dist/tools/live.d.ts.map +1 -0
  64. package/dist/tools/live.js +221 -0
  65. package/dist/tools/live.js.map +1 -0
  66. package/dist/tools/logs.d.ts +3 -0
  67. package/dist/tools/logs.d.ts.map +1 -0
  68. package/dist/tools/logs.js +135 -0
  69. package/dist/tools/logs.js.map +1 -0
  70. package/dist/tools/project.d.ts +16 -0
  71. package/dist/tools/project.d.ts.map +1 -0
  72. package/dist/tools/project.js +457 -0
  73. package/dist/tools/project.js.map +1 -0
  74. package/dist/tools/screenshots.d.ts +3 -0
  75. package/dist/tools/screenshots.d.ts.map +1 -0
  76. package/dist/tools/screenshots.js +132 -0
  77. package/dist/tools/screenshots.js.map +1 -0
  78. package/dist/tools/storage.d.ts +3 -0
  79. package/dist/tools/storage.d.ts.map +1 -0
  80. package/dist/tools/storage.js +200 -0
  81. package/dist/tools/storage.js.map +1 -0
  82. package/dist/tools/team.d.ts +3 -0
  83. package/dist/tools/team.d.ts.map +1 -0
  84. package/dist/tools/team.js +171 -0
  85. package/dist/tools/team.js.map +1 -0
  86. package/dist/tools/tests.d.ts +3 -0
  87. package/dist/tools/tests.d.ts.map +1 -0
  88. package/dist/tools/tests.js +309 -0
  89. package/dist/tools/tests.js.map +1 -0
  90. package/dist/tools/tunnels.d.ts +3 -0
  91. package/dist/tools/tunnels.d.ts.map +1 -0
  92. package/dist/tools/tunnels.js +74 -0
  93. package/dist/tools/tunnels.js.map +1 -0
  94. package/dist/tools/user.d.ts +3 -0
  95. package/dist/tools/user.d.ts.map +1 -0
  96. package/dist/tools/user.js +83 -0
  97. package/dist/tools/user.js.map +1 -0
  98. package/package.json +10 -3
@@ -0,0 +1,309 @@
1
+ import { z } from "zod";
2
+ import { handleMCPError, sanitizeSessionId } from "../lib/utils.js";
3
+ import logger from "../lib/logger.js";
4
+ export default function addTestTools(server, testingBotApi, _config) {
5
+ const tools = {};
6
+ const testStatus = function (statusId) {
7
+ switch (statusId) {
8
+ case 1:
9
+ return "Passed";
10
+ case 0:
11
+ return "Failed";
12
+ case 2:
13
+ return "Unknown";
14
+ }
15
+ };
16
+ const testUrl = function (test) {
17
+ return `https://testingbot.com/members/tests/${test.session_id}`;
18
+ };
19
+ const formatBrowser = function (test) {
20
+ const name = typeof test.browser === "string" ? test.browser.trim() : "";
21
+ const versionRaw = test.browser_version ?? test.version;
22
+ const version = versionRaw == null ? "" : String(versionRaw).trim();
23
+ return [name, version].filter(Boolean).join(" ");
24
+ };
25
+ tools.getTests = server.tool("getTests", "Retrieve a list of recent tests with optional pagination. Returns test details including status, browser, platform, video and duration.", {
26
+ offset: z
27
+ .union([z.number(), z.string().transform(Number)])
28
+ .pipe(z.number().min(0))
29
+ .optional()
30
+ .default(0)
31
+ .describe("Offset for pagination (default: 0)"),
32
+ limit: z
33
+ .union([z.number(), z.string().transform(Number)])
34
+ .pipe(z.number().min(1).max(100))
35
+ .optional()
36
+ .default(10)
37
+ .describe("Number of tests to retrieve (default: 10, max: 100)"),
38
+ }, async (args) => {
39
+ try {
40
+ const offset = Number(args.offset ?? 0);
41
+ const limit = Number(args.limit ?? 10);
42
+ logger.info({ offset, limit }, "Fetching tests");
43
+ const response = await testingBotApi.getTests(offset, limit);
44
+ const tests = response?.data || [];
45
+ const meta = response?.meta || {};
46
+ logger.info({
47
+ count: tests.length,
48
+ offset,
49
+ limit,
50
+ meta,
51
+ }, "Tests fetched successfully");
52
+ let formattedOutput = `## Recent Tests (showing ${limit} from offset ${offset})\n\n`;
53
+ if (tests.length > 0) {
54
+ tests.forEach((test) => {
55
+ formattedOutput += `### Test ${test.session_id}\n`;
56
+ if (test.name) {
57
+ formattedOutput += `- **Name**: ${test.name}\n`;
58
+ }
59
+ // Status and success
60
+ if (test.status_id !== undefined) {
61
+ formattedOutput += `- **Status**: ${testStatus(test.status_id)}\n`;
62
+ }
63
+ else if (test.success !== undefined) {
64
+ formattedOutput += `- **Success**: ${test.success ? "Yes" : "No"}\n`;
65
+ }
66
+ if (test.state) {
67
+ formattedOutput += `- **State**: ${test.state}\n`;
68
+ }
69
+ // Browser and platform
70
+ const browser = formatBrowser(test);
71
+ if (browser) {
72
+ formattedOutput += `- **Browser**: ${browser}\n`;
73
+ }
74
+ const platform = test.os || test.platform || test.platform_name;
75
+ if (platform) {
76
+ formattedOutput += `- **Platform**: ${platform}\n`;
77
+ }
78
+ // Timing
79
+ if (test.duration) {
80
+ formattedOutput += `- **Duration**: ${test.duration}s\n`;
81
+ }
82
+ if (test.created_at) {
83
+ formattedOutput += `- **Created**: ${test.created_at}\n`;
84
+ }
85
+ if (test.completed_at) {
86
+ formattedOutput += `- **Completed**: ${test.completed_at}\n`;
87
+ }
88
+ // Media
89
+ if (test.video) {
90
+ formattedOutput += `- **Video**: ${test.video}\n`;
91
+ }
92
+ // Build and extra
93
+ if (test.build) {
94
+ formattedOutput += `- **Build**: ${test.build}\n`;
95
+ }
96
+ if (test.extra) {
97
+ formattedOutput += `- **Extra**: ${test.extra}\n`;
98
+ }
99
+ formattedOutput += `- **URL**: ${testUrl(test)}\n`;
100
+ formattedOutput += "\n";
101
+ });
102
+ }
103
+ else {
104
+ formattedOutput += "No tests found.\n";
105
+ }
106
+ return {
107
+ content: [
108
+ {
109
+ type: "text",
110
+ text: formattedOutput,
111
+ },
112
+ ],
113
+ };
114
+ }
115
+ catch (error) {
116
+ logger.error(error);
117
+ return handleMCPError("getTests", error);
118
+ }
119
+ });
120
+ tools.getTestDetails = server.tool("getTestDetails", "Get detailed information about a specific test by session ID. Includes logs, screenshots, video URLs, and execution metadata.", {
121
+ sessionId: z.string().describe("The session ID of the test"),
122
+ }, async (args) => {
123
+ try {
124
+ const sessionId = sanitizeSessionId(args.sessionId);
125
+ logger.info({ sessionId }, "Fetching test details");
126
+ const test = await testingBotApi.getTestDetails(sessionId);
127
+ let formattedOutput = `## Test Details: ${sessionId}\n\n`;
128
+ if (test.name) {
129
+ formattedOutput += `- **Name**: ${test.name}\n`;
130
+ }
131
+ // Status and success
132
+ if (test.status_id !== undefined) {
133
+ formattedOutput += `- **Status**: ${testStatus(test.status_id)}\n`;
134
+ }
135
+ else if (test.success !== undefined) {
136
+ formattedOutput += `- **Success**: ${test.success ? "Yes" : "No"}\n`;
137
+ }
138
+ if (test.state) {
139
+ formattedOutput += `- **State**: ${test.state}\n`;
140
+ }
141
+ if (test.status_message) {
142
+ formattedOutput += `- **Status Message**: ${test.status_message}\n`;
143
+ }
144
+ // Browser and platform
145
+ const browser = formatBrowser(test);
146
+ if (browser) {
147
+ formattedOutput += `- **Browser**: ${browser}\n`;
148
+ }
149
+ const platform = test.os || test.platform || test.platform_name;
150
+ if (platform) {
151
+ formattedOutput += `- **Platform**: ${platform}\n`;
152
+ }
153
+ if (test.device_name) {
154
+ formattedOutput += `- **Device**: ${test.device_name}\n`;
155
+ }
156
+ // Test type and execution
157
+ if (test.type) {
158
+ formattedOutput += `- **Type**: ${test.type}\n`;
159
+ }
160
+ // Timing
161
+ if (test.duration) {
162
+ formattedOutput += `- **Duration**: ${test.duration}s\n`;
163
+ }
164
+ if (test.created_at) {
165
+ formattedOutput += `- **Created**: ${test.created_at}\n`;
166
+ }
167
+ if (test.completed_at) {
168
+ formattedOutput += `- **Completed**: ${test.completed_at}\n`;
169
+ }
170
+ // Media
171
+ if (test.video) {
172
+ formattedOutput += `- **Video**: ${test.video}\n`;
173
+ }
174
+ if (test.thumbs && Array.isArray(test.thumbs) && test.thumbs.length > 0) {
175
+ formattedOutput += `- **Screenshots**: ${test.thumbs.length} available\n`;
176
+ }
177
+ // Logs
178
+ if (test.logs && typeof test.logs === "object") {
179
+ formattedOutput += `\n### Logs\n`;
180
+ if (test.logs.selenium) {
181
+ formattedOutput += `- **Selenium Log**: ${test.logs.selenium}\n`;
182
+ }
183
+ if (test.logs.browser) {
184
+ formattedOutput += `- **Browser Log**: ${test.logs.browser}\n`;
185
+ }
186
+ if (test.logs.chrome) {
187
+ formattedOutput += `- **Chrome Log**: ${test.logs.chrome}\n`;
188
+ }
189
+ if (test.logs.vm) {
190
+ formattedOutput += `- **VM Log**: ${test.logs.vm}\n`;
191
+ }
192
+ }
193
+ // Build and metadata
194
+ if (test.build) {
195
+ formattedOutput += `\n- **Build**: ${test.build}\n`;
196
+ }
197
+ if (test.extra) {
198
+ formattedOutput += `- **Extra**: ${test.extra}\n`;
199
+ }
200
+ // Test steps
201
+ if (test.steps && Array.isArray(test.steps) && test.steps.length > 0) {
202
+ formattedOutput += `\n### Test Steps (${test.steps.length} steps)\n`;
203
+ test.steps.forEach((step, index) => {
204
+ formattedOutput += `\n**Step ${index + 1}**: ${step.command}\n`;
205
+ if (step.arguments) {
206
+ formattedOutput += `- Arguments: ${step.arguments}\n`;
207
+ }
208
+ if (step.response) {
209
+ const responseText = step.response.substring(0, 100);
210
+ formattedOutput += `- Response: ${responseText}${step.response.length > 100 ? "..." : ""}\n`;
211
+ }
212
+ if (step.time) {
213
+ formattedOutput += `- Time: ${new Date(step.time).toISOString()}\n`;
214
+ }
215
+ });
216
+ }
217
+ formattedOutput += `\n- **Test URL**: ${testUrl(test)}\n`;
218
+ if (test.assets_available) {
219
+ formattedOutput += `- **Assets**: Available\n`;
220
+ }
221
+ return {
222
+ content: [
223
+ {
224
+ type: "text",
225
+ text: formattedOutput,
226
+ },
227
+ ],
228
+ };
229
+ }
230
+ catch (error) {
231
+ return handleMCPError("getTestDetails", error);
232
+ }
233
+ });
234
+ tools.updateTest = server.tool("updateTest", "Update test metadata such as name, status (passed/failed), and other attributes. Useful for marking tests after execution.", {
235
+ sessionId: z.string().describe("The session ID of the test to update"),
236
+ name: z.string().optional().describe("New name for the test"),
237
+ status: z.enum(["passed", "failed"]).optional().describe("Mark test as passed or failed"),
238
+ build: z.string().optional().describe("Build identifier"),
239
+ extra: z.string().optional().describe("Additional metadata (JSON string)"),
240
+ }, async (args) => {
241
+ try {
242
+ const sessionId = sanitizeSessionId(args.sessionId);
243
+ logger.info({ sessionId, updates: args }, "Updating test");
244
+ const updateData = {};
245
+ if (args.name)
246
+ updateData.name = args.name;
247
+ if (args.status)
248
+ updateData["test[success]"] = args.status === "passed" ? "1" : "0";
249
+ if (args.build)
250
+ updateData.build = args.build;
251
+ if (args.extra)
252
+ updateData.extra = args.extra;
253
+ await testingBotApi.updateTest(updateData, sessionId);
254
+ return {
255
+ content: [
256
+ {
257
+ type: "text",
258
+ text: `Test ${sessionId} updated successfully.`,
259
+ },
260
+ ],
261
+ };
262
+ }
263
+ catch (error) {
264
+ return handleMCPError("updateTest", error);
265
+ }
266
+ });
267
+ tools.deleteTest = server.tool("deleteTest", "Delete a test by session ID. This permanently removes the test and its associated data.", {
268
+ sessionId: z.string().describe("The session ID of the test to delete"),
269
+ }, async (args) => {
270
+ try {
271
+ const sessionId = sanitizeSessionId(args.sessionId);
272
+ logger.info({ sessionId }, "Deleting test");
273
+ await testingBotApi.deleteTest(sessionId);
274
+ return {
275
+ content: [
276
+ {
277
+ type: "text",
278
+ text: `Test ${sessionId} deleted successfully.`,
279
+ },
280
+ ],
281
+ };
282
+ }
283
+ catch (error) {
284
+ return handleMCPError("deleteTest", error);
285
+ }
286
+ });
287
+ tools.stopTest = server.tool("stopTest", "Stop a running test by session ID. This terminates the test execution immediately.", {
288
+ sessionId: z.string().describe("The session ID of the test to stop"),
289
+ }, async (args) => {
290
+ try {
291
+ const sessionId = sanitizeSessionId(args.sessionId);
292
+ logger.info({ sessionId }, "Stopping test");
293
+ await testingBotApi.stopTest(sessionId);
294
+ return {
295
+ content: [
296
+ {
297
+ type: "text",
298
+ text: `Test ${sessionId} stopped successfully.`,
299
+ },
300
+ ],
301
+ };
302
+ }
303
+ catch (error) {
304
+ return handleMCPError("stopTest", error);
305
+ }
306
+ });
307
+ return tools;
308
+ }
309
+ //# sourceMappingURL=tests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tests.js","sourceRoot":"","sources":["../../src/tools/tests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAEtC,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,MAAW,EAAE,aAAkB,EAAE,OAAyB;IAC7F,MAAM,KAAK,GAAwB,EAAE,CAAC;IACtC,MAAM,UAAU,GAAG,UAAU,QAAgB;QAC3C,QAAQ,QAAQ,EAAE,CAAC;YACjB,KAAK,CAAC;gBACJ,OAAO,QAAQ,CAAC;YAClB,KAAK,CAAC;gBACJ,OAAO,QAAQ,CAAC;YAClB,KAAK,CAAC;gBACJ,OAAO,SAAS,CAAC;QACrB,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,UAAU,IAAS;QACjC,OAAO,wCAAwC,IAAI,CAAC,UAAU,EAAE,CAAC;IACnE,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,UAAU,IAAS;QACvC,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,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AC,IAAI,CAC1B,UAAU,EACV,oFAAoF,EACpF;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;KACrE,EACD,KAAK,EAAE,IAA2B,EAAE,EAAE;QACpC,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACpD,MAAM,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,EAAE,eAAe,CAAC,CAAC;YAE5C,MAAM,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YAExC,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,QAAQ,SAAS,wBAAwB;qBAChD;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { TestingBotConfig } from "../lib/types.js";
2
+ export default function addTunnelTools(server: any, testingBotApi: any, _config: TestingBotConfig): Record<string, any>;
3
+ //# sourceMappingURL=tunnels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tunnels.d.ts","sourceRoot":"","sources":["../../src/tools/tunnels.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAInD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,OAAO,EAAE,gBAAgB,uBAyFhG"}
@@ -0,0 +1,74 @@
1
+ import { z } from "zod";
2
+ import { handleMCPError } from "../lib/utils.js";
3
+ import logger from "../lib/logger.js";
4
+ export default function addTunnelTools(server, testingBotApi, _config) {
5
+ const tools = {};
6
+ tools.getTunnelList = server.tool("getTunnelList", "Get a list of all active TestingBot tunnels. Tunnels allow you to test websites behind firewalls or on your local machine.", {}, async () => {
7
+ try {
8
+ logger.info("Fetching tunnel list");
9
+ const tunnels = await testingBotApi.getTunnelList();
10
+ let formattedOutput = `## Active Tunnels\n\n`;
11
+ if (Array.isArray(tunnels) && tunnels.length > 0) {
12
+ tunnels.forEach((tunnel) => {
13
+ formattedOutput += `### Tunnel ${tunnel.id}\n`;
14
+ formattedOutput += `- **ID**: ${tunnel.id}\n`;
15
+ if (tunnel.status) {
16
+ formattedOutput += `- **Status**: ${tunnel.status}\n`;
17
+ }
18
+ if (tunnel.version) {
19
+ formattedOutput += `- **Version**: ${tunnel.version}\n`;
20
+ }
21
+ if (tunnel.created_at) {
22
+ formattedOutput += `- **Created**: ${tunnel.created_at}\n`;
23
+ }
24
+ if (tunnel.ip) {
25
+ formattedOutput += `- **IP Address**: ${tunnel.ip}\n`;
26
+ }
27
+ if (tunnel.last_heartbeat) {
28
+ formattedOutput += `- **Last Heartbeat**: ${tunnel.last_heartbeat}\n`;
29
+ }
30
+ formattedOutput += "\n";
31
+ });
32
+ formattedOutput += `\n**Total**: ${tunnels.length} active tunnel${tunnels.length === 1 ? "" : "s"}\n`;
33
+ }
34
+ else {
35
+ formattedOutput += "No active tunnels found.\n\n";
36
+ formattedOutput += "To start a tunnel, download and run the TestingBot Tunnel:\n";
37
+ formattedOutput += "https://testingbot.com/support/other/tunnel\n";
38
+ }
39
+ return {
40
+ content: [
41
+ {
42
+ type: "text",
43
+ text: formattedOutput,
44
+ },
45
+ ],
46
+ };
47
+ }
48
+ catch (error) {
49
+ return handleMCPError("getTunnelList", error);
50
+ }
51
+ });
52
+ tools.deleteTunnel = server.tool("deleteTunnel", "Delete an active TestingBot tunnel by its ID. This will terminate the tunnel connection.", {
53
+ tunnelId: z.union([z.number(), z.string()]).describe("The tunnel ID to delete"),
54
+ }, async (args) => {
55
+ try {
56
+ const tunnelId = args.tunnelId;
57
+ logger.info({ tunnelId }, "Deleting tunnel");
58
+ await testingBotApi.deleteTunnel(tunnelId);
59
+ return {
60
+ content: [
61
+ {
62
+ type: "text",
63
+ text: `Tunnel ${tunnelId} deleted successfully.`,
64
+ },
65
+ ],
66
+ };
67
+ }
68
+ catch (error) {
69
+ return handleMCPError("deleteTunnel", error);
70
+ }
71
+ });
72
+ return tools;
73
+ }
74
+ //# sourceMappingURL=tunnels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tunnels.js","sourceRoot":"","sources":["../../src/tools/tunnels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAEtC,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,MAAW,EAAE,aAAkB,EAAE,OAAyB;IAC/F,MAAM,KAAK,GAAwB,EAAE,CAAC;IAEtC,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,IAAI,CAC/B,eAAe,EACf,4HAA4H,EAC5H,EAAE,EACF,KAAK,IAAI,EAAE;QACT,IAAI,CAAC;YACH,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YAEpC,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,aAAa,EAAE,CAAC;YAEpD,IAAI,eAAe,GAAG,uBAAuB,CAAC;YAE9C,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACjD,OAAO,CAAC,OAAO,CAAC,CAAC,MAAW,EAAE,EAAE;oBAC9B,eAAe,IAAI,cAAc,MAAM,CAAC,EAAE,IAAI,CAAC;oBAC/C,eAAe,IAAI,aAAa,MAAM,CAAC,EAAE,IAAI,CAAC;oBAE9C,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;wBAClB,eAAe,IAAI,iBAAiB,MAAM,CAAC,MAAM,IAA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AE,CAAC,CAAC,CAAC,QAAQ,CAAC,yBAAyB,CAAC;KAChF,EACD,KAAK,EAAE,IAAmC,EAAE,EAAE;QAC5C,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;YAE/B,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC,CAAC;YAE7C,MAAM,aAAa,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;YAE3C,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,UAAU,QAAQ,wBAAwB;qBACjD;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,cAAc,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { TestingBotConfig } from "../lib/types.js";
2
+ export default function addUserTools(server: any, testingBotApi: any, _config: TestingBotConfig): Record<string, any>;
3
+ //# sourceMappingURL=user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/tools/user.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAInD,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,OAAO,EAAE,gBAAgB,uBA6F9F"}
@@ -0,0 +1,83 @@
1
+ import { z } from "zod";
2
+ import { handleMCPError } from "../lib/utils.js";
3
+ import logger from "../lib/logger.js";
4
+ export default function addUserTools(server, testingBotApi, _config) {
5
+ const tools = {};
6
+ tools.getUserInfo = server.tool("getUserInfo", "Get current user account information including minutes used, plan details, and account status.", {}, async () => {
7
+ try {
8
+ logger.info("Fetching user info");
9
+ const userInfo = await testingBotApi.getUserInfo();
10
+ // The /v1/user endpoint returns first_name/last_name, plan, company,
11
+ // country, seconds, and concurrency limits. It does NOT return an email
12
+ // field. Guard every line so absent fields are omitted rather than
13
+ // rendered as "undefined".
14
+ const name = [userInfo.first_name, userInfo.last_name].filter(Boolean).join(" ");
15
+ let formattedOutput = "## User Information\n\n";
16
+ if (name) {
17
+ formattedOutput += `- **Name**: ${name}\n`;
18
+ }
19
+ if (userInfo.email) {
20
+ formattedOutput += `- **Email**: ${userInfo.email}\n`;
21
+ }
22
+ if (userInfo.company) {
23
+ formattedOutput += `- **Company**: ${userInfo.company}\n`;
24
+ }
25
+ if (userInfo.country) {
26
+ formattedOutput += `- **Country**: ${userInfo.country}\n`;
27
+ }
28
+ if (userInfo.plan !== undefined) {
29
+ formattedOutput += `- **Plan**: ${userInfo.plan}\n`;
30
+ }
31
+ if (userInfo.seconds !== undefined) {
32
+ formattedOutput += `- **Seconds Available**: ${userInfo.seconds}\n`;
33
+ }
34
+ if (userInfo.max_concurrent !== undefined) {
35
+ formattedOutput += `- **Max Concurrency**: ${userInfo.max_concurrent}\n`;
36
+ }
37
+ if (userInfo.max_concurrent_mobile !== undefined) {
38
+ formattedOutput += `- **Max Mobile Concurrency**: ${userInfo.max_concurrent_mobile}\n`;
39
+ }
40
+ return {
41
+ content: [
42
+ {
43
+ type: "text",
44
+ text: formattedOutput,
45
+ },
46
+ ],
47
+ };
48
+ }
49
+ catch (error) {
50
+ return handleMCPError("getUserInfo", error);
51
+ }
52
+ });
53
+ tools.updateUserInfo = server.tool("updateUserInfo", "Update user account information such as name, email, or other profile details.", {
54
+ firstName: z.string().optional().describe("First name"),
55
+ lastName: z.string().optional().describe("Last name"),
56
+ email: z.string().email().optional().describe("Email address"),
57
+ }, async (args) => {
58
+ try {
59
+ logger.info({ updates: args }, "Updating user info");
60
+ const updateData = {};
61
+ if (args.firstName)
62
+ updateData.first_name = args.firstName;
63
+ if (args.lastName)
64
+ updateData.last_name = args.lastName;
65
+ if (args.email)
66
+ updateData.email = args.email;
67
+ await testingBotApi.updateUserInfo(updateData);
68
+ return {
69
+ content: [
70
+ {
71
+ type: "text",
72
+ text: "User information updated successfully.",
73
+ },
74
+ ],
75
+ };
76
+ }
77
+ catch (error) {
78
+ return handleMCPError("updateUserInfo", error);
79
+ }
80
+ });
81
+ return tools;
82
+ }
83
+ //# sourceMappingURL=user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/tools/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAEtC,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,MAAW,EAAE,aAAkB,EAAE,OAAyB;IAC7F,MAAM,KAAK,GAAwB,EAAE,CAAC;IAEtC,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,IAAI,CAC7B,aAAa,EACb,gGAAgG,EAChG,EAAE,EACF,KAAK,IAAI,EAAE;QACT,IAAI,CAAC;YACH,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YAElC,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,WAAW,EAAE,CAAC;YAEnD,qEAAqE;YACrE,wEAAwE;YACxE,mEAAmE;YACnE,2BAA2B;YAC3B,MAAM,IAAI,GAAG,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAEjF,IAAI,eAAe,GAAG,yBAAyB,CAAC;YAChD,IAAI,IAAI,EAAE,CAAC;gBACT,eAAe,IAAI,eAAe,IAAI,IAAI,CAAC;YAC7C,CAAC;YACD,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACnB,eAAe,IAAI,gBAAgB,QAAQ,CAAC,KAAK,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,CAAC,QAAQ,CAAC,WAAW,CAAC;QACrD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;KAC/D,EACD,KAAK,EAAE,IAA+D,EAAE,EAAE;QACxE,IAAI,CAAC;YACH,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,oBAAoB,CAAC,CAAC;YAErD,MAAM,UAAU,GAAQ,EAAE,CAAC;YAC3B,IAAI,IAAI,CAAC,SAAS;gBAAE,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC;YAC3D,IAAI,IAAI,CAAC,QAAQ;gBAAE,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;YACxD,IAAI,IAAI,CAAC,KAAK;gBAAE,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YAE9C,MAAM,aAAa,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;YAE/C,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,wCAAwC;qBAC/C;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,cAAc,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testingbot/mcp-server",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "mcpName": "io.testingbot/mcp-server",
@@ -9,7 +9,7 @@
9
9
  "url": "git+https://github.com/testingbot/mcp-server.git"
10
10
  },
11
11
  "scripts": {
12
- "build": "npm run lint && npm run format && npm test && tsc",
12
+ "build": "npm run version:sync && npm run lint && npm run format:check && npm test && tsc",
13
13
  "start": "node dist/index.js",
14
14
  "dev": "NODE_ENV=development tsx watch --clear-screen=false src/index.ts",
15
15
  "test": "vitest run",
@@ -18,7 +18,13 @@
18
18
  "lint": "eslint . --ext .ts",
19
19
  "lint:fix": "eslint . --ext .ts --fix",
20
20
  "format": "prettier --write \"src/**/*.ts\"",
21
- "format:check": "prettier --check \"src/**/*.ts\""
21
+ "format:check": "prettier --check \"src/**/*.ts\"",
22
+ "version:sync": "node scripts/sync-version.mjs",
23
+ "version:check": "node scripts/sync-version.mjs --check",
24
+ "version": "npm run version:sync && git add manifest.json server.json",
25
+ "dev:rebuild": "bash scripts/dev.sh",
26
+ "mcpb": "bash scripts/build-mcpb.sh",
27
+ "mcpb:validate": "mcpb validate manifest.json"
22
28
  },
23
29
  "bin": {
24
30
  "testingbot-mcp-server": "dist/index.js"
@@ -51,6 +57,7 @@
51
57
  },
52
58
  "dependencies": {
53
59
  "@modelcontextprotocol/sdk": "^1.0.4",
60
+ "@testingbot/automation-mcp": "^0.1.5",
54
61
  "dotenv": "^16.4.5",
55
62
  "pino": "^9.6.0",
56
63
  "pino-pretty": "^13.0.0",