OpenCode Remote Bridge
Provides Git tools (git_status and git_diff) that report the working tree status and show diffs for the project controlled through the OpenCode session.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
🌉 OpenCode Remote Bridge
Control your local OpenCode from anywhere, through any MCP client.
An authenticated Model Context Protocol server that exposes OpenCode sessions, files, terminal and Git over Streamable HTTP, published on a persistent zrok public name.
This bridge gives whoever holds the bearer tokenread/write/delete access to files and command execution on the host machine. It is not a hardened sandbox. Only connect clients you trust, keep the token secret, and review your OpenCode permissions.
Table of contents
Related MCP server: opencode-mcp
Features
🔐 Bearer-token auth with timing-safe comparison
🌐 MCP Streamable HTTP transport, works with Cursor, VS Code, Claude Code and more
💬 OpenCode sessions: create, prompt (sync or async), inspect, abort, delete
📁 Filesystem tools: read, write, list, search, delete
💻 Terminal: run commands through an OpenCode session and its permissions
🌿 Git: status and diff
🤖 Autonomous Goal Runner: orchestrator, worker and reviewer loop until the goal is verified
🚀 One-command manager for OpenCode, the bridge and a persistent zrok share
🧩 Preserves your other MCP servers (e.g. Composio) when updating the OpenCode config
How it works
flowchart LR
A[MCP client<br/>Cursor / VS Code / Claude Code] -- HTTPS + Bearer token --> B[zrok public name]
B --> C[Bridge :8787<br/>/mcp]
C --> D[OpenCode API :4096]
D --> E[(Your project<br/>files, shell, Git)]Both OpenCode and the bridge bind to 127.0.0.1. Only zrok exposes the bridge publicly.
Requirements
Requirement | Notes |
Debian / Ubuntu | Debian in Termux/PRoot is supported |
Node.js 20+ and npm | Node 22 recommended |
OpenCode CLI | available as |
zrok v2 CLI | available as |
Python 3, OpenSSL, curl, Git | used by the installer and manager |
Free local ports | 4096 (OpenCode) and 8787 (bridge) |
Run as root, or prefix with sudo.
# Basics
apt-get update
apt-get install -y ca-certificates curl git openssl python3
# Node.js 22
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt-get install -y nodejs
# OpenCode CLI
curl -fsSL https://opencode.ai/v2/install | bash
export PATH="$HOME/.opencode/bin:$PATH" # add to ~/.bashrc if needed
# zrok v2
curl -sSf https://get.openziti.io/install.bash | bash -s zrok2References: OpenCode docs · zrok reserved names
Quick start
1. Set up zrok (one time)
zrok2 enable YOUR_ZROK_ENABLE_TOKEN
zrok2 create name -n public YOUR_UNIQUE_NAME
zrok2 list namesYour endpoint will be https://YOUR_UNIQUE_NAME.shares.zrok.io/mcp. Every installation needs its own reserved name. Never publish your enable token.
2. Install the bridge
git clone https://github.com/sandro9800/opencode-remote-bridge-clean.git
cd opencode-remote-bridge-clean
chmod +x mcp scripts/install.sh
./scripts/install.shThe installer installs dependencies and creates a private .bridge-token (git-ignored, restricted permissions).
3. Set your zrok name
Open the mcp script and set, near the top:
ZROK_RESERVED_NAME="public:YOUR_UNIQUE_NAME"4. Start
./mcp start # OpenCode API + bridge + zrok share
./mcp client # open OpenCode with the bridge configuredKeep ./mcp start running while an external assistant is connected. Read your token locally with cat .bridge-token.
Connect an AI client
Any client that supports remote HTTP MCP with custom headers works.
URL:
https://YOUR_UNIQUE_NAME.shares.zrok.io/mcpHeader:
Authorization: Bearer YOUR_BRIDGE_TOKEN
{
"mcpServers": {
"opencode-remote-bridge": {
"url": "https://YOUR_UNIQUE_NAME.shares.zrok.io/mcp",
"headers": { "Authorization": "Bearer YOUR_BRIDGE_TOKEN" }
}
}
}{
"inputs": [
{
"type": "promptString",
"id": "bridge-token",
"description": "OpenCode Remote Bridge token",
"password": true
}
],
"servers": {
"opencode-remote-bridge": {
"type": "http",
"url": "https://YOUR_UNIQUE_NAME.shares.zrok.io/mcp",
"headers": { "Authorization": "Bearer ${input:bridge-token}" }
}
}
}claude mcp add --transport http opencode-remote-bridge \
https://YOUR_UNIQUE_NAME.shares.zrok.io/mcp \
--header "Authorization: Bearer YOUR_BRIDGE_TOKEN"Command-line arguments can end up in shell history. Prefer a safer credential method where available.
{
"mcpServers": {
"opencode-remote-bridge": {
"command": "npx",
"args": [
"-y", "mcp-remote",
"https://YOUR_UNIQUE_NAME.shares.zrok.io/mcp",
"--header", "Authorization: Bearer YOUR_BRIDGE_TOKEN"
]
}
}
}MCP connects an assistant to OpenCode's tools. It doesnot copy skills or agents between products. OpenCode skills, agents and AGENTS.md must live in the environment running this bridge.
Autonomous Goal Runner
Submit one high-level goal and three OpenCode sessions work on it:
Role | Job |
Orchestrator | Breaks the goal into tasks and decides what remains |
Worker | Performs each task with your configured tools, skills and agents |
Reviewer | Independently inspects the project and checks the original goal is really done |
The loop runs in the background until the reviewer verifies completion, you cancel it, an error occurs, or the iteration limit is hit (default 20, configurable 1 to 100). State is saved in .goal-runner/goals.json with restrictive permissions.
Goal tools: list_goal_models · start_goal · get_goal_status · list_goals · control_goal (pause / resume / cancel)
Example prompt for your MCP client:
Start a goal: make this project production-ready. Use auto model selection,
work in the current project, and run tests. Keep working until an independent
review verifies every acceptance criterion.Models: set any role to auto, or use an exact providerID/modelID from list_goal_models. The runner uses OpenCode's live provider catalog (cloud, local and custom providers, including NVIDIA NIM once configured in OpenCode). See OpenCode providers and the NVIDIA API Catalog.
Limits:
The worker inherits your OpenCode instance's permissions.
The reviewer is a separate session, not a formal proof. Check important changes yourself.
In-flight goals are not auto-resumed after a restart. Use
list_goals, then resume.Automatic cross-provider fallback is not yet enabled.
Avoid running several goals in the same working directory.
MCP tools (17)
Category | Tools |
Sessions |
|
Filesystem |
|
Terminal |
|
Git |
|
* Destructive: requires confirm: "DELETE".
Goal Runner tools are listed above.
Commands
Command | Action |
| Start all services |
| Stop managed services |
| Restart all services |
| Show service state and zrok URL |
| Show recent logs |
| Open isolated OpenCode client |
Logs and PIDs: ~/.local/state/opencode-remote-bridge/ · Client profile: ~/.config/opencode-remote-bridge/
Configuration
The ./mcp manager uses the default ports (4096 and 8787), so keep them when using it. When running the server directly with npm start, these environment variables apply (see .env.example):
Variable | Default | Meaning |
|
| MCP bind interface |
|
| MCP port |
|
| Local OpenCode API |
|
| Private token file |
Keep the bridge bound to localhost when using zrok.
Termux + Debian (PRoot)
pkg update && pkg upgrade
pkg install proot-distro git
proot-distro install debian
proot-distro login debian --shared-tmpThen follow the Debian steps above inside the shell. Android battery management can kill background processes, so exclude Termux from battery optimization.
Security
Use a unique, unpredictable bearer token per installation.
Never commit or share
.bridge-token, client configs or credentials.OpenCode and the bridge bind to localhost; zrok provides the public ingress.
Anyone with the token can invoke every exposed tool.
There is no per-tool authorization or sandboxing. Run it on a machine and in a project you are comfortable exposing.
Troubleshooting
Problem | Fix |
Port in use | Stop the conflicting service on 4096 / 8787 |
zrok share won't start | Check |
| Verify the |
OpenCode unavailable | Check the |
Termux stops services | Keep Termux alive; disable battery optimization |
Development
npm install
npm run check
npm startCI runs JavaScript and shell syntax checks on pushes and pull requests.
src/
config.js
server.js
lib/ # OpenCode API, output, path helpers
middleware/ # Bearer authentication
tools/ # OpenCode, filesystem, terminal, Git tools
scripts/
install.sh
mcp # service manager
.github/workflows/ci.ymlLicense
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Secure and manage MCP servers through the Speakeasy AI Control Plane from your agent.
Remote MCP access to user-authorized Linux, Windows and Intel Mac devices for AI assistants.
Remote MCP server exposing SMI Aware tools, resources, and skills over Streamable HTTP.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceExposes local OpenCode instances as remote MCP servers for Claude and ChatGPT, enabling terminal access, session management, and interactive human-in-the-loop workflows. It simplifies deployment for local machines using Cloudflare Tunnels to provide secure public connectivity and OAuth support.-
- AlicenseNot gradedqualityAmaintenanceEnables MCP clients such as Claude, Cursor, and VS Code to delegate coding tasks to an OpenCode server, including asking questions, running background jobs, monitoring progress, responding to input/permissions, and reviewing changes across projects.21,687 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables cloud AI agents to access local STDIO MCP servers and their tools through a single authenticated Streamable HTTP endpoint, optionally tunneled via ngrok.18 npm1MIT
- AlicenseNot gradedqualityCmaintenanceExposes an authenticated Streamable HTTP or stdio MCP endpoint that lets models list connected devices and route authorized operations to them over outbound WebSockets, including running commands, reading and writing files, taking screenshots, and sending mouse, keyboard, and scroll input. It works for machines behind NAT or containers without inbound ports, with per-device tokens and capability checks limiting what each caller can do.18MIT