This MCP server provides isolated Docker environments for code execution, allowing you to create containers with any Docker image, write and execute code in multiple languages, install packages, and run commands in isolated environments.
Clone the repository:
git clone <your-repo-url>
cd sandbox_server
Create and activate a virtual environment with uv:
uv venv
source .venv/bin/activate # On Unix/MacOS
# Or on Windows:
# .venv\Scripts\activate
Install dependencies:
uv pip install .
Open Claude Desktop's configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
Add the sandbox server configuration:
{
"mcpServers": {
"sandbox": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/sandbox_server",
"run",
"sandbox_server.py"
],
"env": {
"PYTHONPATH": "/absolute/path/to/sandbox_server"
}
}
}
}
Be sure to replace /absolute/path/to/sandbox_server
with the actual path to your project directory.
Restart Claude Desktop
Once connected to Claude Desktop, you can interact with the sandbox server:
Create a Python container:
Could you create a Python container and write a simple hello world program?
Run code in different languages:
Could you create a C program that calculates the fibonacci sequence and run it?
Install packages and use them:
Could you create a Python script that uses numpy to generate and plot some random data?
Make a container that persists after Claude Desktop closes:
Could you create a persistent Python container with numpy and pandas installed?
This creates a container that:
Save your environment as a Docker image:
Could you save the current container state as an image named 'my-ds-env:v1'?
This will:
To use a saved image:
Could you create a new container using the my-ds-env:v1 image?
Create a reproducible environment definition:
Could you export a Dockerfile that recreates this environment?
The generated Dockerfile includes:
For reproducible development environments:
Create a persistent container:
Create a persistent Python container for data science work
Install needed packages:
Install numpy, pandas, and scikit-learn in the container
Test your setup:
Create and run a test script to verify the environment
Save the state:
Save this container as 'ds-workspace:v1'
Export a Dockerfile:
Generate a Dockerfile for this environment
The server provides these main tools:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "sandbox" '{"command":"uv","args":["--directory","/absolute/path/to/sandbox_server","run","sandbox_server.py"],"env":{"PYTHONPATH":"/absolute/path/to/sandbox_server"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"sandbox": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/sandbox_server",
"run",
"sandbox_server.py"
],
"env": {
"PYTHONPATH": "/absolute/path/to/sandbox_server"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"sandbox": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/sandbox_server",
"run",
"sandbox_server.py"
],
"env": {
"PYTHONPATH": "/absolute/path/to/sandbox_server"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect