Discover MCPs & agents
Loading MCPs and agents…
Loading MCPs and agents…
Run opencode inside a bubblewrap sandbox — confine AI file access to your current working directory
Jump to setup instructionsFetched from the repository for this visit.
Run opencode inside a bubblewrap sandbox — keeping AI-driven file operations confined to your current working directory.
See also:
ai-bwrap— the multi-agent sequel to this project. Same sandbox approach, extended to Claude Code, opencode, Grok, or a plain shell, with an extensible agent registry.
opencode-bwrap is a thin shell wrapper that launches opencode inside a bwrap (bubblewrap) sandbox. The sandbox:
$HOME (no ~/.ssh, ~/Documents, etc.)~/.gitconfig and gh CLI auth (read-only)bwrap — install via your package manager:
# Debian/Ubuntu
sudo apt install bubblewrap
# Arch
sudo pacman -S bubblewrap
# Fedora
sudo dnf install bubblewrap
$PATHCopy opencode-bwrap to somewhere on your $PATH, for example:
cp opencode-bwrap ~/.local/bin/opencode-bwrap
chmod +x ~/.local/bin/opencode-bwrap
Run it from your project directory:
cd /path/to/your/project
opencode-bwrap
Pass any opencode flags normally:
opencode-bwrap --model anthropic/claude-sonnet-4-5
| Resource | Behavior |
|---|---|
Files outside $PWD | Not visible (no bind) |
~/.ssh | Not mounted |
$HOME (other than config dirs) | Empty virtual dir |
Physical block devices (/dev/sda, etc.) | Not present |
| Host processes (other PIDs) | Not visible — isolated PID namespace |
Privilege escalation (sudo) | Blocked — no setuid in namespace |
| Resource | Mount type |
|---|---|
$PWD (current directory) | read-write |
~/.config/opencode | read-write |
~/.local/share/opencode | read-write |
~/.cache/opencode | read-write |
~/.local/state/opencode | read-write |
~/.gitconfig | read-only |
~/.config/gh | read-only |
$NVM_DIR | read-only |
/usr, /etc | read-only |
Edit the WORKSPACES array at the top of the script:
WORKSPACES=(
"$(pwd)"
"$HOME/projects/other-repo"
)
bwrap uses Linux namespaces — the same kernel is shared with the host. This is stronger isolation than running opencode directly, and lighter than a full VM. For most personal development use cases this is a practical tradeoff.
Key limitations to be aware of:
--new-session is intentionally omitted to preserve job control (Ctrl-Z / fg). This slightly reduces TIOCSTI protection.MIT
GitHub checked 183h ago - refresh overdue. Recently viewed repositories target hourly refresh.
Find a documented setup for your client. No sign-in, installation, or tool execution.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.