Secure code execution sandbox
## E2B MCP Server: Secure Code Execution Sandbox Environment The **E2B MCP Server** provides secure, isolated sandbox environments for code execution within Google Antigravity, enabling safe testing, prototyping, and AI-generated code validation without risking your local or production systems. ### Why E2B MCP? - **Isolated Execution**: Run untrusted or experimental code in fully isolated cloud sandboxes with no risk to your system - **Multiple Runtimes**: Support for Python, JavaScript, TypeScript, Bash, and custom environments out of the box - **Persistent Filesystems**: Maintain state across executions with persistent sandbox filesystems for complex workflows - **Real-Time Streaming**: Stream stdout, stderr, and execution results in real-time for interactive development - **Resource Control**: Set CPU, memory, and timeout limits to prevent runaway processes and control costs ### Key Features #### 1. Sandbox Execution ```python from anthropic import Anthropic client = Anthropic() response = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, messages=[{ "role": "user", "content": "Execute this Python data analysis script in an E2B sandbox and return the results" }] ) ``` #### 2. Environment Management ```python # Configure sandbox environment response = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, messages=[{ "role": "user", "content": "Create an E2B sandbox with pandas, numpy, and matplotlib installed for data visualization" }] ) ``` #### 3. File Operations ```python # Work with sandbox files response = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, messages=[{ "role": "user", "content": "Upload the CSV file to sandbox, process it with the script, and download the generated charts" }] ) ``` #### 4. Interactive Sessions ```python # Maintain persistent sessions response = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, messages=[{ "role": "user", "content": "Start an interactive Python session in sandbox, define variables, and run multiple commands" }] ) ``` ### Configuration ```json { "mcpServers": { "e2b": { "command": "npx", "args": ["-y", "@anthropic/mcp-server-e2b"], "env": { "E2B_API_KEY": "your-e2b-api-key", "E2B_TEMPLATE": "python-3.11" } } } } ``` ### Use Cases **AI Code Validation**: Safely execute AI-generated code before integrating into your codebase, catching errors and security issues early. **Learning and Prototyping**: Experiment with new libraries and techniques without cluttering your local development environment. **Automated Testing**: Run integration tests that require isolated environments with specific dependencies and configurations. **Data Processing**: Execute data transformation scripts on sensitive data without exposing it to your local machine. The E2B MCP Server enables fearless experimentation and execution, providing the safety net needed to confidently run untrusted code and prototype new ideas.
{
"mcpServers": {
"e2b": {
"mcpServers": {
"e2b": {
"env": {
"E2B_API_KEY": "your-e2b-api-key"
},
"args": [
"-y",
"@e2b/mcp-server"
],
"command": "npx"
}
}
}
}
}