OpenCode Mobile Bridge makes the OpenCode Web UI easier to use from a phone, tablet, or another browser on your local network.
It starts a private OpenCode server on your computer, exposes it through a LAN proxy, checks the available projects, and opens a seed page that loads your browser's OpenCode project list from OpenCode Desktop's saved projects.
OpenCode Desktop can remember projects that do not always appear immediately in the OpenCode Web UI project picker. Mobile browsers also have their own local storage, so they often start with an empty project list.
This bridge solves that workflow by providing a /__seed page. The launcher opens that page automatically on the computer, and you can open the same seed URL from your phone. The page writes the known Desktop projects into that browser's OpenCode local storage, then redirects to OpenCode.
- Installs OpenCode CLI with
npm install -g opencode-ai@latestif it is missing. - Installs Node.js automatically when possible if
nodeis missing. - Starts
opencode serveon127.0.0.1:4097by default, so OpenCode does not open an empty raw Web UI tab before projects are seeded. - Starts a LAN proxy on
0.0.0.0:4096by default. - Reuses an already-running OpenCode server or bridge proxy when possible.
- Removes
OPENCODE_SERVER_PASSWORDandOPENCODE_SERVER_USERNAMEfor the launched server unless--keep-authis used. - Seeds browser project history from OpenCode's
/projectAPI. - Also reads OpenCode Desktop's
opencode.global.datsidebar state to catch projects missing from the API. - Supports manual project paths with
--seed-project. - Includes
/__projectsdiagnostics to see exactly what the bridge found. - Opens
/__seedautomatically after project discovery succeeds.
- Python 3.10 or newer.
- Node.js available as
node. If it is missing, the launcher tries to install Node.js LTS automatically on Windows withwingetor on macOS with Homebrew. - OpenCode CLI installed and available as
opencodeor at%APPDATA%\npm\opencode.cmdon Windows. If it is missing, the launcher tries to install it automatically with npm. - Your phone and computer must be on the same local network.
Install Node.js and OpenCode manually if you do not want the launcher to install them:
winget install --id OpenJS.NodeJS.LTS -enpm install -g opencode-ai@latestFrom this folder:
python .\opencode-mobile-bridge.pyThe script checks whether OpenCode is installed, starts whatever is missing, discovers projects, and opens the seed page automatically. It also prints URLs like:
LAN Web UI: http://192.168.1.74:4096/
Seed projects: http://192.168.1.74:4096/__seed
Debug projects: http://192.168.1.74:4096/__projects
On your phone or another device, open the printed Seed projects URL once:
- Open the
Seed projectsURL. - Wait for it to redirect to OpenCode.
- Use the
LAN Web UIURL after that.
Use different ports:
python .\opencode-mobile-bridge.py --upstream-port 4097 --proxy-port 4096Do not install Node.js automatically:
python .\opencode-mobile-bridge.py --no-install-nodeDo not open a browser automatically:
python .\opencode-mobile-bridge.py --no-openOpen diagnostics instead of the seed page:
python .\opencode-mobile-bridge.py --open-target projectsUse opencode web instead of opencode serve:
python .\opencode-mobile-bridge.py --opencode-subcommand webAdd a project manually if it is not discovered:
python .\opencode-mobile-bridge.py --seed-project "C:\_Work\my-project"Add multiple manual projects:
python .\opencode-mobile-bridge.py --seed-project "C:\_Work\project-a" --seed-project "C:\_Work\project-b"Use a custom Desktop state file:
python .\opencode-mobile-bridge.py --desktop-global "C:\Users\MiPC\AppData\Roaming\ai.opencode.desktop\opencode.global.dat"Keep OpenCode HTTP basic auth enabled:
python .\opencode-mobile-bridge.py --keep-authThe project list is merged in this order:
- Manual paths from
--seed-project. - OpenCode Desktop sidebar state from
opencode.global.dat. - OpenCode server projects from
/project.
Duplicates are removed. By default, only folders that exist on disk are included.
If you want to include paths even when they do not currently exist, set:
$env:OPENCODE_INCLUDE_MISSING_PROJECTS = "1"
python .\opencode-mobile-bridge.pyEach launcher run checks project discovery before opening the seed page. If you opened or created a new project in OpenCode Desktop and it does not appear on your phone:
- Refresh or restart OpenCode Desktop so it writes its latest sidebar state.
- Restart this bridge.
- Open
/__seedagain from the browser/device that is missing the project. The seed page overwrites the browser's project list with the latest merged list. - Check
/__projectsto confirm whether the bridge found the folder.
If /__projects does not show it, launch with --seed-project "C:\path\to\project".
This area still needs improvement because OpenCode Desktop and OpenCode Web do not currently share one guaranteed project-history source. The bridge uses the best available sources and exposes diagnostics so missing paths are visible.
OpenCode only asks for a username/password when OPENCODE_SERVER_PASSWORD is set.
By default this bridge removes these variables for the OpenCode process it launches. If you still see a browser password prompt:
- Stop the bridge.
- Close old OpenCode server terminals.
- Run the bridge again with
python .\opencode-mobile-bridge.py. - Make sure you are opening the printed
LAN Web UIURL, not an older random Desktop sidecar URL.
If you intentionally use --keep-auth, the default username is usually opencode, and the password is whatever OPENCODE_SERVER_PASSWORD is set to.
This exposes OpenCode to your local network. Only use it on a network you trust.
For safer access:
- Keep the proxy bound to your LAN only.
- Stop the bridge when not using it.
- Use
--keep-authif you need password protection. - Do not expose port
4096to the public internet.
Check if the bridge is alive:
http://YOUR_PC_IP:4096/__health
Check discovered projects:
http://YOUR_PC_IP:4096/__projects
If your phone cannot connect:
- Confirm the phone is on the same Wi-Fi/LAN.
- Allow Python/Node/OpenCode through Windows Firewall when prompted.
- Try opening
http://127.0.0.1:4096/on the computer first. - Verify no other process is already using port
4096.
- Better direct import from OpenCode Desktop project storage if the format changes.
- Optional automatic reseeding when Desktop project state changes.
- A packaged executable for Windows users.
- Optional authentication handling at the proxy layer.