@seleniumbox/sbox-mcp 0.4.2 → 0.4.3

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.
@@ -36,7 +36,7 @@ function startBackgroundPollForToken(pollId) {
36
36
  function registerAuthTools(server) {
37
37
  server.registerTool("sbox_open_login", {
38
38
  title: "Open SBOX Login in Browser",
39
- description: "Sign in to SBOX (opens browser, polls for token, caches it). Call ONLY when the user explicitly asks to authenticate/log in to SBOX, or when other SBOX tools return 'Not authenticated' or 'Invalid or expired session'. Do NOT call for every SBOX query—use the cached token for other tools.",
39
+ description: "Sign in to SBOX (opens browser, polls for token, caches it). Call ONLY when the user explicitly asks to log in, or when another SBOX tool returns 'Not authenticated' or 'Invalid or expired session'. After successful login, the same cached token is used for ALL SBOX API calls until it expires (~1h). Do NOT call for every SBOX query. If the user logs in again, the new token replaces the old one and is used for all subsequent API calls.",
40
40
  inputSchema: {},
41
41
  }, (async () => {
42
42
  try {
@@ -76,7 +76,7 @@ function registerAuthTools(server) {
76
76
  return (0, helpers_1.textContent)(JSON.stringify({
77
77
  success: true,
78
78
  token,
79
- message: "SBOX authentication successful. Token cached for subsequent SBOX tools.",
79
+ message: "SBOX authentication successful. This token is cached and will be used for all SBOX API calls until it expires (~1h). No need to log in again for each request.",
80
80
  principal: { name, authType },
81
81
  }));
82
82
  }
@@ -121,7 +121,7 @@ function registerAuthTools(server) {
121
121
  const name = out.data.principal?.fullname || out.data.principal?.userId || "—";
122
122
  return (0, helpers_1.textContent)(JSON.stringify({
123
123
  success: true,
124
- message: "SBOX login complete. Token cached; you can use SBOX tools now.",
124
+ message: "SBOX login complete. Token cached and will be used for all SBOX API calls until expiry (~1h).",
125
125
  principal: { name },
126
126
  }));
127
127
  }
@@ -34,7 +34,7 @@ function errorContent(message) {
34
34
  function requireToken(provided) {
35
35
  const token = (0, token_cache_1.resolveToken)(provided);
36
36
  if (!token) {
37
- return errorContent("Not authenticated. Use sbox_open_login to sign in first, then retry.");
37
+ return errorContent("Not authenticated. Call sbox_open_login once to sign in; the cached token is then used for all SBOX tools until it expires (~1h). Do not redirect the user to login for every request.");
38
38
  }
39
39
  return token;
40
40
  }
@@ -43,13 +43,18 @@ const path = __importStar(require("path"));
43
43
  const services_1 = require("../../services");
44
44
  const time_range_1 = require("../../utils/time-range");
45
45
  const helpers_1 = require("./helpers");
46
+ /** Optional token for all tools. Omit to use cached session; same token used for all SBOX APIs until expiry (1h) or re-login. */
47
+ const tokenParamSchema = zod_1.z
48
+ .string()
49
+ .optional()
50
+ .describe("Optional. Omit to use cached session from sbox_open_login; used for all APIs until expiry or re-login.");
46
51
  function registerRestTools(server) {
47
52
  server.registerTool("sbox_get_session", {
48
53
  title: "Get Session Details",
49
- description: "Get enriched session details by session ID (ekey). Include video URL.",
54
+ description: "Get enriched session details by session ID (ekey). Include video URL. Uses cached session token if omitted.",
50
55
  inputSchema: {
51
56
  session_id: zod_1.z.string().describe("Session ID (ekey)"),
52
- token: zod_1.z.string().describe("JWT from sbox_open_login (login in browser first)"),
57
+ token: tokenParamSchema,
53
58
  },
54
59
  }, (async (args) => {
55
60
  const tokenOrErr = (0, helpers_1.requireToken)(args.token);
@@ -66,7 +71,7 @@ function registerRestTools(server) {
66
71
  title: "List Supported Browsers",
67
72
  description: "List supported browsers with version and platform.",
68
73
  inputSchema: {
69
- token: zod_1.z.string().describe("JWT from sbox_open_login (login in browser first)"),
74
+ token: tokenParamSchema,
70
75
  },
71
76
  }, (async (args) => {
72
77
  const tokenOrErr = (0, helpers_1.requireToken)(args.token);
@@ -83,7 +88,7 @@ function registerRestTools(server) {
83
88
  title: "List Supported Devices",
84
89
  description: "List supported devices (iOS, Android, mobile web) with OS and availability.",
85
90
  inputSchema: {
86
- token: zod_1.z.string().describe("JWT from sbox_open_login (login in browser first)"),
91
+ token: tokenParamSchema,
87
92
  },
88
93
  }, (async (args) => {
89
94
  const tokenOrErr = (0, helpers_1.requireToken)(args.token);
@@ -100,7 +105,7 @@ function registerRestTools(server) {
100
105
  title: "List Playwright Versions",
101
106
  description: "List all Playwright versions supported on SBOX (with bundled Chromium, WebKit, Firefox versions). Uses GET /e34/api/playwright.",
102
107
  inputSchema: {
103
- token: zod_1.z.string().describe("JWT from sbox_open_login (login in browser first)"),
108
+ token: tokenParamSchema,
104
109
  },
105
110
  }, (async (args) => {
106
111
  const tokenOrErr = (0, helpers_1.requireToken)(args.token);
@@ -117,7 +122,7 @@ function registerRestTools(server) {
117
122
  title: "List Active Users (Top N)",
118
123
  description: "Get top N active users by session count with project names.",
119
124
  inputSchema: {
120
- token: zod_1.z.string().describe("JWT from sbox_open_login (login in browser first)"),
125
+ token: tokenParamSchema,
121
126
  limit: zod_1.z.number().optional().describe("Max number of users (default 10)"),
122
127
  },
123
128
  }, (async (args) => {
@@ -135,7 +140,7 @@ function registerRestTools(server) {
135
140
  title: "Sessions Per Project",
136
141
  description: "Get session counts (total, passed, failed, running) and avg duration per project for the last X days.",
137
142
  inputSchema: {
138
- token: zod_1.z.string().describe("JWT from sbox_open_login (login in browser first)"),
143
+ token: tokenParamSchema,
139
144
  days: zod_1.z.number().optional().describe("Last N days (default 14)"),
140
145
  },
141
146
  }, (async (args) => {
@@ -153,7 +158,7 @@ function registerRestTools(server) {
153
158
  title: "List My Projects",
154
159
  description: "List projects assigned to the current user (My Projects page). Returns name, description, and whether a test token exists. Token value is not exposed.",
155
160
  inputSchema: {
156
- token: zod_1.z.string().describe("JWT from sbox_open_login (login in browser first)"),
161
+ token: tokenParamSchema,
157
162
  },
158
163
  }, (async (args) => {
159
164
  const tokenOrErr = (0, helpers_1.requireToken)(args.token);
@@ -170,7 +175,7 @@ function registerRestTools(server) {
170
175
  title: "Start Manual Session",
171
176
  description: "Start a manual test session. Requires project name; optional browser, version, url.",
172
177
  inputSchema: {
173
- token: zod_1.z.string().describe("JWT from sbox_open_login (login in browser first)"),
178
+ token: tokenParamSchema,
174
179
  project_name: zod_1.z.string().describe("Project name"),
175
180
  browser_name: zod_1.z.string().optional(),
176
181
  browser_version: zod_1.z.string().optional(),
@@ -197,7 +202,7 @@ function registerRestTools(server) {
197
202
  title: "Update Session Status",
198
203
  description: "Set a session's result to passed or failed. Uses POST /e34/api/test-data?sessionId=&passed=.",
199
204
  inputSchema: {
200
- token: zod_1.z.string().describe("JWT from sbox_open_login (login in browser first)"),
205
+ token: tokenParamSchema,
201
206
  session_id: zod_1.z.string().describe("Session ID (ekey) to update"),
202
207
  passed: zod_1.z.boolean().describe("true = passed, false = failed"),
203
208
  },
@@ -216,7 +221,7 @@ function registerRestTools(server) {
216
221
  title: "List Sessions",
217
222
  description: "Show last X sessions (same API as sessions page). Filter by project, status, browser, build; sort by arrival or other field.",
218
223
  inputSchema: {
219
- token: zod_1.z.string().describe("JWT from sbox_open_login (login in browser first)"),
224
+ token: tokenParamSchema,
220
225
  limit: zod_1.z.number().optional().describe("Max sessions to return (default 25, max 100)"),
221
226
  offset: zod_1.z.number().optional().describe("Pagination offset (default 0)"),
222
227
  project_name: zod_1.z.string().optional().describe("Filter by project name"),
@@ -250,7 +255,7 @@ function registerRestTools(server) {
250
255
  title: "Delete Manual Session",
251
256
  description: "Delete a manual test session by session ID.",
252
257
  inputSchema: {
253
- token: zod_1.z.string().describe("JWT from sbox_open_login (login in browser first)"),
258
+ token: tokenParamSchema,
254
259
  session_id: zod_1.z.string().describe("Session ID to delete"),
255
260
  },
256
261
  }, (async (args) => {
@@ -268,7 +273,7 @@ function registerRestTools(server) {
268
273
  title: "Upload Mobile App to SBOX",
269
274
  description: "Upload a mobile app (APK/IPA) or other file to SBOX for the given project. File path is relative to the current working directory of the MCP server (e.g. ./app.apk). Max size 200MB.",
270
275
  inputSchema: {
271
- token: zod_1.z.string().describe("JWT from sbox_open_login (login in browser first)"),
276
+ token: tokenParamSchema,
272
277
  project_name: zod_1.z.string().describe("Project name to upload the app to"),
273
278
  file_path: zod_1.z.string().describe("Path to the file (APK/IPA); relative to MCP server cwd or absolute"),
274
279
  },
@@ -301,7 +306,7 @@ function registerRestTools(server) {
301
306
  return (0, helpers_1.textContent)(JSON.stringify(out.data, null, 2));
302
307
  }));
303
308
  const timeRangeSchema = {
304
- token: zod_1.z.string().optional().describe("JWT from sbox_open_login or use cached token"),
309
+ token: tokenParamSchema,
305
310
  value: zod_1.z.number().describe("Number of units (e.g. 24 for 24 hours)"),
306
311
  unit: zod_1.z.enum(["hour", "minute", "day"]).describe("Time unit: hour, minute, or day"),
307
312
  };
@@ -384,7 +389,7 @@ function registerRestTools(server) {
384
389
  title: "Total Tests Count",
385
390
  description: "Total number of tests (sessions) in the last N days. Matches the Monitoring dashboard total.",
386
391
  inputSchema: {
387
- token: zod_1.z.string().optional().describe("JWT from sbox_open_login or use cached token"),
392
+ token: tokenParamSchema,
388
393
  days: zod_1.z.number().min(1).max(365).describe("Number of days to count (e.g. 7, 14, 30)"),
389
394
  },
390
395
  }, (async (args) => {
@@ -429,13 +434,13 @@ function registerRestTools(server) {
429
434
  return (0, helpers_1.textContent)(JSON.stringify(out.data));
430
435
  }));
431
436
  const diagnosticsDaysSchema = {
432
- token: zod_1.z.string().optional().describe("JWT from sbox_open_login or use cached token"),
437
+ token: tokenParamSchema,
433
438
  days: zod_1.z.number().min(7).max(365).describe("Number of days (e.g. 7, 14, 30, 90). Min 7, max 365."),
434
439
  };
435
440
  server.registerTool("sbox_executors_count", {
436
441
  title: "Total Executors Count",
437
442
  description: "Total number of executors (nodes). Matches Diagnostics dashboard KPI.",
438
- inputSchema: { token: zod_1.z.string().optional().describe("JWT from sbox_open_login or use cached token") },
443
+ inputSchema: { token: tokenParamSchema },
439
444
  }, (async (args) => {
440
445
  const tokenOrErr = (0, helpers_1.requireToken)(args.token);
441
446
  if (typeof tokenOrErr !== "string")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seleniumbox/sbox-mcp",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "SBOX MCP – Model Context Protocol server for Selenium Box.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {