Sandboxed Execution
mcp_use supports running MCP servers in a sandboxed cloud environment using E2B. This is useful when you want to run MCP servers without having to install their dependencies locally.Installation
To use sandboxed execution, you need to install the E2B dependency:Configuration Example
To enable sandboxed execution, use the sandbox parameter when creating the MCPClient:Available Sandbox Options
TheSandboxOptions
type provides the following configuration options:
Option | Description | Default |
---|---|---|
api_key | E2B API key. Required - can be provided directly or via E2B_API_KEY environment variable | None |
sandbox_template_id | Template ID for the sandbox environment | ”base” |
supergateway_command | Command to run supergateway | ”npx -y supergateway” |
E2B API Key
To use sandboxed execution, you need an E2B API key. You can provide it in two ways:-
Directly in the sandbox options:
-
Through the environment variable: