from mcp_use import MCPClient
from mcp_use.types.sandbox import SandboxOptions
# Define sandbox options
sandbox_options: SandboxOptions = {
"api_key": "your_e2b_api_key", # Or use E2B_API_KEY environment variable
"sandbox_template_id": "code-interpreter-v1",
"supergateway_command": "npx -y supergateway" # Optional, this is the default
}
# Create client with sandboxed execution enabled
client = MCPClient.from_dict(
{
"mcpServers": {
"command_line": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-everything"]
}
}
},
sandbox=True,
sandbox_options=sandbox_options
)