@burdenoff/mcp-libs 2026.522.1 → 2026.525.1
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/dist/chunk-HRWIDQJE.js +1771 -0
- package/dist/chunk-HRWIDQJE.js.map +1 -0
- package/dist/modules/auth/index.cjs +317 -0
- package/dist/modules/auth/index.cjs.map +1 -1
- package/dist/modules/auth/index.js +289 -1
- package/dist/modules/auth/index.js.map +1 -1
- package/dist/modules/channels/index.cjs +47 -0
- package/dist/modules/channels/index.cjs.map +1 -1
- package/dist/modules/channels/index.js +47 -0
- package/dist/modules/channels/index.js.map +1 -1
- package/dist/modules/conversations/index.cjs +1355 -0
- package/dist/modules/conversations/index.cjs.map +1 -1
- package/dist/modules/conversations/index.js +1355 -0
- package/dist/modules/conversations/index.js.map +1 -1
- package/dist/modules/devportal/index.cjs +281 -0
- package/dist/modules/devportal/index.cjs.map +1 -1
- package/dist/modules/devportal/index.js +281 -0
- package/dist/modules/devportal/index.js.map +1 -1
- package/dist/modules/export/index.cjs +348 -0
- package/dist/modules/export/index.cjs.map +1 -1
- package/dist/modules/export/index.js +348 -0
- package/dist/modules/export/index.js.map +1 -1
- package/dist/modules/files/index.cjs +244 -2
- package/dist/modules/files/index.cjs.map +1 -1
- package/dist/modules/files/index.js +244 -2
- package/dist/modules/files/index.js.map +1 -1
- package/dist/modules/integrations/index.cjs +539 -0
- package/dist/modules/integrations/index.cjs.map +1 -1
- package/dist/modules/integrations/index.js +539 -0
- package/dist/modules/integrations/index.js.map +1 -1
- package/dist/modules/organizations/index.cjs +211 -0
- package/dist/modules/organizations/index.cjs.map +1 -1
- package/dist/modules/organizations/index.js +211 -0
- package/dist/modules/organizations/index.js.map +1 -1
- package/dist/modules/products/index.cjs +131 -0
- package/dist/modules/products/index.cjs.map +1 -1
- package/dist/modules/products/index.js +131 -0
- package/dist/modules/products/index.js.map +1 -1
- package/dist/modules/rbac/index.cjs +114 -0
- package/dist/modules/rbac/index.cjs.map +1 -1
- package/dist/modules/rbac/index.js +114 -0
- package/dist/modules/rbac/index.js.map +1 -1
- package/dist/modules/sandbox/index.cjs +864 -0
- package/dist/modules/sandbox/index.cjs.map +1 -1
- package/dist/modules/sandbox/index.js +699 -1
- package/dist/modules/sandbox/index.js.map +1 -1
- package/dist/modules/scheduler/index.cjs +860 -0
- package/dist/modules/scheduler/index.cjs.map +1 -1
- package/dist/modules/scheduler/index.js +860 -0
- package/dist/modules/scheduler/index.js.map +1 -1
- package/dist/modules/security/index.cjs +51 -0
- package/dist/modules/security/index.cjs.map +1 -1
- package/dist/modules/security/index.js +51 -0
- package/dist/modules/security/index.js.map +1 -1
- package/dist/modules/store/index.cjs +102 -0
- package/dist/modules/store/index.cjs.map +1 -1
- package/dist/modules/store/index.js +102 -0
- package/dist/modules/store/index.js.map +1 -1
- package/dist/modules/tours/index.cjs +43 -0
- package/dist/modules/tours/index.cjs.map +1 -1
- package/dist/modules/tours/index.js +43 -0
- package/dist/modules/tours/index.js.map +1 -1
- package/dist/modules/vibecontrols/index.cjs +4618 -668
- package/dist/modules/vibecontrols/index.cjs.map +1 -1
- package/dist/modules/vibecontrols/index.js +3626 -434
- package/dist/modules/vibecontrols/index.js.map +1 -1
- package/dist/modules/workspaces/index.cjs +46 -3
- package/dist/modules/workspaces/index.cjs.map +1 -1
- package/dist/modules/workspaces/index.js +46 -3
- package/dist/modules/workspaces/index.js.map +1 -1
- package/package.json +4 -3
- package/dist/chunk-4GBVJ4OY.js +0 -847
- package/dist/chunk-4GBVJ4OY.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LIST_SANDBOXES, GET_SANDBOX, CREATE_SANDBOX, DELETE_SANDBOX, STOP_SANDBOX, EXTEND_SANDBOX_TTL } from '../../chunk-
|
|
1
|
+
import { LIST_SANDBOXES, GET_SANDBOX, CREATE_SANDBOX, DELETE_SANDBOX, STOP_SANDBOX, EXTEND_SANDBOX_TTL, LIST_SANDBOX_TEMPLATES, GET_SANDBOX_TEMPLATE, CREATE_SANDBOX_TEMPLATE, UPDATE_SANDBOX_TEMPLATE, DELETE_SANDBOX_TEMPLATE, AVAILABLE_SANDBOX_TAGS, GET_SANDBOX_TAGS, CREATE_SANDBOX_TAG, TAG_SANDBOX, UNTAG_SANDBOX, REPLACE_SANDBOX_TAGS, LIST_ALL_SANDBOXES, LIST_SANDBOX_NODES, GET_ACTIVE_SANDBOXES, GET_RECENT_SANDBOX_ACTIVITY, GET_SANDBOX_STATS, GET_SANDBOX_LOGS, GET_SANDBOX_CONFIG, UPDATE_SANDBOX_CONFIG, EXPORT_SANDBOXES, GET_SANDBOX_EXPORT_JOB, LIST_SANDBOX_EXPORT_JOBS, GET_SANDBOX_ARTIFACT_BYTES, PROXY_SANDBOX_REQUEST } from '../../chunk-HRWIDQJE.js';
|
|
2
2
|
import { mcpToolName, jsonResult, errorResult } from '../../chunk-H2OYWLOA.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
@@ -200,6 +200,704 @@ function registerSandboxTools(server, ctx, track) {
|
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
);
|
|
203
|
+
server.registerTool(
|
|
204
|
+
track(mcpToolName(ctx.productName, "sandbox_templates_list")),
|
|
205
|
+
{
|
|
206
|
+
title: "List Sandbox Templates",
|
|
207
|
+
description: "List sandbox template configurations available in this workspace.",
|
|
208
|
+
inputSchema: {
|
|
209
|
+
template: z.string().optional().describe("Filter by template kind"),
|
|
210
|
+
limit: z.number().optional(),
|
|
211
|
+
offset: z.number().optional()
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
async ({ template, limit, offset }) => {
|
|
215
|
+
try {
|
|
216
|
+
const pagination = {};
|
|
217
|
+
if (limit !== void 0) pagination.limit = limit;
|
|
218
|
+
if (offset !== void 0) pagination.offset = offset;
|
|
219
|
+
const data = await ctx.gql.workspace.request(
|
|
220
|
+
LIST_SANDBOX_TEMPLATES,
|
|
221
|
+
{
|
|
222
|
+
template,
|
|
223
|
+
pagination: Object.keys(pagination).length > 0 ? pagination : void 0
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
return jsonResult(data.listSandboxTemplates);
|
|
227
|
+
} catch (error) {
|
|
228
|
+
ctx.logger.error("sandbox_templates_list failed", { error });
|
|
229
|
+
return errorResult(
|
|
230
|
+
`Failed to list templates: ${error instanceof Error ? error.message : String(error)}`
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
server.registerTool(
|
|
236
|
+
track(mcpToolName(ctx.productName, "sandbox_templates_get")),
|
|
237
|
+
{
|
|
238
|
+
title: "Get Sandbox Template",
|
|
239
|
+
description: "Get a sandbox template by ID.",
|
|
240
|
+
inputSchema: { id: z.string().describe("Template ID") }
|
|
241
|
+
},
|
|
242
|
+
async ({ id }) => {
|
|
243
|
+
try {
|
|
244
|
+
const data = await ctx.gql.workspace.request(
|
|
245
|
+
GET_SANDBOX_TEMPLATE,
|
|
246
|
+
{ id }
|
|
247
|
+
);
|
|
248
|
+
return jsonResult(data.getSandboxTemplate);
|
|
249
|
+
} catch (error) {
|
|
250
|
+
ctx.logger.error("sandbox_templates_get failed", { error });
|
|
251
|
+
return errorResult(
|
|
252
|
+
`Failed to get template: ${error instanceof Error ? error.message : String(error)}`
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
server.registerTool(
|
|
258
|
+
track(mcpToolName(ctx.productName, "sandbox_templates_create")),
|
|
259
|
+
{
|
|
260
|
+
title: "Create Sandbox Template",
|
|
261
|
+
description: "Create a new sandbox template configuration.",
|
|
262
|
+
inputSchema: {
|
|
263
|
+
name: z.string(),
|
|
264
|
+
template: z.enum([
|
|
265
|
+
"VIBECONTROLS",
|
|
266
|
+
"AI_BUILDER",
|
|
267
|
+
"WORKFLOW_MULTI_NODE",
|
|
268
|
+
"MISC_SHELL",
|
|
269
|
+
"CUSTOM",
|
|
270
|
+
"DOCS_BUILDER"
|
|
271
|
+
]),
|
|
272
|
+
description: z.string().optional(),
|
|
273
|
+
isDefault: z.boolean().optional(),
|
|
274
|
+
ttlSeconds: z.number().optional()
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
async ({ name, template, description, isDefault, ttlSeconds }) => {
|
|
278
|
+
try {
|
|
279
|
+
const input = { name, template };
|
|
280
|
+
if (description !== void 0) input.description = description;
|
|
281
|
+
if (isDefault !== void 0) input.isDefault = isDefault;
|
|
282
|
+
if (ttlSeconds !== void 0) input.ttlSeconds = ttlSeconds;
|
|
283
|
+
const data = await ctx.gql.workspace.request(
|
|
284
|
+
CREATE_SANDBOX_TEMPLATE,
|
|
285
|
+
{ input }
|
|
286
|
+
);
|
|
287
|
+
return jsonResult(data.createSandboxTemplate);
|
|
288
|
+
} catch (error) {
|
|
289
|
+
ctx.logger.error("sandbox_templates_create failed", { error });
|
|
290
|
+
return errorResult(
|
|
291
|
+
`Failed to create template: ${error instanceof Error ? error.message : String(error)}`
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
);
|
|
296
|
+
server.registerTool(
|
|
297
|
+
track(mcpToolName(ctx.productName, "sandbox_templates_update")),
|
|
298
|
+
{
|
|
299
|
+
title: "Update Sandbox Template",
|
|
300
|
+
description: "Update a sandbox template configuration.",
|
|
301
|
+
inputSchema: {
|
|
302
|
+
id: z.string(),
|
|
303
|
+
name: z.string().optional(),
|
|
304
|
+
description: z.string().optional(),
|
|
305
|
+
isDefault: z.boolean().optional(),
|
|
306
|
+
ttlSeconds: z.number().optional()
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
async ({ id, name, description, isDefault, ttlSeconds }) => {
|
|
310
|
+
try {
|
|
311
|
+
const input = { id };
|
|
312
|
+
if (name !== void 0) input.name = name;
|
|
313
|
+
if (description !== void 0) input.description = description;
|
|
314
|
+
if (isDefault !== void 0) input.isDefault = isDefault;
|
|
315
|
+
if (ttlSeconds !== void 0) input.ttlSeconds = ttlSeconds;
|
|
316
|
+
const data = await ctx.gql.workspace.request(
|
|
317
|
+
UPDATE_SANDBOX_TEMPLATE,
|
|
318
|
+
{ input }
|
|
319
|
+
);
|
|
320
|
+
return jsonResult(data.updateSandboxTemplate);
|
|
321
|
+
} catch (error) {
|
|
322
|
+
ctx.logger.error("sandbox_templates_update failed", { error });
|
|
323
|
+
return errorResult(
|
|
324
|
+
`Failed to update template: ${error instanceof Error ? error.message : String(error)}`
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
);
|
|
329
|
+
server.registerTool(
|
|
330
|
+
track(mcpToolName(ctx.productName, "sandbox_templates_delete")),
|
|
331
|
+
{
|
|
332
|
+
title: "Delete Sandbox Template",
|
|
333
|
+
description: "Delete a sandbox template configuration.",
|
|
334
|
+
inputSchema: { id: z.string() }
|
|
335
|
+
},
|
|
336
|
+
async ({ id }) => {
|
|
337
|
+
try {
|
|
338
|
+
const data = await ctx.gql.workspace.request(
|
|
339
|
+
DELETE_SANDBOX_TEMPLATE,
|
|
340
|
+
{ id }
|
|
341
|
+
);
|
|
342
|
+
return jsonResult({ deleted: data.deleteSandboxTemplate, templateId: id });
|
|
343
|
+
} catch (error) {
|
|
344
|
+
ctx.logger.error("sandbox_templates_delete failed", { error });
|
|
345
|
+
return errorResult(
|
|
346
|
+
`Failed to delete template: ${error instanceof Error ? error.message : String(error)}`
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
);
|
|
351
|
+
server.registerTool(
|
|
352
|
+
track(mcpToolName(ctx.productName, "sandbox_tags_list")),
|
|
353
|
+
{
|
|
354
|
+
title: "List Available Sandbox Tags",
|
|
355
|
+
description: "List available sandbox tags in the workspace.",
|
|
356
|
+
inputSchema: {
|
|
357
|
+
query: z.string().optional(),
|
|
358
|
+
limit: z.number().optional()
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
async ({ query, limit }) => {
|
|
362
|
+
try {
|
|
363
|
+
const data = await ctx.gql.workspace.request(
|
|
364
|
+
AVAILABLE_SANDBOX_TAGS,
|
|
365
|
+
{ query, limit }
|
|
366
|
+
);
|
|
367
|
+
return jsonResult(data.availableSandboxTags);
|
|
368
|
+
} catch (error) {
|
|
369
|
+
ctx.logger.error("sandbox_tags_list failed", { error });
|
|
370
|
+
return errorResult(
|
|
371
|
+
`Failed to list tags: ${error instanceof Error ? error.message : String(error)}`
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
);
|
|
376
|
+
server.registerTool(
|
|
377
|
+
track(mcpToolName(ctx.productName, "sandbox_tags_get")),
|
|
378
|
+
{
|
|
379
|
+
title: "Get Sandbox Tags",
|
|
380
|
+
description: "Get tag assignments for a sandbox.",
|
|
381
|
+
inputSchema: { sandboxId: z.string() }
|
|
382
|
+
},
|
|
383
|
+
async ({ sandboxId }) => {
|
|
384
|
+
try {
|
|
385
|
+
const data = await ctx.gql.workspace.request(
|
|
386
|
+
GET_SANDBOX_TAGS,
|
|
387
|
+
{ input: { sandboxId } }
|
|
388
|
+
);
|
|
389
|
+
return jsonResult(data.getSandboxTags);
|
|
390
|
+
} catch (error) {
|
|
391
|
+
ctx.logger.error("sandbox_tags_get failed", { error });
|
|
392
|
+
return errorResult(
|
|
393
|
+
`Failed to get tags: ${error instanceof Error ? error.message : String(error)}`
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
);
|
|
398
|
+
server.registerTool(
|
|
399
|
+
track(mcpToolName(ctx.productName, "sandbox_tags_create")),
|
|
400
|
+
{
|
|
401
|
+
title: "Create Sandbox Tag",
|
|
402
|
+
description: "Create a new sandbox tag.",
|
|
403
|
+
inputSchema: {
|
|
404
|
+
label: z.string(),
|
|
405
|
+
color: z.string().optional()
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
async ({ label, color }) => {
|
|
409
|
+
try {
|
|
410
|
+
const input = { label };
|
|
411
|
+
if (color !== void 0) input.color = color;
|
|
412
|
+
const data = await ctx.gql.workspace.request(
|
|
413
|
+
CREATE_SANDBOX_TAG,
|
|
414
|
+
{ input }
|
|
415
|
+
);
|
|
416
|
+
return jsonResult(data.createSandboxTag);
|
|
417
|
+
} catch (error) {
|
|
418
|
+
ctx.logger.error("sandbox_tags_create failed", { error });
|
|
419
|
+
return errorResult(
|
|
420
|
+
`Failed to create tag: ${error instanceof Error ? error.message : String(error)}`
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
);
|
|
425
|
+
server.registerTool(
|
|
426
|
+
track(mcpToolName(ctx.productName, "sandbox_tags_attach")),
|
|
427
|
+
{
|
|
428
|
+
title: "Attach Tag to Sandbox",
|
|
429
|
+
description: "Attach a tag to a sandbox.",
|
|
430
|
+
inputSchema: {
|
|
431
|
+
sandboxId: z.string(),
|
|
432
|
+
tagId: z.string(),
|
|
433
|
+
source: z.string().optional()
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
async ({ sandboxId, tagId, source }) => {
|
|
437
|
+
try {
|
|
438
|
+
const input = { sandboxId, tagId };
|
|
439
|
+
if (source !== void 0) input.source = source;
|
|
440
|
+
const data = await ctx.gql.workspace.request(TAG_SANDBOX, {
|
|
441
|
+
input
|
|
442
|
+
});
|
|
443
|
+
return jsonResult(data.tagSandbox);
|
|
444
|
+
} catch (error) {
|
|
445
|
+
ctx.logger.error("sandbox_tags_attach failed", { error });
|
|
446
|
+
return errorResult(
|
|
447
|
+
`Failed to attach tag: ${error instanceof Error ? error.message : String(error)}`
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
);
|
|
452
|
+
server.registerTool(
|
|
453
|
+
track(mcpToolName(ctx.productName, "sandbox_tags_detach")),
|
|
454
|
+
{
|
|
455
|
+
title: "Detach Tag from Sandbox",
|
|
456
|
+
description: "Detach a tag from a sandbox.",
|
|
457
|
+
inputSchema: {
|
|
458
|
+
sandboxId: z.string(),
|
|
459
|
+
tagId: z.string()
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
async ({ sandboxId, tagId }) => {
|
|
463
|
+
try {
|
|
464
|
+
const data = await ctx.gql.workspace.request(UNTAG_SANDBOX, {
|
|
465
|
+
input: { sandboxId, tagId }
|
|
466
|
+
});
|
|
467
|
+
return jsonResult({ detached: data.untagSandbox, sandboxId, tagId });
|
|
468
|
+
} catch (error) {
|
|
469
|
+
ctx.logger.error("sandbox_tags_detach failed", { error });
|
|
470
|
+
return errorResult(
|
|
471
|
+
`Failed to detach tag: ${error instanceof Error ? error.message : String(error)}`
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
);
|
|
476
|
+
server.registerTool(
|
|
477
|
+
track(mcpToolName(ctx.productName, "sandbox_tags_replace")),
|
|
478
|
+
{
|
|
479
|
+
title: "Replace Sandbox Tags",
|
|
480
|
+
description: "Replace the full set of tags on a sandbox.",
|
|
481
|
+
inputSchema: {
|
|
482
|
+
sandboxId: z.string(),
|
|
483
|
+
tagIds: z.array(z.string())
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
async ({ sandboxId, tagIds }) => {
|
|
487
|
+
try {
|
|
488
|
+
const data = await ctx.gql.workspace.request(
|
|
489
|
+
REPLACE_SANDBOX_TAGS,
|
|
490
|
+
{ input: { sandboxId, tagIds } }
|
|
491
|
+
);
|
|
492
|
+
return jsonResult(data.replaceSandboxTags);
|
|
493
|
+
} catch (error) {
|
|
494
|
+
ctx.logger.error("sandbox_tags_replace failed", { error });
|
|
495
|
+
return errorResult(
|
|
496
|
+
`Failed to replace tags: ${error instanceof Error ? error.message : String(error)}`
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
);
|
|
501
|
+
server.registerTool(
|
|
502
|
+
track(mcpToolName(ctx.productName, "sandbox_admin_list_all")),
|
|
503
|
+
{
|
|
504
|
+
title: "List All Sandboxes (admin)",
|
|
505
|
+
description: "Admin-only list across the entire workspace including internal sandboxes.",
|
|
506
|
+
inputSchema: {
|
|
507
|
+
status: z.string().optional(),
|
|
508
|
+
template: z.string().optional(),
|
|
509
|
+
limit: z.number().optional(),
|
|
510
|
+
offset: z.number().optional()
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
async ({ status, template, limit, offset }) => {
|
|
514
|
+
try {
|
|
515
|
+
const filter = {};
|
|
516
|
+
if (status !== void 0) filter.status = status;
|
|
517
|
+
if (template !== void 0) filter.template = template;
|
|
518
|
+
const pagination = {};
|
|
519
|
+
if (limit !== void 0) pagination.limit = limit;
|
|
520
|
+
if (offset !== void 0) pagination.offset = offset;
|
|
521
|
+
const data = await ctx.gql.workspace.request(
|
|
522
|
+
LIST_ALL_SANDBOXES,
|
|
523
|
+
{
|
|
524
|
+
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
525
|
+
pagination: Object.keys(pagination).length > 0 ? pagination : void 0
|
|
526
|
+
}
|
|
527
|
+
);
|
|
528
|
+
return jsonResult(data.listAllSandboxes);
|
|
529
|
+
} catch (error) {
|
|
530
|
+
ctx.logger.error("sandbox_admin_list_all failed", { error });
|
|
531
|
+
return errorResult(
|
|
532
|
+
`Failed to list all sandboxes: ${error instanceof Error ? error.message : String(error)}`
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
);
|
|
537
|
+
server.registerTool(
|
|
538
|
+
track(mcpToolName(ctx.productName, "sandbox_admin_nodes_list")),
|
|
539
|
+
{
|
|
540
|
+
title: "List Sandbox Nodes",
|
|
541
|
+
description: "List Kubernetes nodes hosting sandbox workloads with capacity info.",
|
|
542
|
+
inputSchema: {}
|
|
543
|
+
},
|
|
544
|
+
async () => {
|
|
545
|
+
try {
|
|
546
|
+
const data = await ctx.gql.workspace.request(
|
|
547
|
+
LIST_SANDBOX_NODES,
|
|
548
|
+
{}
|
|
549
|
+
);
|
|
550
|
+
return jsonResult(data.listSandboxNodes);
|
|
551
|
+
} catch (error) {
|
|
552
|
+
ctx.logger.error("sandbox_admin_nodes_list failed", { error });
|
|
553
|
+
return errorResult(
|
|
554
|
+
`Failed to list nodes: ${error instanceof Error ? error.message : String(error)}`
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
);
|
|
559
|
+
server.registerTool(
|
|
560
|
+
track(mcpToolName(ctx.productName, "sandbox_admin_active")),
|
|
561
|
+
{
|
|
562
|
+
title: "Get Active Sandboxes",
|
|
563
|
+
description: "Get currently active sandboxes in the workspace.",
|
|
564
|
+
inputSchema: {}
|
|
565
|
+
},
|
|
566
|
+
async () => {
|
|
567
|
+
try {
|
|
568
|
+
const data = await ctx.gql.workspace.request(
|
|
569
|
+
GET_ACTIVE_SANDBOXES,
|
|
570
|
+
{}
|
|
571
|
+
);
|
|
572
|
+
return jsonResult(data.getActiveSandboxes);
|
|
573
|
+
} catch (error) {
|
|
574
|
+
ctx.logger.error("sandbox_admin_active failed", { error });
|
|
575
|
+
return errorResult(
|
|
576
|
+
`Failed to get active sandboxes: ${error instanceof Error ? error.message : String(error)}`
|
|
577
|
+
);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
);
|
|
581
|
+
server.registerTool(
|
|
582
|
+
track(mcpToolName(ctx.productName, "sandbox_admin_activity")),
|
|
583
|
+
{
|
|
584
|
+
title: "Recent Sandbox Activity",
|
|
585
|
+
description: "Get recent sandbox lifecycle activity (create/stop/delete/extend).",
|
|
586
|
+
inputSchema: { limit: z.number().optional() }
|
|
587
|
+
},
|
|
588
|
+
async ({ limit }) => {
|
|
589
|
+
try {
|
|
590
|
+
const data = await ctx.gql.workspace.request(
|
|
591
|
+
GET_RECENT_SANDBOX_ACTIVITY,
|
|
592
|
+
{ limit }
|
|
593
|
+
);
|
|
594
|
+
return jsonResult(data.getRecentSandboxActivity);
|
|
595
|
+
} catch (error) {
|
|
596
|
+
ctx.logger.error("sandbox_admin_activity failed", { error });
|
|
597
|
+
return errorResult(
|
|
598
|
+
`Failed to get activity: ${error instanceof Error ? error.message : String(error)}`
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
);
|
|
603
|
+
server.registerTool(
|
|
604
|
+
track(mcpToolName(ctx.productName, "sandbox_admin_stats")),
|
|
605
|
+
{
|
|
606
|
+
title: "Sandbox Stats",
|
|
607
|
+
description: "Get aggregate sandbox usage statistics for the workspace.",
|
|
608
|
+
inputSchema: {}
|
|
609
|
+
},
|
|
610
|
+
async () => {
|
|
611
|
+
try {
|
|
612
|
+
const data = await ctx.gql.workspace.request(
|
|
613
|
+
GET_SANDBOX_STATS,
|
|
614
|
+
{}
|
|
615
|
+
);
|
|
616
|
+
return jsonResult(data.getSandboxStats);
|
|
617
|
+
} catch (error) {
|
|
618
|
+
ctx.logger.error("sandbox_admin_stats failed", { error });
|
|
619
|
+
return errorResult(
|
|
620
|
+
`Failed to get stats: ${error instanceof Error ? error.message : String(error)}`
|
|
621
|
+
);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
);
|
|
625
|
+
server.registerTool(
|
|
626
|
+
track(mcpToolName(ctx.productName, "sandbox_admin_logs")),
|
|
627
|
+
{
|
|
628
|
+
title: "Get Sandbox Logs",
|
|
629
|
+
description: "Fetch logs for a sandbox container.",
|
|
630
|
+
inputSchema: {
|
|
631
|
+
id: z.string(),
|
|
632
|
+
containerName: z.string(),
|
|
633
|
+
tailLines: z.number().optional()
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
async ({ id, containerName, tailLines }) => {
|
|
637
|
+
try {
|
|
638
|
+
const data = await ctx.gql.workspace.request(GET_SANDBOX_LOGS, {
|
|
639
|
+
id,
|
|
640
|
+
containerName,
|
|
641
|
+
tailLines
|
|
642
|
+
});
|
|
643
|
+
return jsonResult({ logs: data.getSandboxLogs });
|
|
644
|
+
} catch (error) {
|
|
645
|
+
ctx.logger.error("sandbox_admin_logs failed", { error });
|
|
646
|
+
return errorResult(
|
|
647
|
+
`Failed to get logs: ${error instanceof Error ? error.message : String(error)}`
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
);
|
|
652
|
+
server.registerTool(
|
|
653
|
+
track(mcpToolName(ctx.productName, "sandbox_admin_config_get")),
|
|
654
|
+
{
|
|
655
|
+
title: "Get Sandbox Config",
|
|
656
|
+
description: "Get the per-workspace sandbox configuration limits.",
|
|
657
|
+
inputSchema: {}
|
|
658
|
+
},
|
|
659
|
+
async () => {
|
|
660
|
+
try {
|
|
661
|
+
const data = await ctx.gql.workspace.request(
|
|
662
|
+
GET_SANDBOX_CONFIG,
|
|
663
|
+
{}
|
|
664
|
+
);
|
|
665
|
+
return jsonResult(data.getSandboxConfig);
|
|
666
|
+
} catch (error) {
|
|
667
|
+
ctx.logger.error("sandbox_admin_config_get failed", { error });
|
|
668
|
+
return errorResult(
|
|
669
|
+
`Failed to get config: ${error instanceof Error ? error.message : String(error)}`
|
|
670
|
+
);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
);
|
|
674
|
+
server.registerTool(
|
|
675
|
+
track(mcpToolName(ctx.productName, "sandbox_admin_config_set")),
|
|
676
|
+
{
|
|
677
|
+
title: "Update Sandbox Config",
|
|
678
|
+
description: "Update the per-workspace sandbox configuration limits.",
|
|
679
|
+
inputSchema: {
|
|
680
|
+
defaultTtlSeconds: z.number().optional(),
|
|
681
|
+
maxTtlSeconds: z.number().optional(),
|
|
682
|
+
maxConcurrentPerUser: z.number().optional(),
|
|
683
|
+
maxConcurrentPerWorkspace: z.number().optional()
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
async ({
|
|
687
|
+
defaultTtlSeconds,
|
|
688
|
+
maxTtlSeconds,
|
|
689
|
+
maxConcurrentPerUser,
|
|
690
|
+
maxConcurrentPerWorkspace
|
|
691
|
+
}) => {
|
|
692
|
+
try {
|
|
693
|
+
const input = {};
|
|
694
|
+
if (defaultTtlSeconds !== void 0) input.defaultTtlSeconds = defaultTtlSeconds;
|
|
695
|
+
if (maxTtlSeconds !== void 0) input.maxTtlSeconds = maxTtlSeconds;
|
|
696
|
+
if (maxConcurrentPerUser !== void 0) input.maxConcurrentPerUser = maxConcurrentPerUser;
|
|
697
|
+
if (maxConcurrentPerWorkspace !== void 0)
|
|
698
|
+
input.maxConcurrentPerWorkspace = maxConcurrentPerWorkspace;
|
|
699
|
+
const data = await ctx.gql.workspace.request(
|
|
700
|
+
UPDATE_SANDBOX_CONFIG,
|
|
701
|
+
{ input }
|
|
702
|
+
);
|
|
703
|
+
return jsonResult(data.updateSandboxConfig);
|
|
704
|
+
} catch (error) {
|
|
705
|
+
ctx.logger.error("sandbox_admin_config_set failed", { error });
|
|
706
|
+
return errorResult(
|
|
707
|
+
`Failed to update config: ${error instanceof Error ? error.message : String(error)}`
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
);
|
|
712
|
+
server.registerTool(
|
|
713
|
+
track(mcpToolName(ctx.productName, "sandbox_export_create")),
|
|
714
|
+
{
|
|
715
|
+
title: "Create Sandbox Export Job",
|
|
716
|
+
description: "Kick off an async job to export sandboxes for the workspace.",
|
|
717
|
+
inputSchema: {
|
|
718
|
+
workspaceId: z.string(),
|
|
719
|
+
format: z.enum(["CSV", "JSON"]),
|
|
720
|
+
includeUsageEvents: z.boolean().optional()
|
|
721
|
+
}
|
|
722
|
+
},
|
|
723
|
+
async ({ workspaceId, format, includeUsageEvents }) => {
|
|
724
|
+
try {
|
|
725
|
+
const input = { workspaceId, format };
|
|
726
|
+
if (includeUsageEvents !== void 0) input.includeUsageEvents = includeUsageEvents;
|
|
727
|
+
const data = await ctx.gql.workspace.request(
|
|
728
|
+
EXPORT_SANDBOXES,
|
|
729
|
+
{ input }
|
|
730
|
+
);
|
|
731
|
+
return jsonResult(data.exportSandboxes);
|
|
732
|
+
} catch (error) {
|
|
733
|
+
ctx.logger.error("sandbox_export_create failed", { error });
|
|
734
|
+
return errorResult(
|
|
735
|
+
`Failed to create export: ${error instanceof Error ? error.message : String(error)}`
|
|
736
|
+
);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
);
|
|
740
|
+
server.registerTool(
|
|
741
|
+
track(mcpToolName(ctx.productName, "sandbox_export_get")),
|
|
742
|
+
{
|
|
743
|
+
title: "Get Sandbox Export Job",
|
|
744
|
+
description: "Get a sandbox export job by ID. Poll this to track progress (MCP has no subscriptions).",
|
|
745
|
+
inputSchema: {
|
|
746
|
+
workspaceId: z.string(),
|
|
747
|
+
jobId: z.string()
|
|
748
|
+
}
|
|
749
|
+
},
|
|
750
|
+
async ({ workspaceId, jobId }) => {
|
|
751
|
+
try {
|
|
752
|
+
const data = await ctx.gql.workspace.request(
|
|
753
|
+
GET_SANDBOX_EXPORT_JOB,
|
|
754
|
+
{ workspaceId, jobId }
|
|
755
|
+
);
|
|
756
|
+
return jsonResult(data.getSandboxExportJob);
|
|
757
|
+
} catch (error) {
|
|
758
|
+
ctx.logger.error("sandbox_export_get failed", { error });
|
|
759
|
+
return errorResult(
|
|
760
|
+
`Failed to get export job: ${error instanceof Error ? error.message : String(error)}`
|
|
761
|
+
);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
);
|
|
765
|
+
server.registerTool(
|
|
766
|
+
track(mcpToolName(ctx.productName, "sandbox_export_list")),
|
|
767
|
+
{
|
|
768
|
+
title: "List Sandbox Export Jobs",
|
|
769
|
+
description: "List sandbox export jobs for a workspace.",
|
|
770
|
+
inputSchema: {
|
|
771
|
+
workspaceId: z.string(),
|
|
772
|
+
limit: z.number().optional(),
|
|
773
|
+
offset: z.number().optional()
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
async ({ workspaceId, limit, offset }) => {
|
|
777
|
+
try {
|
|
778
|
+
const pagination = {};
|
|
779
|
+
if (limit !== void 0) pagination.limit = limit;
|
|
780
|
+
if (offset !== void 0) pagination.offset = offset;
|
|
781
|
+
const data = await ctx.gql.workspace.request(
|
|
782
|
+
LIST_SANDBOX_EXPORT_JOBS,
|
|
783
|
+
{
|
|
784
|
+
workspaceId,
|
|
785
|
+
pagination: Object.keys(pagination).length > 0 ? pagination : void 0
|
|
786
|
+
}
|
|
787
|
+
);
|
|
788
|
+
return jsonResult(data.listSandboxExportJobs);
|
|
789
|
+
} catch (error) {
|
|
790
|
+
ctx.logger.error("sandbox_export_list failed", { error });
|
|
791
|
+
return errorResult(
|
|
792
|
+
`Failed to list export jobs: ${error instanceof Error ? error.message : String(error)}`
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
);
|
|
797
|
+
server.registerTool(
|
|
798
|
+
track(mcpToolName(ctx.productName, "sandbox_export_get_artifact_bytes")),
|
|
799
|
+
{
|
|
800
|
+
title: "Get Sandbox Artifact Bytes",
|
|
801
|
+
description: "Fetch raw artifact bytes for a sandbox session (base64-encoded, 50 MB cap).",
|
|
802
|
+
inputSchema: {
|
|
803
|
+
sandboxId: z.string(),
|
|
804
|
+
sessionId: z.string(),
|
|
805
|
+
path: z.string(),
|
|
806
|
+
onBehalfOfUserId: z.string().optional()
|
|
807
|
+
}
|
|
808
|
+
},
|
|
809
|
+
async ({ sandboxId, sessionId, path, onBehalfOfUserId }) => {
|
|
810
|
+
try {
|
|
811
|
+
const input = { sandboxId, sessionId, path };
|
|
812
|
+
if (onBehalfOfUserId !== void 0) input.onBehalfOfUserId = onBehalfOfUserId;
|
|
813
|
+
const data = await ctx.gql.workspace.request(
|
|
814
|
+
GET_SANDBOX_ARTIFACT_BYTES,
|
|
815
|
+
{ input }
|
|
816
|
+
);
|
|
817
|
+
return jsonResult(data.getSandboxArtifactBytes);
|
|
818
|
+
} catch (error) {
|
|
819
|
+
ctx.logger.error("sandbox_export_get_artifact_bytes failed", { error });
|
|
820
|
+
return errorResult(
|
|
821
|
+
`Failed to get artifact bytes: ${error instanceof Error ? error.message : String(error)}`
|
|
822
|
+
);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
);
|
|
826
|
+
server.registerTool(
|
|
827
|
+
track(mcpToolName(ctx.productName, "sandbox_proxy_request")),
|
|
828
|
+
{
|
|
829
|
+
title: "Proxy HTTP Request to Sandbox",
|
|
830
|
+
description: "Proxy an HTTP request to a service running inside a sandbox container.",
|
|
831
|
+
inputSchema: {
|
|
832
|
+
sandboxId: z.string(),
|
|
833
|
+
method: z.string(),
|
|
834
|
+
path: z.string(),
|
|
835
|
+
body: z.unknown().optional(),
|
|
836
|
+
containerName: z.string().optional()
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
async ({ sandboxId, method, path, body, containerName }) => {
|
|
840
|
+
try {
|
|
841
|
+
const input = { sandboxId, method, path };
|
|
842
|
+
if (body !== void 0) input.body = body;
|
|
843
|
+
if (containerName !== void 0) input.containerName = containerName;
|
|
844
|
+
const data = await ctx.gql.workspace.request(
|
|
845
|
+
PROXY_SANDBOX_REQUEST,
|
|
846
|
+
{ input }
|
|
847
|
+
);
|
|
848
|
+
return jsonResult(data.proxySandboxRequest);
|
|
849
|
+
} catch (error) {
|
|
850
|
+
ctx.logger.error("sandbox_proxy_request failed", { error });
|
|
851
|
+
return errorResult(
|
|
852
|
+
`Failed to proxy request: ${error instanceof Error ? error.message : String(error)}`
|
|
853
|
+
);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
);
|
|
857
|
+
server.registerTool(
|
|
858
|
+
track(mcpToolName(ctx.productName, "sandbox_check")),
|
|
859
|
+
{
|
|
860
|
+
title: "Check Sandbox State",
|
|
861
|
+
description: "Poll a sandbox by ID. MCP has no subscription protocol \u2014 call this in a loop to track lifecycle.",
|
|
862
|
+
inputSchema: { id: z.string() }
|
|
863
|
+
},
|
|
864
|
+
async ({ id }) => {
|
|
865
|
+
try {
|
|
866
|
+
const data = await ctx.gql.workspace.request(GET_SANDBOX, { id });
|
|
867
|
+
return jsonResult(data.getSandbox);
|
|
868
|
+
} catch (error) {
|
|
869
|
+
ctx.logger.error("sandbox_check failed", { error });
|
|
870
|
+
return errorResult(
|
|
871
|
+
`Failed to poll sandbox: ${error instanceof Error ? error.message : String(error)}`
|
|
872
|
+
);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
);
|
|
876
|
+
server.registerTool(
|
|
877
|
+
track(mcpToolName(ctx.productName, "sandbox_export_check")),
|
|
878
|
+
{
|
|
879
|
+
title: "Check Sandbox Export Job",
|
|
880
|
+
description: "Poll an export job by ID. MCP has no subscription protocol \u2014 call this in a loop to track progress.",
|
|
881
|
+
inputSchema: {
|
|
882
|
+
workspaceId: z.string(),
|
|
883
|
+
jobId: z.string()
|
|
884
|
+
}
|
|
885
|
+
},
|
|
886
|
+
async ({ workspaceId, jobId }) => {
|
|
887
|
+
try {
|
|
888
|
+
const data = await ctx.gql.workspace.request(
|
|
889
|
+
GET_SANDBOX_EXPORT_JOB,
|
|
890
|
+
{ workspaceId, jobId }
|
|
891
|
+
);
|
|
892
|
+
return jsonResult(data.getSandboxExportJob);
|
|
893
|
+
} catch (error) {
|
|
894
|
+
ctx.logger.error("sandbox_export_check failed", { error });
|
|
895
|
+
return errorResult(
|
|
896
|
+
`Failed to poll export job: ${error instanceof Error ? error.message : String(error)}`
|
|
897
|
+
);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
);
|
|
203
901
|
}
|
|
204
902
|
|
|
205
903
|
// src/modules/sandbox/index.ts
|