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.
39 lines • 1.41 kB
TypeScript
import type { MCPClient, VMExecutorOptions } from "../../client.js";
import { BaseCodeExecutor, type ExecutionResult } from "./base.js";
/**
* Check if VM executor is available in the current environment
* This is a synchronous check that returns true if vm was already loaded
*/
export declare function isVMAvailable(): boolean;
/**
* VM-based code executor using Node.js vm module.
* Executes code in an isolated V8 context with access to MCP tools.
*/
export declare class VMCodeExecutor extends BaseCodeExecutor {
private defaultTimeout;
private memoryLimitMb?;
constructor(client: MCPClient, options?: VMExecutorOptions);
/**
* Ensure VM module is loaded before execution
*/
private ensureVMLoaded;
/**
* Execute JavaScript/TypeScript code with access to MCP tools.
*
* @param code - Code to execute
* @param timeout - Execution timeout in milliseconds (default: configured timeout or 30000)
*/
execute(code: string, timeout?: number): Promise<ExecutionResult>;
/**
* Build the VM execution context with MCP tools and standard globals.
*
* @param logs - Array to capture console output
*/
private _buildContext;
/**
* Clean up resources.
* VM executor doesn't need cleanup, but method kept for interface consistency.
*/
cleanup(): Promise<void>;
}
//# sourceMappingURL=vm.d.ts.map