
Parselbox
io.github.thesanjeetcPublished by GitHub account thesanjeetcv0.1.1Updated Oct 24, 2026
Secure Python sandbox — MCP servers, APIs, shells and host functions as native Python objects.
Overview
Parselbox is a local Python sandbox MCP server that lets an assistant run code and call MCP servers, APIs and shells as native Python objects.
- What you can do
- Execute Python code in a stateful, disk-backed sandbox with a virtual bash shell
- Call other MCP servers' tools as Python namespaces, plus REST, GraphQL and shell bridges
- Discover capabilities on demand with help, search, inspect and preview
- Run background tasks, parallel fan-out and interactive shell sessions
- Read and write files through input files, read-only or read-write mounts and a persistent output directory
- Load Python and npm packages, WASI binaries and render inline HTML or serve a small web app
- When to use it
- Useful when an assistant must orchestrate several tools or MCP servers inside one script instead of chaining many separate tool calls, or needs a sandboxed Python runtime with files, packages and controlled network access for data work and charts.
- Requirements
- Runs locally over stdio via uvx (PyPI package parselbox). Deno must be installed on the host for the sandbox runtime. Network access is off by default and must be enabled or allowlisted; mounts, output directory, packages and memory/timeout limits are set by flags or API options.
Installation
In SourceWeft
- Open Parselbox in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
[Parselbox SDK] [Parselbox SDK]
Code. Filesystem. Context. Tools.
What if agents had one tool to rule them all?
[License] [PyPI - Version] [CI]
Parselbox is an embeddable Python runtime where AI agents call tools as code — MCP servers, APIs, and shells become native Python objects. Disk-backed workspace, packages, and networking built in; a single-process execution layer powered by Deno and Pyodide.
https://github.com/user-attachments/assets/d4e43d16-3aa3-4e29-83c7-a1d3885b8045
[!TIP] Drop the Parselbox MCP alongside existing MCP server configurations. Agents instantly get a Python runtime, MCP tools as code, support for skills and a disk-backed workspace.
Why Parselbox?
Parselbox packages programmatic tool calling as a local, open-source execution layer. Drop it into an existing MCP configuration with uvx, or embed the Python API into any agent stack.
Beyond code execution, Parselbox provides a stateful, disk-backed workspace with packages, controlled networking, background tasks and progressive discovery.
Deno + Pyodide provide a single-process runtime with explicit filesystem and network permissions — no containers or microVMs required. It also enables JavaScript/npm interoperability, WASM/WASI integration and generative UI through MCP Apps.
Why an execution layer?
Most agent stacks expose each capability as a separate tool. As integrations grow, tool schemas consume more context. The model must also carry intermediate results, transform data and route values between calls.
An execution layer moves orchestration out of the context window and into code. Capabilities are discovered on demand, then composed with full control flow. A single execution can coordinate multiple tools while variables, state and files remain inside the runtime.
The result is less context bloat, fewer model-to-tool round trips and complex workflows expressed as code rather than chains of individual calls.
Features
🔒 Secure Isolation
No containers, no VMs — just a single, lightweight Deno + Pyodide process (~160 MB). Deno permissions, memory caps, timeouts, network allowlists. Snapshot caching and crash recovery.
🛠️ Tools as Code
MCP servers, REST + OpenAPI, GraphQL, shell, functions and classes — all native Python objects. Stateful across calls. Pydantic auto-conversion. Credentials stay on the host.
🐍 Polyglot Runtime
Full CPython with js() interop — use JS packages as native Python. require() for npm, local TypeScript, and .wasm modules. Virtual bash() for shell. Auto-install packages on import.
📦 WASM Tools
require() any .wasm — library exports become Python methods, WASI programs become callable commands; drop one in bin/ to run it from bash() too. In-process, inherits the sandbox's mounts and permissions, installs nothing on the host.
⚡ Background Tasks
Append .task() to any call — parallel fan-out with asyncio.gather, check progress, tail logs, drive interactive sessions with send(), await later.
📁 Filesystem Integration
Disk-backed workspace — host mounts (ro/rw), input files at /files/, outputs persisted to real directories. New and modified files are detected and returned per call.
🔍 Progressive Disclosure
help(), search(), inspect(), preview() — agents discover only what they need, when they need it.
🎨 Generative UI
display() renders HTML inline in the chat (MCP Apps), with Tailwind + daisyUI injected. Or serve a full app — built-in HTTP server with static files, live reload, file upload, and @api routes that compose across tools.
Contents
Quick Start
Parselbox uses Deno for the secure sandbox runtime.
1. Install Deno
2. Install Parselbox
Parselbox API
Wire any tool into the sandbox — MCP servers, REST/GraphQL, shells, host objects — and the agent calls them as native Python, composing them with real control flow over a disk-backed workspace and both the Python and npm package ecosystems.
Example:
Parselbox MCP
The Parselbox CLI runs a standalone MCP server — every sandbox option is available as a flag.
STDIO
[!TIP] The "loopback" trick:
- Add the Parselbox MCP alongside your existing MCP servers.
- Point
--mcpat that same config file.- On startup, Parselbox connects to the other servers, exposes their tools inside the sandbox, and starts its own MCP server.
Don't worry — Parselbox detects and avoids connecting to itself. No infinite loops of doom.
Example:
HTTP
Full Example
Parselbox Agents
User Guide
1. Tools as Code
The context bridge exposes host Python objects inside the sandbox:
context— functions and namespaces as callable tools. Execution pauses, runs on host, returns result.globals— static values (strings, numbers, dicts) copied into the sandbox.mcp— MCP server config (dict or path). Appears as callable namespaces inside sandbox.
Plain classes are auto-wrapped — every public method becomes a callable tool; methods starting with _ stay private:
Subclass Bridge for nested namespaces (auto-crawled); annotate a parameter with a Pydantic model and passed dicts convert to it automatically:
Parselbox ships bridges for REST, GraphQL, and shell:
Runnable: bridges.py
2. Background Tasks
Every context and MCP call also has a .task() form that runs on the host without blocking the sandbox — for parallel fan-out, long-running jobs, and interactive sessions:
MCP tools stream their progress and log notifications into the task's logfile. A custom Bridge method emits the same way with self.log(), and reads whatever the sandbox queued via send() with self.recv():
Interactive sessions — ShellBridge.shell() keeps stdin open, so a task can drive a live process with send():
An optional first command launches any REPL as the session — e.g. sh.shell.task("python3 -i").
Runnable: tasks.py
3. Filesystem Integration
Parselbox runs on Pyodide's virtual filesystem, with the working directory, input files, mounts, and packages backed by real host directories — access gated by Deno's permission controls at startup.
[!NOTE]
/workspaceis always backed by a real host directory —output_dir(persistent) or an ephemeral temp dir (wiped on close) — enabling Deno streaming,resolvePath(), andrequire()for local modules.- Cross the boundary with
sandbox.read_file(path)(strfor text,bytesfor binary) andsandbox.write_file(path, content); a persistentoutput_diris also readable directly.- Mounts with
target="skills"are reported bysbx.info()and discoverable viabash("ls /mnt/skills/").
Example:
Reach the same files from a shell with bash():
Runnable: filesystem.py · bash.py
4. Packages & Networking
Packages
Pyodide supports pure-Python packages and many C-extension packages, which must be pre-built for Pyodide — numpy, pandas, and more ship included.
[!NOTE] Package installs write straight to disk — a temp dir by default (wiped on exit). Set
package_dirto persist them across sessions, so the next boot is instant with no re-download.
Networking
After initial package loading, network is blocked by default. Access is configured with Deno's permission controls via --allow-net / --deny-net. All HTTP from sandboxed code (requests, httpx, fetch) routes through Deno's fetch().
[!NOTE] The CLI
--networkflag is a boolean toggle only. Domain allowlists are available via the Python API.
Proxy & Credential Injection
Pyodide is not a security boundary — sandboxed code can read env vars via js('Deno.env.get("KEY")'), so never pass real credentials in env. Instead, run a credential-injecting proxy on the host and lock the sandbox to it:
Most SDKs take a base_url override. For SDK-agnostic interception, set HTTP_PROXY/HTTPS_PROXY/DENO_CERT instead and route everything through a MITM proxy — Deno's fetch() honours them at the process level.
Runnable: basics.py
5. JavaScript Interop
Parselbox runs Python inside Deno's V8 engine via Pyodide, so Python and JavaScript share the same process memory — interop is seamless.
js() — Execute JavaScript from Python
Each js() call runs in a fresh, stateless scope. Python callables are auto-proxied and cleaned up after the call. Binary converts too — Uint8Array/ArrayBuffer results become Python bytes, and bytes arguments become Uint8Arrays.
require() — Import npm Packages, Local Modules and WASM
Deno Streaming (Large Files)
For files too large to fit in memory, use Deno streams via resolvePath():
Python callbacks work inside streaming pipelines — Deno reads, JS parses, Python classifies each line.
Writing and Importing Modules
You can even compile a language to WebAssembly in-sandbox, then require() the output.
bash() — Shell Commands
A pure-JavaScript bash (just-bash) over the same workspace. Pipes and coreutils work, and curl is backed by fetch. Each call is isolated (cd/export don't persist); filesystem changes do.
Runnable: javascript.py · bash.py
6. WASM Tools
Pyodide can only load packages built for it — so pandoc, ruby or shellcheck are out of reach, and there is no apt-get in a single-process sandbox. Parselbox closes that gap with WASI: any program compiled to WebAssembly becomes a tool, with no host install.
A missing capability is just a file.
Two kinds of .wasm
require() inspects the module and picks the right shape:
A command returns {"exit": int, "stdout": bytes, "stderr": str, "missing": [...]} — missing lists any syscalls the binary asked for that aren't implemented, so gaps surface as data rather than a crash.
[!IMPORTANT] Emscripten builds are not WASI builds. Much of npm's "wasm" (
sql.js,ffmpeg.wasm,tesseract.js) is compiled with Emscripten and needs its own JavaScript glue — import those as npm packages (require("sql.js")), not as bare.wasmfiles. Both routes work;require()tells you which one a binary needs.
stdin—strorbytes;stdoutalways comes back asbytes.preopens— grant extra guest directories, e.g.preopens={"/usr": "vendor/usr"}for a binary that expects its own tree.argv0— some binaries dispatch on their program name (lld becomeswasm-ldbusybox-style).
Binaries as bash() commands
A WASI command binary (a .wasm exporting _start) in a mount's bin/ directory becomes a shell command, usable alongside bash()'s JavaScript coreutils. Binaries are discovered per call, so a tool written mid-session works immediately.
Mount a bin/ folder read-only to ship a fixed toolset the agent can use but not modify — nothing installed on the host — or have it fetch a .wasm into bin/ at runtime, which works even when the sandbox's network is restricted to a single allowlisted host.
You can even build one from source in-process — fetch a WASI clang + wasm-ld into bin/, compile C to .wasm, then require() the result. No host toolchain, nothing installed.
[!NOTE]
- Auto-detected as WASI
preview1orwasi_unstable(preview0). Not supported: sockets, real sleeps, preview2 components.- Compiled modules are cached per path (invalidated on rebuild), so a 50MB binary compiles once per session.
Runnable: pandoc.py — fetch a WASI binary · compile_c.py — compile C → wasm in-sandbox
7. Progressive Disclosure
The sbx toolkit lets agents discover capabilities on demand instead of loading everything into context up front. Available as sbx.* inside the sandbox.
The sandbox also exposes a help() builtin for per-object introspection:
Example:
Runnable: toolkit.py
8. Generative UI
Agents can surface results two ways: inline in the conversation with display(), or as a full web app with serve.
Inline widgets — display()
Any HTML an agent passes to display() renders as a widget beneath its result, in hosts that support MCP Apps.
Tailwind and daisyUI are injected automatically, so plain markup is styled without a build step, and pbx.call("/api/route", body) inside the HTML reaches @api handlers when serve is on. display() also accepts a path to an HTML file in the workspace. One view per execution — the last call wins.
On by default. run_mcp(ui=False) turns it off, which stops advertising display() to the agent and drops the renderer from the tool. The rendered HTML is always on result.view regardless:
Web apps — serve
The serve option starts a Deno HTTP server inside the sandbox — agents build full web apps on the fly.
Static Files: Any files written to the Pyodide working directory are automatically served:
Served at their own paths, with / resolving to index.html; uploaded and input files live under /files/*.
API Handlers: Define endpoints using FastAPI-style decorators:
Routes are prefixed with /api/ automatically. Verbs: @api.get/post/put/patch/delete.
Handlers can call MCP tools, context functions, and any sandbox code:
Built-in Endpoints:
Runnable: display.py · serve.py
9. Sandbox Hooks
Hooks intercept sandbox lifecycle events — log executions, approve tool calls, enforce policies. Pass them via the hooks parameter.
ElicitHook — a built-in hook that uses MCP elicitation for human-in-the-loop approval. Enable via --elicit (CLI) or run_mcp(elicit=True) (API). Only fires if the MCP client advertises elicitation capability — otherwise it's a no-op.
Runnable: hooks.py
Configuration Reference
Parselbox has the following configuration options:
Architecture
Parselbox runs agent code in one Deno process with Pyodide (CPython in WebAssembly) — no containers, no VMs. The permission-jailed sandbox works in an isolated temp workspace, with no network and no host access beyond the mounts you grant; the host holds the credentials. Every tool call is a round-trip between them:
Tools look like native Python inside the sandbox, but they execute on the host — so credentials never enter the sandbox.
Security
Parselbox's boundary is Deno's permission system — the sandbox starts with nothing and gets only what you configure.
- Filesystem — isolated temp workspace (wiped on exit); read/write only to paths you pass (
files,mountsasro/rw,output_dir). Package-cache writes lock after startup unlessallow_runtime_packages=True. - Network — off by default (revoked before your code runs). Opt in with
network=True, an allowlistnetwork=["host:port", ...], orallow_runtime_packages=True(package domains only). For authenticated APIs, front it with a proxy — see Proxy & Credential Injection. - Compiled tools (WASI) — no sockets, so a binary has no network of its own; it sees only the mounts you grant (
roenforced by Deno), and a runaway is killed by the execution timeout. - Resource limits — WASM memory capped per instance at the V8 level (default 2048 MB), JS heap capped, per-execution timeout (default 60s →
KeyboardInterrupt), auto-reconnect if the Deno process dies. - Context bridge — only the objects you pass are reachable, and only their public methods; MCP servers expose their full tool set.
Related Work
- Code execution with MCP (Anthropic)
- Code Mode (Cloudflare)
- smolagents (Hugging Face)
- Deno + Pyodide Sandbox (Simon Willison)
Source: README.md at commit 786c27b
Tools
0Version history
1- v0.1.1LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts