UNPKG

mcp-use

Version:

Opinionated MCP Framework for TypeScript (@modelcontextprotocol/sdk compatible) - Build MCP Agents, Clients and Servers with support for ChatGPT Apps, Code Mode, OAuth, Notifications, Sampling, Observability and more.

46 lines 1.66 kB
import type { E2BExecutorOptions, MCPClient } from "../../client.js"; import { BaseCodeExecutor, type ExecutionResult } from "./base.js"; /** * E2B-based code executor using remote sandboxes. * Executes code in an E2B sandbox with tool calls proxied back to the host. */ export declare class E2BCodeExecutor extends BaseCodeExecutor { private e2bApiKey; private codeExecSandbox; private SandboxClass; private timeoutMs; constructor(client: MCPClient, options: E2BExecutorOptions); /** * Lazy load E2B Sandbox class. * This allows the library to work without E2B installed. */ private ensureSandboxClass; /** * Get or create a dedicated sandbox for code execution. */ private getOrCreateCodeExecSandbox; /** * Generate the shim code that exposes tools to the sandbox environment. * Creates a bridge that intercepts tool calls and sends them back to host. */ private generateShim; /** * Build the tool catalog for the shim. * Returns a map of server names to their available tools. */ private buildToolCatalog; /** * Execute JavaScript/TypeScript code in an E2B sandbox with MCP tool access. * Tool calls are proxied back to the host via the bridge pattern. * * @param code - Code to execute * @param timeout - Execution timeout in milliseconds (default: 30000) */ execute(code: string, timeout?: number): Promise<ExecutionResult>; /** * Clean up the E2B sandbox. * Should be called when the executor is no longer needed. */ cleanup(): Promise<void>; } //# sourceMappingURL=e2b.d.ts.map