@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.
Files changed (73) hide show
  1. package/dist/chunk-HRWIDQJE.js +1771 -0
  2. package/dist/chunk-HRWIDQJE.js.map +1 -0
  3. package/dist/modules/auth/index.cjs +317 -0
  4. package/dist/modules/auth/index.cjs.map +1 -1
  5. package/dist/modules/auth/index.js +289 -1
  6. package/dist/modules/auth/index.js.map +1 -1
  7. package/dist/modules/channels/index.cjs +47 -0
  8. package/dist/modules/channels/index.cjs.map +1 -1
  9. package/dist/modules/channels/index.js +47 -0
  10. package/dist/modules/channels/index.js.map +1 -1
  11. package/dist/modules/conversations/index.cjs +1355 -0
  12. package/dist/modules/conversations/index.cjs.map +1 -1
  13. package/dist/modules/conversations/index.js +1355 -0
  14. package/dist/modules/conversations/index.js.map +1 -1
  15. package/dist/modules/devportal/index.cjs +281 -0
  16. package/dist/modules/devportal/index.cjs.map +1 -1
  17. package/dist/modules/devportal/index.js +281 -0
  18. package/dist/modules/devportal/index.js.map +1 -1
  19. package/dist/modules/export/index.cjs +348 -0
  20. package/dist/modules/export/index.cjs.map +1 -1
  21. package/dist/modules/export/index.js +348 -0
  22. package/dist/modules/export/index.js.map +1 -1
  23. package/dist/modules/files/index.cjs +244 -2
  24. package/dist/modules/files/index.cjs.map +1 -1
  25. package/dist/modules/files/index.js +244 -2
  26. package/dist/modules/files/index.js.map +1 -1
  27. package/dist/modules/integrations/index.cjs +539 -0
  28. package/dist/modules/integrations/index.cjs.map +1 -1
  29. package/dist/modules/integrations/index.js +539 -0
  30. package/dist/modules/integrations/index.js.map +1 -1
  31. package/dist/modules/organizations/index.cjs +211 -0
  32. package/dist/modules/organizations/index.cjs.map +1 -1
  33. package/dist/modules/organizations/index.js +211 -0
  34. package/dist/modules/organizations/index.js.map +1 -1
  35. package/dist/modules/products/index.cjs +131 -0
  36. package/dist/modules/products/index.cjs.map +1 -1
  37. package/dist/modules/products/index.js +131 -0
  38. package/dist/modules/products/index.js.map +1 -1
  39. package/dist/modules/rbac/index.cjs +114 -0
  40. package/dist/modules/rbac/index.cjs.map +1 -1
  41. package/dist/modules/rbac/index.js +114 -0
  42. package/dist/modules/rbac/index.js.map +1 -1
  43. package/dist/modules/sandbox/index.cjs +864 -0
  44. package/dist/modules/sandbox/index.cjs.map +1 -1
  45. package/dist/modules/sandbox/index.js +699 -1
  46. package/dist/modules/sandbox/index.js.map +1 -1
  47. package/dist/modules/scheduler/index.cjs +860 -0
  48. package/dist/modules/scheduler/index.cjs.map +1 -1
  49. package/dist/modules/scheduler/index.js +860 -0
  50. package/dist/modules/scheduler/index.js.map +1 -1
  51. package/dist/modules/security/index.cjs +51 -0
  52. package/dist/modules/security/index.cjs.map +1 -1
  53. package/dist/modules/security/index.js +51 -0
  54. package/dist/modules/security/index.js.map +1 -1
  55. package/dist/modules/store/index.cjs +102 -0
  56. package/dist/modules/store/index.cjs.map +1 -1
  57. package/dist/modules/store/index.js +102 -0
  58. package/dist/modules/store/index.js.map +1 -1
  59. package/dist/modules/tours/index.cjs +43 -0
  60. package/dist/modules/tours/index.cjs.map +1 -1
  61. package/dist/modules/tours/index.js +43 -0
  62. package/dist/modules/tours/index.js.map +1 -1
  63. package/dist/modules/vibecontrols/index.cjs +4618 -668
  64. package/dist/modules/vibecontrols/index.cjs.map +1 -1
  65. package/dist/modules/vibecontrols/index.js +3626 -434
  66. package/dist/modules/vibecontrols/index.js.map +1 -1
  67. package/dist/modules/workspaces/index.cjs +46 -3
  68. package/dist/modules/workspaces/index.cjs.map +1 -1
  69. package/dist/modules/workspaces/index.js +46 -3
  70. package/dist/modules/workspaces/index.js.map +1 -1
  71. package/package.json +4 -3
  72. package/dist/chunk-4GBVJ4OY.js +0 -847
  73. package/dist/chunk-4GBVJ4OY.js.map +0 -1
@@ -93,6 +93,172 @@ var EXTEND_SANDBOX_TTL = `
93
93
  extendSandboxTTL(id: $id, additionalSeconds: $additionalSeconds, context: $context) { ${SANDBOX_FIELDS} }
94
94
  }
95
95
  `;
96
+ var SANDBOX_TEMPLATE_FIELDS = `
97
+ id name description template isDefault ttlSeconds
98
+ containers { name image }
99
+ resources { cpuRequest cpuLimit memoryRequest memoryLimit }
100
+ storage { mode sizeGi mountPath retainOnDelete }
101
+ config metadata allowedImages
102
+ workspaceId createdBy createdAt updatedAt
103
+ `;
104
+ var LIST_SANDBOX_TEMPLATES = `
105
+ query ListSandboxTemplates($context: ContextInput!, $template: SandboxTemplate, $pagination: SandboxPaginationInput) {
106
+ listSandboxTemplates(context: $context, template: $template, pagination: $pagination) {
107
+ items { ${SANDBOX_TEMPLATE_FIELDS} } total hasMore
108
+ }
109
+ }
110
+ `;
111
+ var GET_SANDBOX_TEMPLATE = `
112
+ query GetSandboxTemplate($context: ContextInput!, $id: ID!) {
113
+ getSandboxTemplate(context: $context, id: $id) { ${SANDBOX_TEMPLATE_FIELDS} }
114
+ }
115
+ `;
116
+ var CREATE_SANDBOX_TEMPLATE = `
117
+ mutation CreateSandboxTemplate($input: CreateSandboxTemplateInput!) {
118
+ createSandboxTemplate(input: $input) { ${SANDBOX_TEMPLATE_FIELDS} }
119
+ }
120
+ `;
121
+ var UPDATE_SANDBOX_TEMPLATE = `
122
+ mutation UpdateSandboxTemplate($input: UpdateSandboxTemplateInput!) {
123
+ updateSandboxTemplate(input: $input) { ${SANDBOX_TEMPLATE_FIELDS} }
124
+ }
125
+ `;
126
+ var DELETE_SANDBOX_TEMPLATE = `
127
+ mutation DeleteSandboxTemplate($context: ContextInput!, $id: ID!) {
128
+ deleteSandboxTemplate(context: $context, id: $id)
129
+ }
130
+ `;
131
+ var AVAILABLE_SANDBOX_TAGS = `
132
+ query AvailableSandboxTags($query: String, $limit: Int) {
133
+ availableSandboxTags(query: $query, limit: $limit) { id key label color }
134
+ }
135
+ `;
136
+ var GET_SANDBOX_TAGS = `
137
+ query GetSandboxTags($input: GetSandboxTagsInput!) {
138
+ getSandboxTags(input: $input) {
139
+ id entityId entityType tagId source assignedAt assignedBy
140
+ }
141
+ }
142
+ `;
143
+ var CREATE_SANDBOX_TAG = `
144
+ mutation CreateSandboxTag($input: CreateSandboxTagInput!) {
145
+ createSandboxTag(input: $input) { id key label color }
146
+ }
147
+ `;
148
+ var TAG_SANDBOX = `
149
+ mutation TagSandbox($input: TagSandboxInput!) {
150
+ tagSandbox(input: $input) {
151
+ id entityId tagId source assignedAt
152
+ }
153
+ }
154
+ `;
155
+ var UNTAG_SANDBOX = `
156
+ mutation UntagSandbox($input: UntagSandboxInput!) {
157
+ untagSandbox(input: $input)
158
+ }
159
+ `;
160
+ var REPLACE_SANDBOX_TAGS = `
161
+ mutation ReplaceSandboxTags($input: ReplaceSandboxTagsInput!) {
162
+ replaceSandboxTags(input: $input) {
163
+ id entityId tagId source assignedAt
164
+ }
165
+ }
166
+ `;
167
+ var LIST_ALL_SANDBOXES = `
168
+ query ListAllSandboxes($context: ContextInput!, $filter: SandboxFilterInput, $pagination: SandboxPaginationInput) {
169
+ listAllSandboxes(context: $context, filter: $filter, pagination: $pagination) {
170
+ items { ${SANDBOX_FIELDS} } total hasMore
171
+ }
172
+ }
173
+ `;
174
+ var LIST_SANDBOX_NODES = `
175
+ query ListSandboxNodes($context: ContextInput!) {
176
+ listSandboxNodes(context: $context) {
177
+ name status allocatableCpu allocatableMemory sandboxPodCount labels
178
+ }
179
+ }
180
+ `;
181
+ var GET_ACTIVE_SANDBOXES = `
182
+ query GetActiveSandboxes($context: ContextInput!) {
183
+ getActiveSandboxes(context: $context) { ${SANDBOX_FIELDS} }
184
+ }
185
+ `;
186
+ var GET_RECENT_SANDBOX_ACTIVITY = `
187
+ query GetRecentSandboxActivity($context: ContextInput!, $limit: Int) {
188
+ getRecentSandboxActivity(context: $context, limit: $limit) {
189
+ items { id action actorId status sandboxName sandboxId createdAt }
190
+ total
191
+ }
192
+ }
193
+ `;
194
+ var GET_SANDBOX_STATS = `
195
+ query GetSandboxStats($context: ContextInput!) {
196
+ getSandboxStats(context: $context) {
197
+ activeSandboxes activeUserSandboxes activeInternalSandboxes
198
+ totalCreated totalDeleted totalUserCreated totalInternalCreated
199
+ runningNow provisioningNow stoppedNow expiredCount failedCount
200
+ totalCpuUsed totalMemoryUsed
201
+ }
202
+ }
203
+ `;
204
+ var GET_SANDBOX_LOGS = `
205
+ query GetSandboxLogs($context: ContextInput!, $id: ID!, $containerName: String!, $tailLines: Int) {
206
+ getSandboxLogs(context: $context, id: $id, containerName: $containerName, tailLines: $tailLines)
207
+ }
208
+ `;
209
+ var GET_SANDBOX_CONFIG = `
210
+ query GetSandboxConfig($context: ContextInput!) {
211
+ getSandboxConfig(context: $context) {
212
+ id defaultTtlSeconds maxTtlSeconds allowedTemplates
213
+ maxConcurrentPerUser maxConcurrentPerWorkspace
214
+ defaultCpuRequest defaultCpuLimit defaultMemoryRequest defaultMemoryLimit
215
+ workspaceId updatedAt
216
+ }
217
+ }
218
+ `;
219
+ var UPDATE_SANDBOX_CONFIG = `
220
+ mutation UpdateSandboxConfig($input: UpdateSandboxConfigInput!) {
221
+ updateSandboxConfig(input: $input) {
222
+ id defaultTtlSeconds maxTtlSeconds allowedTemplates
223
+ maxConcurrentPerUser maxConcurrentPerWorkspace
224
+ defaultCpuRequest defaultCpuLimit defaultMemoryRequest defaultMemoryLimit
225
+ workspaceId updatedAt
226
+ }
227
+ }
228
+ `;
229
+ var SANDBOX_EXPORT_JOB_FIELDS = `
230
+ id workspaceId format status requestedBy rowCount
231
+ downloadUrl errorMessage expiresAt createdAt updatedAt
232
+ `;
233
+ var EXPORT_SANDBOXES = `
234
+ mutation ExportSandboxes($input: ExportSandboxesInput!) {
235
+ exportSandboxes(input: $input) { ${SANDBOX_EXPORT_JOB_FIELDS} }
236
+ }
237
+ `;
238
+ var GET_SANDBOX_EXPORT_JOB = `
239
+ query GetSandboxExportJob($workspaceId: ID!, $jobId: ID!, $context: ContextInput!) {
240
+ getSandboxExportJob(workspaceId: $workspaceId, jobId: $jobId, context: $context) {
241
+ ${SANDBOX_EXPORT_JOB_FIELDS}
242
+ }
243
+ }
244
+ `;
245
+ var LIST_SANDBOX_EXPORT_JOBS = `
246
+ query ListSandboxExportJobs($workspaceId: ID!, $context: ContextInput!, $pagination: SandboxPaginationInput) {
247
+ listSandboxExportJobs(workspaceId: $workspaceId, context: $context, pagination: $pagination) {
248
+ ${SANDBOX_EXPORT_JOB_FIELDS}
249
+ }
250
+ }
251
+ `;
252
+ var GET_SANDBOX_ARTIFACT_BYTES = `
253
+ query GetSandboxArtifactBytes($input: SandboxArtifactBytesInput!) {
254
+ getSandboxArtifactBytes(input: $input) { filename mimeType size contentBase64 }
255
+ }
256
+ `;
257
+ var PROXY_SANDBOX_REQUEST = `
258
+ mutation ProxySandboxRequest($input: ProxySandboxRequestInput!) {
259
+ proxySandboxRequest(input: $input) { status body }
260
+ }
261
+ `;
96
262
 
97
263
  // src/modules/sandbox/tools.ts
98
264
  function registerSandboxTools(server, ctx, track) {
@@ -293,6 +459,704 @@ function registerSandboxTools(server, ctx, track) {
293
459
  }
294
460
  }
295
461
  );
462
+ server.registerTool(
463
+ track(mcpToolName(ctx.productName, "sandbox_templates_list")),
464
+ {
465
+ title: "List Sandbox Templates",
466
+ description: "List sandbox template configurations available in this workspace.",
467
+ inputSchema: {
468
+ template: zod.z.string().optional().describe("Filter by template kind"),
469
+ limit: zod.z.number().optional(),
470
+ offset: zod.z.number().optional()
471
+ }
472
+ },
473
+ async ({ template, limit, offset }) => {
474
+ try {
475
+ const pagination = {};
476
+ if (limit !== void 0) pagination.limit = limit;
477
+ if (offset !== void 0) pagination.offset = offset;
478
+ const data = await ctx.gql.workspace.request(
479
+ LIST_SANDBOX_TEMPLATES,
480
+ {
481
+ template,
482
+ pagination: Object.keys(pagination).length > 0 ? pagination : void 0
483
+ }
484
+ );
485
+ return jsonResult(data.listSandboxTemplates);
486
+ } catch (error) {
487
+ ctx.logger.error("sandbox_templates_list failed", { error });
488
+ return errorResult(
489
+ `Failed to list templates: ${error instanceof Error ? error.message : String(error)}`
490
+ );
491
+ }
492
+ }
493
+ );
494
+ server.registerTool(
495
+ track(mcpToolName(ctx.productName, "sandbox_templates_get")),
496
+ {
497
+ title: "Get Sandbox Template",
498
+ description: "Get a sandbox template by ID.",
499
+ inputSchema: { id: zod.z.string().describe("Template ID") }
500
+ },
501
+ async ({ id }) => {
502
+ try {
503
+ const data = await ctx.gql.workspace.request(
504
+ GET_SANDBOX_TEMPLATE,
505
+ { id }
506
+ );
507
+ return jsonResult(data.getSandboxTemplate);
508
+ } catch (error) {
509
+ ctx.logger.error("sandbox_templates_get failed", { error });
510
+ return errorResult(
511
+ `Failed to get template: ${error instanceof Error ? error.message : String(error)}`
512
+ );
513
+ }
514
+ }
515
+ );
516
+ server.registerTool(
517
+ track(mcpToolName(ctx.productName, "sandbox_templates_create")),
518
+ {
519
+ title: "Create Sandbox Template",
520
+ description: "Create a new sandbox template configuration.",
521
+ inputSchema: {
522
+ name: zod.z.string(),
523
+ template: zod.z.enum([
524
+ "VIBECONTROLS",
525
+ "AI_BUILDER",
526
+ "WORKFLOW_MULTI_NODE",
527
+ "MISC_SHELL",
528
+ "CUSTOM",
529
+ "DOCS_BUILDER"
530
+ ]),
531
+ description: zod.z.string().optional(),
532
+ isDefault: zod.z.boolean().optional(),
533
+ ttlSeconds: zod.z.number().optional()
534
+ }
535
+ },
536
+ async ({ name, template, description, isDefault, ttlSeconds }) => {
537
+ try {
538
+ const input = { name, template };
539
+ if (description !== void 0) input.description = description;
540
+ if (isDefault !== void 0) input.isDefault = isDefault;
541
+ if (ttlSeconds !== void 0) input.ttlSeconds = ttlSeconds;
542
+ const data = await ctx.gql.workspace.request(
543
+ CREATE_SANDBOX_TEMPLATE,
544
+ { input }
545
+ );
546
+ return jsonResult(data.createSandboxTemplate);
547
+ } catch (error) {
548
+ ctx.logger.error("sandbox_templates_create failed", { error });
549
+ return errorResult(
550
+ `Failed to create template: ${error instanceof Error ? error.message : String(error)}`
551
+ );
552
+ }
553
+ }
554
+ );
555
+ server.registerTool(
556
+ track(mcpToolName(ctx.productName, "sandbox_templates_update")),
557
+ {
558
+ title: "Update Sandbox Template",
559
+ description: "Update a sandbox template configuration.",
560
+ inputSchema: {
561
+ id: zod.z.string(),
562
+ name: zod.z.string().optional(),
563
+ description: zod.z.string().optional(),
564
+ isDefault: zod.z.boolean().optional(),
565
+ ttlSeconds: zod.z.number().optional()
566
+ }
567
+ },
568
+ async ({ id, name, description, isDefault, ttlSeconds }) => {
569
+ try {
570
+ const input = { id };
571
+ if (name !== void 0) input.name = name;
572
+ if (description !== void 0) input.description = description;
573
+ if (isDefault !== void 0) input.isDefault = isDefault;
574
+ if (ttlSeconds !== void 0) input.ttlSeconds = ttlSeconds;
575
+ const data = await ctx.gql.workspace.request(
576
+ UPDATE_SANDBOX_TEMPLATE,
577
+ { input }
578
+ );
579
+ return jsonResult(data.updateSandboxTemplate);
580
+ } catch (error) {
581
+ ctx.logger.error("sandbox_templates_update failed", { error });
582
+ return errorResult(
583
+ `Failed to update template: ${error instanceof Error ? error.message : String(error)}`
584
+ );
585
+ }
586
+ }
587
+ );
588
+ server.registerTool(
589
+ track(mcpToolName(ctx.productName, "sandbox_templates_delete")),
590
+ {
591
+ title: "Delete Sandbox Template",
592
+ description: "Delete a sandbox template configuration.",
593
+ inputSchema: { id: zod.z.string() }
594
+ },
595
+ async ({ id }) => {
596
+ try {
597
+ const data = await ctx.gql.workspace.request(
598
+ DELETE_SANDBOX_TEMPLATE,
599
+ { id }
600
+ );
601
+ return jsonResult({ deleted: data.deleteSandboxTemplate, templateId: id });
602
+ } catch (error) {
603
+ ctx.logger.error("sandbox_templates_delete failed", { error });
604
+ return errorResult(
605
+ `Failed to delete template: ${error instanceof Error ? error.message : String(error)}`
606
+ );
607
+ }
608
+ }
609
+ );
610
+ server.registerTool(
611
+ track(mcpToolName(ctx.productName, "sandbox_tags_list")),
612
+ {
613
+ title: "List Available Sandbox Tags",
614
+ description: "List available sandbox tags in the workspace.",
615
+ inputSchema: {
616
+ query: zod.z.string().optional(),
617
+ limit: zod.z.number().optional()
618
+ }
619
+ },
620
+ async ({ query, limit }) => {
621
+ try {
622
+ const data = await ctx.gql.workspace.request(
623
+ AVAILABLE_SANDBOX_TAGS,
624
+ { query, limit }
625
+ );
626
+ return jsonResult(data.availableSandboxTags);
627
+ } catch (error) {
628
+ ctx.logger.error("sandbox_tags_list failed", { error });
629
+ return errorResult(
630
+ `Failed to list tags: ${error instanceof Error ? error.message : String(error)}`
631
+ );
632
+ }
633
+ }
634
+ );
635
+ server.registerTool(
636
+ track(mcpToolName(ctx.productName, "sandbox_tags_get")),
637
+ {
638
+ title: "Get Sandbox Tags",
639
+ description: "Get tag assignments for a sandbox.",
640
+ inputSchema: { sandboxId: zod.z.string() }
641
+ },
642
+ async ({ sandboxId }) => {
643
+ try {
644
+ const data = await ctx.gql.workspace.request(
645
+ GET_SANDBOX_TAGS,
646
+ { input: { sandboxId } }
647
+ );
648
+ return jsonResult(data.getSandboxTags);
649
+ } catch (error) {
650
+ ctx.logger.error("sandbox_tags_get failed", { error });
651
+ return errorResult(
652
+ `Failed to get tags: ${error instanceof Error ? error.message : String(error)}`
653
+ );
654
+ }
655
+ }
656
+ );
657
+ server.registerTool(
658
+ track(mcpToolName(ctx.productName, "sandbox_tags_create")),
659
+ {
660
+ title: "Create Sandbox Tag",
661
+ description: "Create a new sandbox tag.",
662
+ inputSchema: {
663
+ label: zod.z.string(),
664
+ color: zod.z.string().optional()
665
+ }
666
+ },
667
+ async ({ label, color }) => {
668
+ try {
669
+ const input = { label };
670
+ if (color !== void 0) input.color = color;
671
+ const data = await ctx.gql.workspace.request(
672
+ CREATE_SANDBOX_TAG,
673
+ { input }
674
+ );
675
+ return jsonResult(data.createSandboxTag);
676
+ } catch (error) {
677
+ ctx.logger.error("sandbox_tags_create failed", { error });
678
+ return errorResult(
679
+ `Failed to create tag: ${error instanceof Error ? error.message : String(error)}`
680
+ );
681
+ }
682
+ }
683
+ );
684
+ server.registerTool(
685
+ track(mcpToolName(ctx.productName, "sandbox_tags_attach")),
686
+ {
687
+ title: "Attach Tag to Sandbox",
688
+ description: "Attach a tag to a sandbox.",
689
+ inputSchema: {
690
+ sandboxId: zod.z.string(),
691
+ tagId: zod.z.string(),
692
+ source: zod.z.string().optional()
693
+ }
694
+ },
695
+ async ({ sandboxId, tagId, source }) => {
696
+ try {
697
+ const input = { sandboxId, tagId };
698
+ if (source !== void 0) input.source = source;
699
+ const data = await ctx.gql.workspace.request(TAG_SANDBOX, {
700
+ input
701
+ });
702
+ return jsonResult(data.tagSandbox);
703
+ } catch (error) {
704
+ ctx.logger.error("sandbox_tags_attach failed", { error });
705
+ return errorResult(
706
+ `Failed to attach tag: ${error instanceof Error ? error.message : String(error)}`
707
+ );
708
+ }
709
+ }
710
+ );
711
+ server.registerTool(
712
+ track(mcpToolName(ctx.productName, "sandbox_tags_detach")),
713
+ {
714
+ title: "Detach Tag from Sandbox",
715
+ description: "Detach a tag from a sandbox.",
716
+ inputSchema: {
717
+ sandboxId: zod.z.string(),
718
+ tagId: zod.z.string()
719
+ }
720
+ },
721
+ async ({ sandboxId, tagId }) => {
722
+ try {
723
+ const data = await ctx.gql.workspace.request(UNTAG_SANDBOX, {
724
+ input: { sandboxId, tagId }
725
+ });
726
+ return jsonResult({ detached: data.untagSandbox, sandboxId, tagId });
727
+ } catch (error) {
728
+ ctx.logger.error("sandbox_tags_detach failed", { error });
729
+ return errorResult(
730
+ `Failed to detach tag: ${error instanceof Error ? error.message : String(error)}`
731
+ );
732
+ }
733
+ }
734
+ );
735
+ server.registerTool(
736
+ track(mcpToolName(ctx.productName, "sandbox_tags_replace")),
737
+ {
738
+ title: "Replace Sandbox Tags",
739
+ description: "Replace the full set of tags on a sandbox.",
740
+ inputSchema: {
741
+ sandboxId: zod.z.string(),
742
+ tagIds: zod.z.array(zod.z.string())
743
+ }
744
+ },
745
+ async ({ sandboxId, tagIds }) => {
746
+ try {
747
+ const data = await ctx.gql.workspace.request(
748
+ REPLACE_SANDBOX_TAGS,
749
+ { input: { sandboxId, tagIds } }
750
+ );
751
+ return jsonResult(data.replaceSandboxTags);
752
+ } catch (error) {
753
+ ctx.logger.error("sandbox_tags_replace failed", { error });
754
+ return errorResult(
755
+ `Failed to replace tags: ${error instanceof Error ? error.message : String(error)}`
756
+ );
757
+ }
758
+ }
759
+ );
760
+ server.registerTool(
761
+ track(mcpToolName(ctx.productName, "sandbox_admin_list_all")),
762
+ {
763
+ title: "List All Sandboxes (admin)",
764
+ description: "Admin-only list across the entire workspace including internal sandboxes.",
765
+ inputSchema: {
766
+ status: zod.z.string().optional(),
767
+ template: zod.z.string().optional(),
768
+ limit: zod.z.number().optional(),
769
+ offset: zod.z.number().optional()
770
+ }
771
+ },
772
+ async ({ status, template, limit, offset }) => {
773
+ try {
774
+ const filter = {};
775
+ if (status !== void 0) filter.status = status;
776
+ if (template !== void 0) filter.template = template;
777
+ const pagination = {};
778
+ if (limit !== void 0) pagination.limit = limit;
779
+ if (offset !== void 0) pagination.offset = offset;
780
+ const data = await ctx.gql.workspace.request(
781
+ LIST_ALL_SANDBOXES,
782
+ {
783
+ filter: Object.keys(filter).length > 0 ? filter : void 0,
784
+ pagination: Object.keys(pagination).length > 0 ? pagination : void 0
785
+ }
786
+ );
787
+ return jsonResult(data.listAllSandboxes);
788
+ } catch (error) {
789
+ ctx.logger.error("sandbox_admin_list_all failed", { error });
790
+ return errorResult(
791
+ `Failed to list all sandboxes: ${error instanceof Error ? error.message : String(error)}`
792
+ );
793
+ }
794
+ }
795
+ );
796
+ server.registerTool(
797
+ track(mcpToolName(ctx.productName, "sandbox_admin_nodes_list")),
798
+ {
799
+ title: "List Sandbox Nodes",
800
+ description: "List Kubernetes nodes hosting sandbox workloads with capacity info.",
801
+ inputSchema: {}
802
+ },
803
+ async () => {
804
+ try {
805
+ const data = await ctx.gql.workspace.request(
806
+ LIST_SANDBOX_NODES,
807
+ {}
808
+ );
809
+ return jsonResult(data.listSandboxNodes);
810
+ } catch (error) {
811
+ ctx.logger.error("sandbox_admin_nodes_list failed", { error });
812
+ return errorResult(
813
+ `Failed to list nodes: ${error instanceof Error ? error.message : String(error)}`
814
+ );
815
+ }
816
+ }
817
+ );
818
+ server.registerTool(
819
+ track(mcpToolName(ctx.productName, "sandbox_admin_active")),
820
+ {
821
+ title: "Get Active Sandboxes",
822
+ description: "Get currently active sandboxes in the workspace.",
823
+ inputSchema: {}
824
+ },
825
+ async () => {
826
+ try {
827
+ const data = await ctx.gql.workspace.request(
828
+ GET_ACTIVE_SANDBOXES,
829
+ {}
830
+ );
831
+ return jsonResult(data.getActiveSandboxes);
832
+ } catch (error) {
833
+ ctx.logger.error("sandbox_admin_active failed", { error });
834
+ return errorResult(
835
+ `Failed to get active sandboxes: ${error instanceof Error ? error.message : String(error)}`
836
+ );
837
+ }
838
+ }
839
+ );
840
+ server.registerTool(
841
+ track(mcpToolName(ctx.productName, "sandbox_admin_activity")),
842
+ {
843
+ title: "Recent Sandbox Activity",
844
+ description: "Get recent sandbox lifecycle activity (create/stop/delete/extend).",
845
+ inputSchema: { limit: zod.z.number().optional() }
846
+ },
847
+ async ({ limit }) => {
848
+ try {
849
+ const data = await ctx.gql.workspace.request(
850
+ GET_RECENT_SANDBOX_ACTIVITY,
851
+ { limit }
852
+ );
853
+ return jsonResult(data.getRecentSandboxActivity);
854
+ } catch (error) {
855
+ ctx.logger.error("sandbox_admin_activity failed", { error });
856
+ return errorResult(
857
+ `Failed to get activity: ${error instanceof Error ? error.message : String(error)}`
858
+ );
859
+ }
860
+ }
861
+ );
862
+ server.registerTool(
863
+ track(mcpToolName(ctx.productName, "sandbox_admin_stats")),
864
+ {
865
+ title: "Sandbox Stats",
866
+ description: "Get aggregate sandbox usage statistics for the workspace.",
867
+ inputSchema: {}
868
+ },
869
+ async () => {
870
+ try {
871
+ const data = await ctx.gql.workspace.request(
872
+ GET_SANDBOX_STATS,
873
+ {}
874
+ );
875
+ return jsonResult(data.getSandboxStats);
876
+ } catch (error) {
877
+ ctx.logger.error("sandbox_admin_stats failed", { error });
878
+ return errorResult(
879
+ `Failed to get stats: ${error instanceof Error ? error.message : String(error)}`
880
+ );
881
+ }
882
+ }
883
+ );
884
+ server.registerTool(
885
+ track(mcpToolName(ctx.productName, "sandbox_admin_logs")),
886
+ {
887
+ title: "Get Sandbox Logs",
888
+ description: "Fetch logs for a sandbox container.",
889
+ inputSchema: {
890
+ id: zod.z.string(),
891
+ containerName: zod.z.string(),
892
+ tailLines: zod.z.number().optional()
893
+ }
894
+ },
895
+ async ({ id, containerName, tailLines }) => {
896
+ try {
897
+ const data = await ctx.gql.workspace.request(GET_SANDBOX_LOGS, {
898
+ id,
899
+ containerName,
900
+ tailLines
901
+ });
902
+ return jsonResult({ logs: data.getSandboxLogs });
903
+ } catch (error) {
904
+ ctx.logger.error("sandbox_admin_logs failed", { error });
905
+ return errorResult(
906
+ `Failed to get logs: ${error instanceof Error ? error.message : String(error)}`
907
+ );
908
+ }
909
+ }
910
+ );
911
+ server.registerTool(
912
+ track(mcpToolName(ctx.productName, "sandbox_admin_config_get")),
913
+ {
914
+ title: "Get Sandbox Config",
915
+ description: "Get the per-workspace sandbox configuration limits.",
916
+ inputSchema: {}
917
+ },
918
+ async () => {
919
+ try {
920
+ const data = await ctx.gql.workspace.request(
921
+ GET_SANDBOX_CONFIG,
922
+ {}
923
+ );
924
+ return jsonResult(data.getSandboxConfig);
925
+ } catch (error) {
926
+ ctx.logger.error("sandbox_admin_config_get failed", { error });
927
+ return errorResult(
928
+ `Failed to get config: ${error instanceof Error ? error.message : String(error)}`
929
+ );
930
+ }
931
+ }
932
+ );
933
+ server.registerTool(
934
+ track(mcpToolName(ctx.productName, "sandbox_admin_config_set")),
935
+ {
936
+ title: "Update Sandbox Config",
937
+ description: "Update the per-workspace sandbox configuration limits.",
938
+ inputSchema: {
939
+ defaultTtlSeconds: zod.z.number().optional(),
940
+ maxTtlSeconds: zod.z.number().optional(),
941
+ maxConcurrentPerUser: zod.z.number().optional(),
942
+ maxConcurrentPerWorkspace: zod.z.number().optional()
943
+ }
944
+ },
945
+ async ({
946
+ defaultTtlSeconds,
947
+ maxTtlSeconds,
948
+ maxConcurrentPerUser,
949
+ maxConcurrentPerWorkspace
950
+ }) => {
951
+ try {
952
+ const input = {};
953
+ if (defaultTtlSeconds !== void 0) input.defaultTtlSeconds = defaultTtlSeconds;
954
+ if (maxTtlSeconds !== void 0) input.maxTtlSeconds = maxTtlSeconds;
955
+ if (maxConcurrentPerUser !== void 0) input.maxConcurrentPerUser = maxConcurrentPerUser;
956
+ if (maxConcurrentPerWorkspace !== void 0)
957
+ input.maxConcurrentPerWorkspace = maxConcurrentPerWorkspace;
958
+ const data = await ctx.gql.workspace.request(
959
+ UPDATE_SANDBOX_CONFIG,
960
+ { input }
961
+ );
962
+ return jsonResult(data.updateSandboxConfig);
963
+ } catch (error) {
964
+ ctx.logger.error("sandbox_admin_config_set failed", { error });
965
+ return errorResult(
966
+ `Failed to update config: ${error instanceof Error ? error.message : String(error)}`
967
+ );
968
+ }
969
+ }
970
+ );
971
+ server.registerTool(
972
+ track(mcpToolName(ctx.productName, "sandbox_export_create")),
973
+ {
974
+ title: "Create Sandbox Export Job",
975
+ description: "Kick off an async job to export sandboxes for the workspace.",
976
+ inputSchema: {
977
+ workspaceId: zod.z.string(),
978
+ format: zod.z.enum(["CSV", "JSON"]),
979
+ includeUsageEvents: zod.z.boolean().optional()
980
+ }
981
+ },
982
+ async ({ workspaceId, format, includeUsageEvents }) => {
983
+ try {
984
+ const input = { workspaceId, format };
985
+ if (includeUsageEvents !== void 0) input.includeUsageEvents = includeUsageEvents;
986
+ const data = await ctx.gql.workspace.request(
987
+ EXPORT_SANDBOXES,
988
+ { input }
989
+ );
990
+ return jsonResult(data.exportSandboxes);
991
+ } catch (error) {
992
+ ctx.logger.error("sandbox_export_create failed", { error });
993
+ return errorResult(
994
+ `Failed to create export: ${error instanceof Error ? error.message : String(error)}`
995
+ );
996
+ }
997
+ }
998
+ );
999
+ server.registerTool(
1000
+ track(mcpToolName(ctx.productName, "sandbox_export_get")),
1001
+ {
1002
+ title: "Get Sandbox Export Job",
1003
+ description: "Get a sandbox export job by ID. Poll this to track progress (MCP has no subscriptions).",
1004
+ inputSchema: {
1005
+ workspaceId: zod.z.string(),
1006
+ jobId: zod.z.string()
1007
+ }
1008
+ },
1009
+ async ({ workspaceId, jobId }) => {
1010
+ try {
1011
+ const data = await ctx.gql.workspace.request(
1012
+ GET_SANDBOX_EXPORT_JOB,
1013
+ { workspaceId, jobId }
1014
+ );
1015
+ return jsonResult(data.getSandboxExportJob);
1016
+ } catch (error) {
1017
+ ctx.logger.error("sandbox_export_get failed", { error });
1018
+ return errorResult(
1019
+ `Failed to get export job: ${error instanceof Error ? error.message : String(error)}`
1020
+ );
1021
+ }
1022
+ }
1023
+ );
1024
+ server.registerTool(
1025
+ track(mcpToolName(ctx.productName, "sandbox_export_list")),
1026
+ {
1027
+ title: "List Sandbox Export Jobs",
1028
+ description: "List sandbox export jobs for a workspace.",
1029
+ inputSchema: {
1030
+ workspaceId: zod.z.string(),
1031
+ limit: zod.z.number().optional(),
1032
+ offset: zod.z.number().optional()
1033
+ }
1034
+ },
1035
+ async ({ workspaceId, limit, offset }) => {
1036
+ try {
1037
+ const pagination = {};
1038
+ if (limit !== void 0) pagination.limit = limit;
1039
+ if (offset !== void 0) pagination.offset = offset;
1040
+ const data = await ctx.gql.workspace.request(
1041
+ LIST_SANDBOX_EXPORT_JOBS,
1042
+ {
1043
+ workspaceId,
1044
+ pagination: Object.keys(pagination).length > 0 ? pagination : void 0
1045
+ }
1046
+ );
1047
+ return jsonResult(data.listSandboxExportJobs);
1048
+ } catch (error) {
1049
+ ctx.logger.error("sandbox_export_list failed", { error });
1050
+ return errorResult(
1051
+ `Failed to list export jobs: ${error instanceof Error ? error.message : String(error)}`
1052
+ );
1053
+ }
1054
+ }
1055
+ );
1056
+ server.registerTool(
1057
+ track(mcpToolName(ctx.productName, "sandbox_export_get_artifact_bytes")),
1058
+ {
1059
+ title: "Get Sandbox Artifact Bytes",
1060
+ description: "Fetch raw artifact bytes for a sandbox session (base64-encoded, 50 MB cap).",
1061
+ inputSchema: {
1062
+ sandboxId: zod.z.string(),
1063
+ sessionId: zod.z.string(),
1064
+ path: zod.z.string(),
1065
+ onBehalfOfUserId: zod.z.string().optional()
1066
+ }
1067
+ },
1068
+ async ({ sandboxId, sessionId, path, onBehalfOfUserId }) => {
1069
+ try {
1070
+ const input = { sandboxId, sessionId, path };
1071
+ if (onBehalfOfUserId !== void 0) input.onBehalfOfUserId = onBehalfOfUserId;
1072
+ const data = await ctx.gql.workspace.request(
1073
+ GET_SANDBOX_ARTIFACT_BYTES,
1074
+ { input }
1075
+ );
1076
+ return jsonResult(data.getSandboxArtifactBytes);
1077
+ } catch (error) {
1078
+ ctx.logger.error("sandbox_export_get_artifact_bytes failed", { error });
1079
+ return errorResult(
1080
+ `Failed to get artifact bytes: ${error instanceof Error ? error.message : String(error)}`
1081
+ );
1082
+ }
1083
+ }
1084
+ );
1085
+ server.registerTool(
1086
+ track(mcpToolName(ctx.productName, "sandbox_proxy_request")),
1087
+ {
1088
+ title: "Proxy HTTP Request to Sandbox",
1089
+ description: "Proxy an HTTP request to a service running inside a sandbox container.",
1090
+ inputSchema: {
1091
+ sandboxId: zod.z.string(),
1092
+ method: zod.z.string(),
1093
+ path: zod.z.string(),
1094
+ body: zod.z.unknown().optional(),
1095
+ containerName: zod.z.string().optional()
1096
+ }
1097
+ },
1098
+ async ({ sandboxId, method, path, body, containerName }) => {
1099
+ try {
1100
+ const input = { sandboxId, method, path };
1101
+ if (body !== void 0) input.body = body;
1102
+ if (containerName !== void 0) input.containerName = containerName;
1103
+ const data = await ctx.gql.workspace.request(
1104
+ PROXY_SANDBOX_REQUEST,
1105
+ { input }
1106
+ );
1107
+ return jsonResult(data.proxySandboxRequest);
1108
+ } catch (error) {
1109
+ ctx.logger.error("sandbox_proxy_request failed", { error });
1110
+ return errorResult(
1111
+ `Failed to proxy request: ${error instanceof Error ? error.message : String(error)}`
1112
+ );
1113
+ }
1114
+ }
1115
+ );
1116
+ server.registerTool(
1117
+ track(mcpToolName(ctx.productName, "sandbox_check")),
1118
+ {
1119
+ title: "Check Sandbox State",
1120
+ description: "Poll a sandbox by ID. MCP has no subscription protocol \u2014 call this in a loop to track lifecycle.",
1121
+ inputSchema: { id: zod.z.string() }
1122
+ },
1123
+ async ({ id }) => {
1124
+ try {
1125
+ const data = await ctx.gql.workspace.request(GET_SANDBOX, { id });
1126
+ return jsonResult(data.getSandbox);
1127
+ } catch (error) {
1128
+ ctx.logger.error("sandbox_check failed", { error });
1129
+ return errorResult(
1130
+ `Failed to poll sandbox: ${error instanceof Error ? error.message : String(error)}`
1131
+ );
1132
+ }
1133
+ }
1134
+ );
1135
+ server.registerTool(
1136
+ track(mcpToolName(ctx.productName, "sandbox_export_check")),
1137
+ {
1138
+ title: "Check Sandbox Export Job",
1139
+ description: "Poll an export job by ID. MCP has no subscription protocol \u2014 call this in a loop to track progress.",
1140
+ inputSchema: {
1141
+ workspaceId: zod.z.string(),
1142
+ jobId: zod.z.string()
1143
+ }
1144
+ },
1145
+ async ({ workspaceId, jobId }) => {
1146
+ try {
1147
+ const data = await ctx.gql.workspace.request(
1148
+ GET_SANDBOX_EXPORT_JOB,
1149
+ { workspaceId, jobId }
1150
+ );
1151
+ return jsonResult(data.getSandboxExportJob);
1152
+ } catch (error) {
1153
+ ctx.logger.error("sandbox_export_check failed", { error });
1154
+ return errorResult(
1155
+ `Failed to poll export job: ${error instanceof Error ? error.message : String(error)}`
1156
+ );
1157
+ }
1158
+ }
1159
+ );
296
1160
  }
297
1161
 
298
1162
  // src/modules/sandbox/index.ts