code-sandbox-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@code-sandbox-mcp run Python code to calculate the factorial of 5"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Code Sandbox MCP
MCP (Model Context Protocol) server for E2B code sandbox. This server provides tools to create, manage, and execute code in secure E2B sandboxes.
Features
Create Sandbox: Create new E2B sandboxes with customizable timeout and template
Kill Sandbox: Terminate existing sandboxes by ID
Run Code: Execute Python code in sandboxes using Jupyter Notebook syntax
Run Command: Execute shell commands in sandboxes
Related MCP server: e2b-sandbox-mcp
Installation
pip install code-sandbox-mcpOr using uv:
uv pip install code-sandbox-mcpUsage
Configuration
Add the following configuration to your MCP client settings JSON file (e.g., ~/.config/claude_desktop/claude_desktop_config.json for Claude Desktop, or .cursor/mcp.json for Cursor):
{
"mcpServers": {
"code-sandbox-mcp": {
"command": "uv",
"args": ["run", "code-sandbox-mcp"],
"env": {
"E2B_API_KEY": "your_api_key_here",
"E2B_DOMAIN": "your_domain_here"
}
}
}
}Replace your_api_key_here and your_domain_here with your actual E2B credentials.
Restart your MCP client to load the configuration. The tools will be available in your MCP-enabled application!
License
MIT
Available Tools
4 toolscreate_sandboxA
Create a new E2B sandbox and return its ID.
Args:
timeout: Timeout for the sandbox in seconds, default is 300 seconds
template: Optional template name or ID to use for creating the sandbox. If not provided, the default template is used.
Returns:
JSON string containing the sandbox ID
Inputs: timeout, template. Returns: result
kill_sandboxA
Kill an E2B sandbox by its ID.
Args:
sandbox_id: The ID of the sandbox to kill
Returns:
JSON string containing error message if failed, empty string if successful
Inputs: sandbox_id (required). Returns: result
run_codeA
Run python code in a secure sandbox by E2B. Using the Jupyter Notebook syntax.
Args:
code: Python code to execute
sandbox_id: Optional sandbox ID to connect to an existing sandbox. If not provided, a new sandbox will be created.
Returns:
JSON string containing stdout and stderr from code execution
Inputs: code (required), sandbox_id. Returns: result
run_commandA
Run a shell command in an E2B sandbox.
Args:
command: Shell command to execute
sandbox_id: Optional sandbox ID to connect to an existing sandbox. If not provided, a new sandbox will be created.
Returns:
JSON string containing stdout, stderr, and exit code from command execution
Inputs: command (required), sandbox_id. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clear primary purpose, but run_command and run_code can implicitly create sandboxes, which overlaps with create_sandbox's role. Descriptions are clear enough to avoid confusion, but the optional sandbox_id in both creates some ambiguity about which tool to use for sandbox creation.
All tool names follow a consistent snake_case verb_noun pattern: create_sandbox, kill_sandbox, run_command, run_code. This makes the API predictable and easy to navigate.
Four tools is slightly on the small side but well-matched to the server's narrow scope of sandbox lifecycle management and code execution. It falls within the typical well-scoped range, though one or two additional tools (e.g., list_sandboxes) would be reasonable.
The tool set has a significant lifecycle gap: run_command and run_code can create sandboxes implicitly but do not return the sandbox ID, making those sandboxes impossible to kill or reuse. There is also no way to list active sandboxes or check their status, limiting operational visibility and control.
Maintenance
Related MCP Connectors
MCP server for Superserve sandboxes: create, exec, and manage Firecracker microVMs
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
MCP server for building and testing AI agents with multi-model experimentation and insights.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server to create secure code sandbox environment for executing code within Docker containers.327MIT
- AlicenseAqualityDmaintenanceMCP server connecting Claude Code with E2B cloud sandboxes for working on any GitHub repo.2914 npm4MIT
- AlicenseNot gradedqualityDmaintenanceProduction-grade MCP server that enables AI assistants to execute code securely in isolated E2B sandboxes.Apache 2.0
- AlicenseAqualityDmaintenanceA Model Context Protocol server that enables AI assistants to create, control, and interact with virtual desktop environments through E2B's secure cloud sandboxes.614 npm4MIT