MCP Code Sandbox MCP Server

An extensible Message Communication Protocol (MCP) server that provides secure code execution capabilities in isolated sandbox environments. This

Local serverstdioPython

What is the MCP Code Sandbox MCP server?

An extensible Message Communication Protocol (MCP) server that provides secure code execution capabilities in isolated sandbox environments. This server follows the MCP standard, making it compatible with Claude for Desktop and other MCP. Exposed over MCP by the mcp code sandbox mcp server, that capability becomes something an assistant can invoke while it works, not something you go and do afterwards.

What it actually does

  • Create isolated sandbox environments for code execution
  • Execute Python code securely
  • Perform file operations (listing, reading, writing)
  • Install Python packages in the sandbox
  • Extensible architecture with abstracted code interpreter interface
  • Modular design with clean separation of concerns

Its toolset

Everything the assistant can do here goes through one of these:

  • sandbox_tools.py — Tools for sandbox administration
  • code_execution_tools.py — Tools for code execution
  • file_tools.py — Tools for file operations

Adding it to your client

Installation goes through your MCP client rather than a global install: point it at fastmcp on PyPI and it is fetched when the client starts. The copy-paste blocks for Claude Desktop, Claude Code and Cursor are further down this page.

Configuration

You will need one environment variable: E2B_API_KEY. The server will not start without them, which is usually why the tools fail to appear on a first run. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

  • Python 3.10 or higher - E2B API key (for the default E2B interpreter)

When to reach for it

Among the developer tooling options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. MCP Code Sandbox's toolset — sandbox_tools.py, code_execution_tools.py, file_tools.py — is a fair guide to whether it matches your workflow. It is maintained by chrishayuk; worth a glance at recent repository activity before you build anything load-bearing on it.

This entry was verified against MCP Code Sandbox's own documentation before publication; SyncDev keeps the directory reviewed rather than auto-generated.

Caveats

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the mcp code sandbox mcp server does with a few real requests.

Available tools

ToolWhat it does
sandbox_tools.pyTools for sandbox administration
code_execution_tools.pyTools for code execution
file_tools.pyTools for file operations

How to install the MCP Code Sandbox MCP server

Or if you're using `uv`:
   ```json
   {
     "mcpServers": {
       "code-sandbox": {
         "command": "uv",
         "args": [
           "--directory",
           "/ABSOLUTE/PATH/TO/PROJECT_DIRECTORY",
           "run",
           "main.py"
         ]
       }
     }
   }

Configuration as documented by the project. Restart the client after saving.

Configuration

  • Python 3.10 or higher - E2B API key (for the default E2B interpreter)
VariableDescriptionRequired
E2B_API_KEYCredential the server authenticates with.Yes

Example prompts to try

  • Use MCP Code Sandbox to sandbox tools.py.
  • Use MCP Code Sandbox to code execution tools.py.
  • Use MCP Code Sandbox to file tools.py.

Frequently asked questions

It connects MCP Code Sandbox to MCP-compatible AI assistants such as Claude and Cursor, exposing 3 tools (sandbox_tools.py, code_execution_tools.py, file_tools.py) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with MCP Code Sandbox directly.