@yukkit/e2b-mcp-server 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -2
- package/build/index.js +26 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ This server implements the [Model Context Protocol (MCP)](https://modelcontextpr
|
|
|
22
22
|
|
|
23
23
|
## Features
|
|
24
24
|
|
|
25
|
-
- **
|
|
25
|
+
- **10 Production-Ready Tools**: Complete toolkit for sandbox interaction
|
|
26
26
|
- **Resource Management**: Automatic sandbox lifecycle management with configurable limits (default: 10 concurrent sandboxes)
|
|
27
27
|
- **Robust Error Handling**: Custom error classes for clear diagnostics (SandboxError, SandboxNotFoundError, SandboxLimitExceededError)
|
|
28
28
|
- **Production Logging**: Multi-level logging system (DEBUG, INFO, WARNING, ERROR) with timestamps
|
|
@@ -177,7 +177,21 @@ Get a download URL for a file in the sandbox.
|
|
|
177
177
|
- `filePath`: Path to the file
|
|
178
178
|
- `sandboxId`: Target sandbox ID
|
|
179
179
|
|
|
180
|
-
### 9.
|
|
180
|
+
### 9. list_sandbox_ids
|
|
181
|
+
|
|
182
|
+
List all active sandbox IDs and get sandbox statistics.
|
|
183
|
+
|
|
184
|
+
**Parameters:**
|
|
185
|
+
|
|
186
|
+
None
|
|
187
|
+
|
|
188
|
+
**Returns:**
|
|
189
|
+
|
|
190
|
+
- `sandbox_ids`: Array of active sandbox IDs
|
|
191
|
+
- `active_sandboxes`: Current number of active sandboxes
|
|
192
|
+
- `max_sandboxes`: Maximum allowed sandboxes
|
|
193
|
+
|
|
194
|
+
### 10. kill_sandbox
|
|
181
195
|
|
|
182
196
|
Terminate a sandbox and clean up resources.
|
|
183
197
|
|
package/build/index.js
CHANGED
|
@@ -71,6 +71,7 @@ const getFileDownloadUrlSchema = z.object({
|
|
|
71
71
|
const killSandboxSchema = z.object({
|
|
72
72
|
sandboxId: z.string().describe("Sandbox ID"),
|
|
73
73
|
});
|
|
74
|
+
const listSandboxIdsSchema = z.object({});
|
|
74
75
|
// Custom Errors
|
|
75
76
|
class SandboxError extends Error {
|
|
76
77
|
constructor(message) {
|
|
@@ -277,6 +278,11 @@ class E2BServer {
|
|
|
277
278
|
description: "Kill a sandbox",
|
|
278
279
|
inputSchema: zodToJsonSchema(killSandboxSchema),
|
|
279
280
|
},
|
|
281
|
+
{
|
|
282
|
+
name: "list_sandbox_ids",
|
|
283
|
+
description: "List all active sandbox IDs and statistics",
|
|
284
|
+
inputSchema: zodToJsonSchema(listSandboxIdsSchema),
|
|
285
|
+
},
|
|
280
286
|
],
|
|
281
287
|
}));
|
|
282
288
|
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
@@ -301,6 +307,8 @@ class E2BServer {
|
|
|
301
307
|
return await this.handleGetSandboxUrl(request.params.arguments);
|
|
302
308
|
case "kill_sandbox":
|
|
303
309
|
return await this.handleKillSandbox(request.params.arguments);
|
|
310
|
+
case "list_sandbox_ids":
|
|
311
|
+
return await this.handleListSandboxIds(request.params.arguments);
|
|
304
312
|
default:
|
|
305
313
|
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}`);
|
|
306
314
|
}
|
|
@@ -329,7 +337,6 @@ class E2BServer {
|
|
|
329
337
|
const result = {
|
|
330
338
|
sandboxId,
|
|
331
339
|
message: `Sandbox created successfully with timeout ${timeout}ms`,
|
|
332
|
-
stats: this.sandboxManager.getStats(),
|
|
333
340
|
};
|
|
334
341
|
return {
|
|
335
342
|
content: [
|
|
@@ -572,6 +579,24 @@ class E2BServer {
|
|
|
572
579
|
],
|
|
573
580
|
};
|
|
574
581
|
}
|
|
582
|
+
async handleListSandboxIds(args) {
|
|
583
|
+
listSandboxIdsSchema.parse(args);
|
|
584
|
+
const stats = this.sandboxManager.getStats();
|
|
585
|
+
const result = {
|
|
586
|
+
sandbox_ids: stats.sandbox_ids,
|
|
587
|
+
active_sandboxes: stats.active_sandboxes,
|
|
588
|
+
max_sandboxes: stats.max_sandboxes,
|
|
589
|
+
};
|
|
590
|
+
logger.info(`Listed ${stats.active_sandboxes} active sandboxes`);
|
|
591
|
+
return {
|
|
592
|
+
content: [
|
|
593
|
+
{
|
|
594
|
+
type: "text",
|
|
595
|
+
text: JSON.stringify(result, null, 2),
|
|
596
|
+
},
|
|
597
|
+
],
|
|
598
|
+
};
|
|
599
|
+
}
|
|
575
600
|
async run() {
|
|
576
601
|
const transport = new StdioServerTransport();
|
|
577
602
|
await this.server.connect(transport);
|