@yukkit/e2b-mcp-server 0.2.2 → 0.3.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 +11 -2
- package/build/index.js +36 -0
- 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
|
+
- **9 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
|
|
@@ -168,7 +168,16 @@ Get a public URL for accessing a service running in a sandbox.
|
|
|
168
168
|
- `port`: Port number (1-65535)
|
|
169
169
|
- `sandboxId`: Target sandbox ID
|
|
170
170
|
|
|
171
|
-
### 8.
|
|
171
|
+
### 8. get_file_download_url
|
|
172
|
+
|
|
173
|
+
Get a download URL for a file in the sandbox.
|
|
174
|
+
|
|
175
|
+
**Parameters:**
|
|
176
|
+
|
|
177
|
+
- `filePath`: Path to the file
|
|
178
|
+
- `sandboxId`: Target sandbox ID
|
|
179
|
+
|
|
180
|
+
### 9. kill_sandbox
|
|
172
181
|
|
|
173
182
|
Terminate a sandbox and clean up resources.
|
|
174
183
|
|
package/build/index.js
CHANGED
|
@@ -64,6 +64,10 @@ const getSandboxUrlSchema = z.object({
|
|
|
64
64
|
port: z.number().min(1).max(65535).describe("Port number"),
|
|
65
65
|
sandboxId: z.string().describe("Sandbox ID"),
|
|
66
66
|
});
|
|
67
|
+
const getFileDownloadUrlSchema = z.object({
|
|
68
|
+
filePath: z.string().min(1).describe("Path to the file"),
|
|
69
|
+
sandboxId: z.string().describe("Sandbox ID"),
|
|
70
|
+
});
|
|
67
71
|
const killSandboxSchema = z.object({
|
|
68
72
|
sandboxId: z.string().describe("Sandbox ID"),
|
|
69
73
|
});
|
|
@@ -263,6 +267,11 @@ class E2BServer {
|
|
|
263
267
|
description: "Get the URL for a sandbox on a specific port",
|
|
264
268
|
inputSchema: zodToJsonSchema(getSandboxUrlSchema),
|
|
265
269
|
},
|
|
270
|
+
{
|
|
271
|
+
name: "get_file_download_url",
|
|
272
|
+
description: "Get a download URL for a file in the sandbox",
|
|
273
|
+
inputSchema: zodToJsonSchema(getFileDownloadUrlSchema),
|
|
274
|
+
},
|
|
266
275
|
{
|
|
267
276
|
name: "kill_sandbox",
|
|
268
277
|
description: "Kill a sandbox",
|
|
@@ -284,6 +293,8 @@ class E2BServer {
|
|
|
284
293
|
return await this.handleWriteFile(request.params.arguments);
|
|
285
294
|
case "list_files":
|
|
286
295
|
return await this.handleListFiles(request.params.arguments);
|
|
296
|
+
case "get_file_download_url":
|
|
297
|
+
return await this.handleGetFileDownloadUrl(request.params.arguments);
|
|
287
298
|
case "run_code":
|
|
288
299
|
return await this.handleRunCode(request.params.arguments);
|
|
289
300
|
case "get_sandbox_url":
|
|
@@ -519,6 +530,31 @@ class E2BServer {
|
|
|
519
530
|
throw new SandboxError(`Failed to get sandbox URL: ${error}`);
|
|
520
531
|
}
|
|
521
532
|
}
|
|
533
|
+
async handleGetFileDownloadUrl(args) {
|
|
534
|
+
const parsed = getFileDownloadUrlSchema.parse(args);
|
|
535
|
+
const sandbox = this.sandboxManager.getSandbox(parsed.sandboxId);
|
|
536
|
+
try {
|
|
537
|
+
const url = sandbox.downloadUrl(parsed.filePath);
|
|
538
|
+
const result = {
|
|
539
|
+
sandboxId: parsed.sandboxId,
|
|
540
|
+
filePath: parsed.filePath,
|
|
541
|
+
url,
|
|
542
|
+
};
|
|
543
|
+
logger.info(`Got download URL for file ${parsed.filePath} in sandbox ${parsed.sandboxId}`);
|
|
544
|
+
return {
|
|
545
|
+
content: [
|
|
546
|
+
{
|
|
547
|
+
type: "text",
|
|
548
|
+
text: JSON.stringify(result, null, 2),
|
|
549
|
+
},
|
|
550
|
+
],
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
catch (error) {
|
|
554
|
+
logger.error(`Error getting file download URL: ${error}`);
|
|
555
|
+
throw new SandboxError(`Failed to get file download URL: ${error}`);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
522
558
|
async handleKillSandbox(args) {
|
|
523
559
|
const parsed = killSandboxSchema.parse(args);
|
|
524
560
|
await this.sandboxManager.killSandbox(parsed.sandboxId);
|