Python Exec Sandbox logo

Python Exec Sandbox

Runs Python scripts in disposable sandboxes with inline dependencies, selectable Python versions, timeouts, and output limits.

Install Python Exec Sandbox

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "python-exec-sandbox": {
      "command": "uvx",
      "args": [
        "mcp-python-exec-sandbox"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Automated check passed— started and listed 3 tools correctly (5d ago).

Overview

Python Exec Sandbox MCP server runs agent-provided Python scripts in isolated, disposable environments. It uses uv to resolve PEP 723 inline dependencies, download selected Python versions, and execute each request without modifying the host Python installation or virtual environments. Linux uses bubblewrap by default, while macOS and other platforms use Docker; sandboxing can also be disabled. Reach for it when an agent needs repeatable Python execution with dependency isolation and bounded runtime or output.

Use cases

  • Run Python analysis scripts with temporary package dependencies
  • Validate PEP 723 metadata before execution
  • Test code against selected Python versions
  • Inspect the configured execution environment
  • Limit script runtime and returned output

Key features

  • PEP 723 inline dependency support
  • Disposable per-execution environments
  • Python version selection through uv
  • Bubblewrap and Docker sandbox backends
  • Configurable timeouts
  • Output size limits

Tools3

What Python Exec Sandbox lets your agent do. Expand a tool for its parameters.

Verified live~705 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked Today

Recent health check succeeded.

5/5 checks healthy over the last 34d

What it can do

From the 3 tools this server returned when we ran it.

Runs commands · 1Read-only tools · 2
Network at startup2 connections
Files written at startup1

Observed 2026-10-17 in an isolated sandbox. A description of reach, not a security audit.

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 12d ago via OSV.dev · mcp-python-exec-sandbox (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars1Stargazers on the source repository.
Last commit8mo agoMost recent push to the default branch.
Availability100%Our rolling endpoint + install checks that succeeded.
Install checkPassedOur sandbox started it and listed its tools.
Tools exposed3Callable tools this server registers over MCP.
Directory activity2 viewsConfig copies, upvotes, and views on AllMCPs.

How Python Exec Sandbox works

What Python Exec Sandbox MCP server does

Python Exec Sandbox MCP server exposes Python execution through MCP for clients that support the stdio transport. Each script runs in a temporary environment, so installed packages and virtual environments are not left on the host. The server is intended for agent-driven scripts that may need third-party packages, a specific Python version, or controlled execution limits.

Dependency declarations can be included in the script using PEP 723 metadata, or supplied separately as PEP 508 dependency specifiers. The selected dependencies are resolved for the individual execution. uv maintains a global package cache, which can speed up later runs without making an execution environment persistent.

How it works

The server process requires Python 3.13 or newer and uses uv to manage script execution, dependency resolution, and Python downloads. The Python version used by the server and the Python version used for scripts are independent. By default, scripts target Python 3.13, but the command line can select versions such as 3.14 or 3.15.

Sandbox selection depends on the platform. Linux defaults to a native bubblewrap backend with namespace isolation and network access. macOS and other platforms default to Docker. The Docker image is pulled from GHCR when needed. A none backend is available, but it provides no sandboxing. If the configured sandbox tool is unavailable, the server falls back to none with a warning.

Setup and configuration

Install Python 3.13 or newer and uv. Linux users also need bubblewrap for the native backend. Docker is required for the Docker backend. The server can be started without a global package installation using uvx mcp-python-exec-sandbox.

Common options include:

  • --python-version selects the execution Python version.
  • --sandbox-backend selects native, docker, or none.
  • --default-timeout sets the normal execution limit, defaulting to 30 seconds.
  • --max-timeout caps permitted timeouts at 300 seconds by default.
  • --max-output-bytes limits returned output, defaulting to 102400 bytes.
  • --no-warm-cache disables startup cache warming.
  • --uv-path specifies the uv executable location.

Cursor, Claude Code, and OpenAI Codex CLI examples are provided in the project documentation. Other MCP clients can use the same stdio configuration.

Tools and capabilities

Python Exec Sandbox MCP server provides three documented tools:

  • execute_python runs required script source code, optionally merging a dependencies list. Its timeout_seconds parameter defaults to 30 seconds and accepts values from 1 to 300, subject to the server maximum.
  • check_environment reports the execution Python version, uv version, platform, sandbox status, and configuration.
  • validate_script checks PEP 723 metadata and dependency declarations without running the script.

Output truncation helps prevent an execution from returning more data than the configured byte limit. Dependency metadata may declare packages such as pandas or matplotlib directly in the source, while the separate dependency parameter supports additional specifications.

Limitations and notes

Sandbox behavior depends on the selected backend and its prerequisites. The none backend does not isolate execution and is not recommended when host protection is required. Native sandboxing is documented for Linux; requesting the native backend on macOS redirects to Docker.

Scripts can use network access with the native backend, while Docker provides container isolation and resource limits. Execution time is bounded by the request timeout and server maximum, and output may be truncated. Python versions beyond the server's own runtime are downloaded by uv rather than requiring those versions to be installed on the host.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Python Exec Sandbox

Python Exec Sandbox is an MCP server that connects AI clients to isolated Python execution environments. Its main tools are execute_python for running scripts with managed dependencies, check_environment for reporting runtime details, and validate_script for checking PEP 723 metadata without execution. It uses uv and supports bubblewrap or Docker sandboxing.

Install Python 3.13 or newer and uv, then run it with `uvx mcp-python-exec-sandbox`. Linux native sandboxing also requires bubblewrap; Docker is required when using the Docker backend. The server can be added to an MCP client through its stdio command configuration.

Yes, Python Exec Sandbox works with Cursor through a project or global `.cursor/mcp.json` entry that runs `uvx` with `mcp-python-exec-sandbox` as its argument. Cursor must support the MCP stdio transport.

Pass `--python-version` when starting the server, such as `--python-version 3.14`. uv downloads the selected execution version automatically, so Python 3.14 or 3.15 does not need to be installed on the host. The server process itself still requires Python 3.13 or newer.

Declare dependencies in PEP 723 script metadata or pass them through the tool's `dependencies` parameter. uv resolves them for each execution in a disposable environment, while its global cache can speed up later installs. The host Python site-packages and virtual environments are not used for these script environments.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewPython Exec Sandbox AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/python-exec-sandbox?style=directory)](https://allmcps.com/mcp/python-exec-sandbox)
HTML Embed
<a href="https://allmcps.com/mcp/python-exec-sandbox"><img src="https://allmcps.com/api/badge/python-exec-sandbox?style=directory" alt="Python Exec Sandbox on AllMCPs" /></a>