Sandboxed execution (opp_sandbox)
opp_sandbox wraps a command in a bubblewrap (bwrap)
container: read-only system + sources, a writable working
directory, dropped capabilities. Qtenv GUI still works. It is the
recommended way to expose execute_python to an autonomous agent
with reduced blast radius.
Upstream reference: https://github.com/omnetpp/opp_repl/blob/main/doc/mcp_server.md (the "Running inside opp_sandbox" section)
Requirements
- Linux with
bubblewrap(bwrap) installed (sudo apt install bubblewrap). Not available on macOS.
Usage
opp_sandbox [options] [--] <command> [args...]
| Option | Meaning |
|---|---|
-m, --mount DIR ... |
Mount additional directories read-only |
-w, --writable DIR ... |
Mount additional directories read-write |
-h, --help |
Print help |
-- |
End of options; everything after is the command |
Example — a sandboxed REPL with the MCP server, no token needed:
opp_sandbox -w ~/workspace -- \
opp_repl --load "opp/*.opp" --mcp-port 9966
Why the MCP server needs no token inside the sandbox
opp_sandbox bind-mounts a read-only sentinel at /.opp_sandbox.
opp_repl detects it (is_running_in_sandbox()) and waives the
bearer-token requirement for the MCP server — bubblewrap isolation
substitutes for auth. Outside the sandbox, TCP MCP still requires
--mcp-token-hash or --mcp-bypass-token-hash-check (see
opp-repl-mcp-server).
Overlays + sandbox
fuse-overlayfs mounts must be created before entering the
sandbox (the jail restricts FUSE). Pre-mount with opp_mount, run
inside the sandbox, then opp_unmount afterwards:
opp_mount "~/workspace/opp/*.opp"
opp_sandbox -w ~/workspace -- opp_repl --load "opp/*.opp" --mcp-socket
opp_unmount
See opp-repl-overlay-builds for the overlay mechanics.
Pitfalls
- Linux-only. On macOS there is no bubblewrap — rely on the Unix
socket transport's
0600permissions and a venv instead. - Anything the sandboxed command must write (results, build output,
overlay roots) needs an explicit
-wmount, or you'll get read-only-filesystem errors. - The sandbox isolates the filesystem, not the network; don't treat it as a full security boundary for hostile code.
See also
opp-repl-mcp-server— auth model the sandbox interacts with.opp-repl-overlay-builds—opp_mount/opp_unmountpre-mounting.opp-repl-shared-terminal— a different way to share one live REPL.