create_sandboxLABSCO SUMMARY
Code that runs somewhere it cannot hurt you.
The container is addressable and reusable, so a session installs what it needs once and keeps working in the same place — and whatever it produces comes back as a file you can open.
What it is
An isolated execution environment. Each sandbox is a Docker container with an ID; code and terminal commands run inside it, packages install into it, files upload into it, and generated files come back as web links.
What you get
- A sandbox created as a Docker container, and existing ones listed for reuse
- Python code executed inside a named sandbox
- Terminal commands run in the same container
- Packages installed into a sandbox, with the install status checked afterwards
- Files uploaded into a sandbox to work on
- Generated files reachable over web links, with a built-in web interface for watching results
Requirements
Docker on the host, Python and uv. It serves SSE at http://127.0.0.1:8181/sse, bound to localhost — change the host in config.toml to expose it, and turn on the optional API-key authentication if you do.
Setup effort
Build from source — git clone https://github.com/JohanLi233/python-mcp-sandbox.git
USE CASES
Running code you would rather not run on your machine
The container is created for the job and the code runs inside it, so a script from somewhere unfamiliar touches nothing you care about.
Working with a library that is installed nowhere
Install it into the sandbox, confirm the install actually finished, and then run against it — including from a mirror if PyPI is slow where you are.
Analysing a file you have on hand
Upload the file into the sandbox and work on it there; anything the script writes out comes back as a link.
Doing something Python is the wrong tool for
The same container takes terminal commands, so unpacking an archive or running a binary does not need a second environment.
Picking up a container you were using earlier
Sandboxes are listed and reused by ID, which keeps the packages and files from the last session instead of rebuilding them.
7 tools
Listed in project docs. Your client may show a different list.
list_sandboxesexecute_python_codeinstall_package_in_sandboxcheck_package_installation_statusexecute_terminal_commandupload_file_to_sandboxBEFORE YOU INSTALL
What to know first
Tools you get
7 tools named in the project's documentation. Every tool takes a sandbox_id, so start with list_sandboxes or create_sandbox. Package installs run in the background; check them with check_package_installation_status.
Where it runs
All 4 documented setups run the server on your machine.
INSTALLATION
Connect your client
This one is built from source rather than installed with a single command.
Server setup
# Clone the repository
git clone https://github.com/JohanLi233/python-mcp-sandbox.git
cd python-mcp-sandbox
# Install dependencies using uv
uv venv
uv sync
# Start the server
uv run main.pyMCP Clients
Claude Desktop
{
"mcpServers": {
"mcpSandbox": {
"command": "npx",
"args": [
"-y",
"supergateway",
"--sse",
"http://127.0.0.1:8181/sse"
]
}
}
}Claude Desktop — authenticated
{
"mcpServers": {
"mcpSandbox": {
"command": "npx",
"args": [
"-y",
"supergateway",
"--sse",
"http://127.0.0.1:8181/sse?api_key=<YOUR_API_KEY>"
]
}
}
}MCP Inspector, Any SSE client
http://127.0.0.1:8181/sse