CodeRunner: A local sandbox for your AI agents

CodeRunner: A local sandbox for your AI agents

clockwise•byinstavm

CodeRunner is a local sandbox for AI agents that includes an MCP server for running agent code with explicitly chosen host mounts and network access.

License: Apache 2.0•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Provides an MCP Server component that handles communication between AI models and the sandbox.
  • •Exposes tools for executing Python code in a persistent Jupyter kernel and for starting, listing, and stopping named Python sessions.
  • •Includes a Playwright-based tool for web scraping and retrieving all visible text.
  • •Offers skill tools to list available skills, get documentation for specific skills, and read skill files and examples.

BEST FOR

  • •Running code that handles untrusted input in the sandbox.
  • •Executing code that the user would not run by hand.
  • •Keeping multiple agents' state isolated through named sessions.

ABOUT CLOCKWISE

CodeRunner: A local sandbox for your AI agents is cataloged as an MCP server attributed to instavm. CodeRunner is a local sandbox for AI agents that includes an MCP server for running agent code with explicitly chosen host mounts and network access. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Apache 2.0. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for CodeRunner: A local sandbox for your AI agents are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What kind of isolation does the sandbox provide?

Code runs in an isolated container with VM-level isolation, keeping the host system and files outside the sandbox protected.

Are additional host directories writable by default?

No; additional host directories are read-only by default, and :rw is needed only when the sandbox must write to the host.

Can the sandbox run without internet access?

Yes; code can run on a host-only network with no internet access.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 0f6f6214a1cc · 采集于 2026-11-13 08:18:53 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

Start

CodeRunner: A local sandbox for your AI agents

CodeRunner helps you sandbox your AI agents and its actions inside a sandbox.

Key use case: Run AI agent code in a sandbox with explicitly chosen host mounts and network access. Isolation reduces risk; it does not prevent all data loss or exfiltration.

For cloud managed VMs for agents, we have launched - InstaVM - Instant computers for AI agents

Quick Start

Prerequisites: Mac with macOS and Apple Silicon (M1/M2/M3/M4), Python 3.10+

Credentials

The installer generates the sandbox token in ~/.coderunner/api-token (or saves the CODERUNNER_API_TOKEN you exported). Clients send it as Authorization: Bearer <token>; cat ~/.coderunner/api-token prints it. Only GET /health is public, and a missing or weak token fails closed. The Claude Desktop proxy and the examples read the token from that file when the variable is not set. See authentication and network boundaries.

git clone https://github.com/instavm/coderunner.git
cd coderunner
chmod +x install.sh
./install.sh

Stop and resume

Stop the sandbox when you are done:

container stop coderunner

Resume the same sandbox later, preserving its filesystem. Python kernel state is volatile and does not survive a VM or server restart:

container start coderunner

To start over with a clean sandbox, delete the container and run the installer again:

container delete coderunner && ./install.sh

Resource limits and workspace mounts

CPU and memory limits can be set with installer options or the CODERUNNER_CPUS and CODERUNNER_MEMORY environment variables:

./install.sh --cpus 4 --memory 8g

Additional host directories must be mounted under /workspace. They are read-only by default; add :rw only when the sandbox needs to write to the host:

./install.sh \
  --mount "$HOME/projects/api:/workspace/api" \
  --mount "$HOME/projects/output:/workspace/output:rw"

Extra mounts default to none. Resource and mount settings are fixed when the container is created; delete the container before changing them.

Disable outbound network access

By default, code running in the sandbox has unrestricted network access. To run it on a host-only network with no internet access:

CODERUNNER_NETWORK=none ./install.sh

In this mode, the MCP server is available at http://127.0.0.1:8222/mcp. The setting is fixed when the container is created; the installer refuses to resume a container with a different network mode.

With Claude Code

Claude Code runs commands on your machine, as you, with permission prompts as the only boundary. Pointing it at CodeRunner's tools instead runs the code it writes in the VM: it can only touch the folders you mounted under /workspace, the network you allowed, and the sandbox's own filesystem, whatever it was told to do. Use the sandbox for code that handles untrusted input or that you would not run by hand, and for several agents that must not share state (named sessions). It does not protect anything you mount read-write.

Run Claude Code inside a Sandbox

./install.sh (if not already done)

container exec -it coderunner /bin/bash

root@coderunner:/app# npm install -g @anthropic-ai/claude-code

image

Other Integration Options

MCP server will be available at: http://coderunner.local:8222/mcp

The installer creates ~/.coderunner/venv for the Claude Desktop proxy. For the other Python examples, install their dependencies in your own virtualenv:

pip install -r examples/requirements.txt

1. Claude Desktop Integration

Configure Claude Desktop to use CodeRunner as an MCP server:

demo1

demo2

demo4

  1. Copy the example configuration:

    cd examples
    cp claude_desktop/claude_desktop_config.example.json claude_desktop/claude_desktop_config.json
    
  2. Edit the configuration file and replace the placeholder paths:

    • Replace /path/to/your/python with $HOME/.coderunner/venv/bin/python using the full path to your home directory
    • Replace /path/to/coderunner with the actual path to your cloned repository

    Example after editing:

    {
      "mcpServers": {
        "coderunner": {
          "command": "/Users/yourname/.coderunner/venv/bin/python",
          "args": ["/Users/yourname/coderunner/examples/claude_desktop/mcpproxy.py"]
        }
      }
    }
    
  3. Update Claude Desktop configuration:

    • Open Claude Desktop
    • Go to Settings → Developer
    • Add the MCP server configuration
    • Restart Claude Desktop
  4. Start using CodeRunner in Claude: Code Claude writes now runs in the sandbox.

    If the tool shows as "Disabled" in the chat's tool menu although the server is listed as running: quit Claude Desktop fully (Cmd-Q) and open it again, make sure command is the venv python the installer printed (it has fastmcp), and read ~/Library/Logs/Claude/mcp-server-coderunner.log for the proxy's error. The proxy needs the sandbox running (container list) and the token file ~/.coderunner/api-token.

2. Claude Code CLI

Use CodeRunner with Claude Code CLI for terminal-based AI assistance:

Quick Start:

# 1. Install and start CodeRunner (one-time setup; run as yourself, it asks for sudo when it needs it)
git clone https://github.com/instavm/coderunner.git
cd coderunner
./install.sh

# 2. Add the sandbox with its token (the installer prints this command)
claude mcp add --transport http coderunner http://coderunner.local:8222/mcp \
  --header "Authorization: Bearer $(cat ~/.coderunner/api-token)"

# 3. Reconnect to MCP servers
/mcp

The Claude Code plugin (claude plugin marketplace add https://github.com/instavm/coderunner-plugin) predates the token and gets 401 until it sends the same header; use the command above until the plugin is updated.

Installation Steps:

  1. Navigate to Plugin Marketplace:

    Navigate to Plugin Marketplace

  2. Add the InstaVM repository:

    Add InstaVM Repository

  3. Execute Python code with Claude Code:

    Execute Python Code

That's it! Claude Code now has access to all CodeRunner tools:

  • execute_python_code - Run Python code in persistent Jupyter kernel
  • start_python_session - Reserve an isolated kernel for a named session
  • list_python_sessions - List active named sessions
  • stop_python_session - Stop a session and discard its kernel state
  • navigate_and_get_all_visible_text - Web scraping with Playwright
  • list_skills - List available skills (docx, xlsx, pptx, pdf, image processing, etc.)
  • get_skill_info - Get documentation for specific skills
  • get_skill_file - Read skill files and examples

Pass the returned session_id to execute_python_code to keep state isolated between agents. Up to five named sessions can run concurrently.

Learn more: See the plugin repository for detailed documentation.

3. OpenCode Configuration

Configure OpenCode to use CodeRunner as an MCP server:

OpenCode Example

Create or edit ~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "coderunner": {
      "type": "remote",
      "url": "http://coderunner.local:8222/mcp",
      "headers": { "Authorization": "Bearer <contents of ~/.coderunner/api-token>" },
      "enabled": true
    }
  }
}

After saving the configuration:

  1. Restart OpenCode
  2. CodeRunner tools will be available automatically
  3. Start executing Python code with full access to the sandboxed environment

4. Python OpenAI Agents

Use CodeRunner with OpenAI's Python agents library:

demo3

  1. Set your OpenAI API key:

    export OPENAI_API_KEY="your-openai-api-key-here"
    
  2. Run the client:

    python examples/openai_agents/openai_client.py
    
  3. Start coding: Enter prompts like "write python code to generate 100 prime numbers" and watch it execute safely in the sandbox!

5. Gemini-CLI

Gemini CLI is recently launched by Google.

~/.gemini/settings.json
{
  "theme": "Default",
  "selectedAuthType": "oauth-personal",
  "mcpServers": {
    "coderunner": {
      "httpUrl": "http://coderunner.local:8222/mcp",
      "headers": { "Authorization": "Bearer <contents of ~/.coderunner/api-token>" }
    }
  }
}

gemini1

gemini2

6. Kiro by Amazon

Kiro is recently launched by Amazon.

~/.kiro/settings/mcp.json
{
  "mcpServers": {
    "coderunner": {
      "command": "/path/to/venv/bin/python",
      "args": [
        "/path/to/coderunner/examples/claude_desktop/mcpproxy.py"
      ],
      "disabled": false,
      "autoApprove": [
        "execute_python_code"
      ]
    }
  }
}

kiro

7. Coderunner-UI (Offline AI Workspace)

Coderunner-UI is our own offline AI workspace tool designed for full privacy and local processing.

coderunner-ui

coderunner-ui

Security

Code runs in an isolated container with VM-level isolation. Your host system and files outside the sandbox remain protected.

From @apple/container:

Each container has the isolation properties of a full VM, using a minimal set of core utilities and dynamic libraries to reduce resource utilization and attack surface.

Skills System

CodeRunner includes a built-in skills system that provides pre-packaged tools for common tasks. Skills are organized into two categories:

Built-in Public Skills

The following skills are included in every CodeRunner installation:

  • pdf-text-replace - Replace text in fillable PDF forms
  • image-crop-rotate - Crop and rotate images

Using Skills

Skills are accessed through MCP tools:

# List all available skills
result = await list_skills()

# Get documentation for a specific skill
info = await get_skill_info("pdf-text-replace")

# Execute a skill's script
code = """
import subprocess
subprocess.run([
    'python',
    '/app/uploads/skills/public/pdf-text-replace/scripts/replace_text_in_pdf.py',
    '/app/uploads/input.pdf',
    'OLD TEXT',
    'NEW TEXT',
    '/app/uploads/output.pdf'
])
"""
result = await execute_python_code(code)

Adding Custom Skills

Users can add their own skills to the ~/.coderunner/assets/skills/user/ directory:

  1. Create a directory for your skill (e.g., my-custom-skill/)
  2. Add a SKILL.md file with documentation
  3. Add your scripts in a scripts/ subdirectory
  4. Skills will be automatically discovered by the list_skills() tool

Skill Structure:

~/.coderunner/assets/skills/user/my-custom-skill/
├── SKILL.md              # Documentation with usage examples
└── scripts/              # Your Python/bash scripts
    └── process.py

Example: Using the PDF Text Replace Skill

# Inside the container, execute:
python /app/uploads/skills/public/pdf-text-replace/scripts/replace_text_in_pdf.py \
    /app/uploads/tax_form.pdf \
    "John Doe" \
    "Jane Smith" \
    /app/uploads/tax_form_updated.pdf

Architecture

CodeRunner consists of:

  • Sandbox Container: Isolated execution environment with Jupyter kernel
  • MCP Server: Handles communication between AI models and the sandbox
  • Skills System: Pre-packaged tools for common tasks (PDF manipulation, image processing, etc.)

Examples

The examples/ directory contains:

  • openai-agents - Example OpenAI agents integration
  • claude-desktop - Example Claude Desktop integration

Building Container Image Tutorial

https://github.com/apple/container/blob/main/docs/tutorial.md

Roadmap

  1. Linux support with Firecracker
  2. Guardrails for external agentic actions
  3. CLI for Coderunner

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for CodeRunner: A local sandbox for your AI agents from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/clockwise)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools