Execute Python code safely in isolated Docker containers
A stateful Python execution environment that combines code, shell commands, and typed MCP tool calls in one local IPython kernel.
Why it matters
Developers and AI agents hire this asset to run untrusted or experimental Python code in a secure, isolated sandbox environment without risking their host system, while maintaining state across executions and controlling network access.
Outcomes
What it gets done
Execute Python code in isolated Docker containers with IPython
Maintain stateful execution context across multiple code runs
Transfer files bidirectionally between host and container
Configure and control network access for sandboxed environments
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/mcp-ipybox | bash Overview
Ipybox
A local, stateful execution environment that runs Python code, shell commands, and MCP tool calls together in one IPython kernel, using mcpygen to expose MCP tools as typed Python functions instead of raw JSON. Use it when an agent needs code execution and MCP tool calling combined in one session with type safety and optional OS-level sandboxing, rather than a bare MCP client integration.
What it does
ipybox is a unified execution environment for Python code, shell commands, and programmatic MCP tool calls, running entirely locally on your machine with no cloud dependency. Code blocks execute inside a stateful IPython kernel, so state persists across executions and a single block can freely mix Python, shell commands (via !cmd syntax, with output captured into Python variables), and MCP tool calls. Rather than calling MCP tools via raw JSON, ipybox uses mcpygen to generate typed Python functions and Pydantic models directly from each MCP server's tool schemas - this "code mode" lets an agent call tools like ordinary typed function calls. Kernels can optionally be sandboxed with Anthropic's sandbox-runtime, which enforces filesystem and network restrictions at the OS level, and the runtime supports application-level approval of individual tool calls and shell commands as code executes. This is a full rewrite ("next generation ipybox"); the prior generation is maintained separately on the 0.6.x branch and remains installable with pip install ipybox<0.7.
When to use - and when NOT to
Use ipybox when an agent needs to execute code and call MCP tools together in one stateful session, and you want typed Python bindings for those MCP tools rather than hand-built JSON calls - particularly if you also need OS-level sandboxing or per-call approval gates. It is an execution environment, not an agent itself: if you want a ready-made general-purpose agent built on top of it, the companion Freeact project fills that role instead of ipybox directly.
Inputs and outputs
ipybox exposes three distinct interfaces onto the same execution core: a Python SDK for building applications directly against the code executor API; an MCP server mode, where ipybox's own code-execution and tool-calling capabilities are themselves exposed as MCP tools so any MCP client can drive it; and a Claude Code plugin that bundles the MCP server together with a code-action skill for direct use inside Claude Code. Across all three, inputs are code blocks (Python, shell, or MCP tool calls) and outputs are the resulting kernel state, captured shell output, and typed tool-call results.
Integrations
Built on mcpygen for generating typed Python APIs from MCP tool schemas, and on Anthropic's sandbox-runtime for optional OS-level kernel sandboxing. Freeact, a general-purpose agent, is built directly on top of ipybox. Distributed on PyPI.
Who it's for
Developers building agents or applications that need to combine code execution with MCP tool calling in a single stateful, locally-run session - especially where typed tool APIs, sandboxed execution, or per-call approval gates matter more than a quick raw-JSON MCP integration.
Source README
ipybox
mcp-name: io.github.gradion-ai/ipybox
ipybox is a unified execution environment for Python code, shell commands, and programmatic MCP tool calls.
Overview
ipybox executes code blocks in a stateful IPython kernel. A code block can contain any combination of Python code, shell commands, and programmatic MCP tool calls. Kernels can be sandboxed with sandbox-runtime, enforcing filesystem and network restrictions at OS level.
It generates Python APIs for MCP server tools via mcpygen, and supports application-level approval of individual tool calls and shell commands during code execution. ipybox runs locally on your computer, enabling protected access to your local data and tools.
Documentation:
- ๐ Documentation
- ๐๏ธ Architecture
- ๐ค llms.txt
- ๐ค llms-full.txt
Capabilities
| Capability | Description |
|---|---|
| Stateful execution | State persists across executions in IPython kernels |
| Unified execution | Combine Python code, shell commands, and programmatic MCP tool calls in a code block |
| Shell command execution | Run shell commands via !cmd syntax, capture output into Python variables |
| Programmatic MCP tool calls | MCP tools called via generated Python API ("code mode"), not JSON directly |
| Python tool API generation | Typed functions and Pydantic models generated from MCP tool schemas via mcpygen |
| Application-level approval | Individual approval of tool calls and shell commands during code execution |
| Lightweight sandboxing | Optional kernel isolation via Anthropic's sandbox-runtime |
| Local execution | No cloud dependencies, everything runs locally on your machine |
Usage
| Component | Description |
|---|---|
| Python SDK | Python API for building applications on ipybox |
| MCP server | ipybox as MCP server for code actions and programmatic tool calling |
| Claude Code plugin | Plugin that bundles the ipybox MCP server and a code action skill |
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.