Skip to main content

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:
You’ll also need an E2B API key. You can sign up at e2b.dev to get your API key.

Configuration Example

To enable sandboxed execution, use the sandbox parameter when creating the MCPClient:

Available Sandbox Options

The SandboxOptions type provides the following configuration options:

E2B API Key

To use sandboxed execution, you need an E2B API key. You can provide it in two ways:
  1. Directly in the sandbox options:
  2. Through the environment variable:
For more details on connection types and sandbox configuration, see the Connection Types guide.