Local Sandbox MCP Environment
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., "@Local Sandbox MCP Environment Write a script that prints the first 10 Fibonacci numbers, run it, and show me the output"
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.
Local Sandbox MCP Environment
An MCP server that gives an LLM a secure local workspace: it can write files, run code in a locked-down Docker container, and query an isolated SQLite database, with no access to the rest of your machine.
The problem
An AI that only suggests code is limited. An AI that runs code directly on your computer is dangerous: it could delete files, read secrets, use the network, or loop forever. This project lets the model write, run, see errors, and fix its own code, safely.
Related MCP server: Agent Workspace MCP Server
Demo

Architecture
flowchart LR
A[Claude Desktop<br/>MCP client] -- stdio --> B[MCP Server<br/>FastMCP]
B --> C[Workspace<br/>safe_path checks]
B --> D[Executor]
B --> E[(SQLite<br/>read-only)]
D -- docker run --> F[Container<br/>no network, limited,<br/>read-only]
F -. mounts read-only .-> CTools
Tool | Purpose |
| Manage files inside |
| Run a workspace script in an isolated container |
| Show the database tables |
| Run read-only |
Threat model
Threat | Defense | Tested by |
Path traversal ( |
|
|
Destructive SQL ( |
|
|
Stacked SQL statements |
|
|
Infinite loops / CPU hogging | 10s timeout; container force-removed |
|
Orphaned containers | Unique |
|
Network access / data exfiltration |
|
|
Modifying host files | Workspace mounted |
|
Memory / fork bombs |
| Manual |
Privilege escalation | Non-root user, | Configuration |
Output flooding | Output truncated at 10,000 characters | Manual |
Setup
Requirements: Python 3.10+, uv, Docker (running).
git clone https://github.com/Prakhar021-hub/local-sandbox-mcp.git
cd local-sandbox-mcp
uv sync
docker build -t sandbox-mcp-runner docker/
uv run pytest -vTry it in the MCP Inspector
PYTHONPATH=src uv run mcp dev dev_server.pyConnect to Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json under mcpServers:
"local-sandbox": {
"command": "/path/to/uv",
"args": ["--directory", "/path/to/local-sandbox-mcp",
"run", "python", "-m", "local_sandbox_mcp.server"],
"env": {
"PYTHONPATH": "src",
"PATH": "/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin"
}
}Restart Claude Desktop (Cmd+Q) and try: "Write a script that prints the first 10 Fibonacci numbers, run it, and show me the output."
Project structure
src/local_sandbox_mcp/ server, executor, database, workspace, config, logging
docker/Dockerfile minimal non-root Python runner image
tests/ pytest suite that attacks the sandboxLimitations
Docker containers share the host kernel, so this is strong isolation for local development, but not a substitute for a VM-level sandbox against a determined attacker. Intended for local, single-user use.
License
MIT
Available Tools
6 toolsdescribe_schemaB
Show the SQLite database schema.
Inputs: no named parameters. Returns: result
list_filesB
List all files in the workspace.
Inputs: no named parameters. Returns: result
query_dbA
Run a read-only SELECT query against the sample database.
Inputs: sql (required). Returns: result
read_fileC
Read a file from the workspace.
Inputs: path (required). Returns: result
run_pythonA
Run a Python file from the workspace in an isolated Docker container (no network, limited CPU/memory, 10s timeout).
Inputs: path (required).
write_fileC
Create or overwrite a file in the workspace.
Inputs: path (required), content (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a clearly distinct resource and action: file CRUD, Python execution, and read-only database access are cleanly separated. The only adjacent pair, describe_schema and query_db, is well differentiated by one returning metadata and the other returning query results.
All six tools follow a consistent snake_case verb_noun pattern (run_python, describe_schema, query_db, list_files, write_file, read_file). No mixed conventions or vague verbs.
Six tools is a tight, well-scoped surface for a sandbox environment; every tool earns its place with no redundancy. Nothing feels padded or thin.
File read/write/list, code execution, and DB inspection cover the core sandbox workflow, but there is no delete_file or directory-creation operation, which agents may need when cleaning up or organizing the workspace. A way to pass arguments/stdin to run_python is also absent but workable.
Maintenance
Related MCP Connectors
Persistent cloud workspaces for AI agents: run commands, edit files, use git and a browser.
Secure Linux sandboxes for AI agents, as MCP tools.
Give your agent a persistent workspace: files, a code sandbox and a public URL to publish to.
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides a secure, containerized Python sandbox for executing LLM-generated code with multi-layer isolation, along with JSON/CSV validation and workspace state snapshots.-
- FlicenseAqualityBmaintenanceA secure, containerized workspace for LLMs to autonomously code, test, and debug projects without risking the host machine.61-
- AlicenseNot gradedqualityCmaintenanceProvides a restricted Docker-based sandbox for LLM agents, enabling file operations, command execution, and local Git within an isolated runtime.19 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to understand, run, test, diagnose, review, benchmark, and validate real local software projects through the Model Context Protocol. It provides workspace-confined safe execution, structured evidence instead of raw logs, and Git checkpoints with guarded rollback that never destroys user work.MIT