Repository navigation
[FEATURE]: SSH-based remote server connections to OpenCode Desktop #7790
Copy link
Copy link
Closed
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Summary
Add first-class SSH connectivity to the OpenCode desktop app so users can connect to a remote opencode server through a secure SSH local port-forward. The desktop app continues to speak HTTP/WebSocket to the server via 127.0.0.1:; SSH is transport only.
Goals
• Establish SSH local port-forwards using the system ssh binary (no embedded SSH libs).
• Discover a running remote OpenCode server via a standardized health endpoint over the forwarded port.
• Optionally bootstrap a server via a single remote command execution (no interactive shell workflow).
• Provide clear connection states, diagnostics, and typed error surfaces.
Non-goals
• Remote filesystem access beyond the OpenCode server API.
• Terminal multiplexing / interactive shell access.
• SSH key generation/management/storage.
• SSH config modification/management.
• Remote extension execution.
• Any custom SSH protocol implementation.
Proposed UX
• “Add Connection” wizard for creating a Connection Profile (host + optional user/port/identity file/proxy jump).
• Connect/Disconnect per profile.
• Connection status indicator (Connecting → Discovering → Bootstrapping → Connected / Failed).
• “Copy Diagnostics” action (redacted logs + effective parameters used).
Requirements (high-level)
SSH Transport
• Use system ssh to establish a local forward bound to 127.0.0.1 (local endpoint only).
• Fail fast if ssh would prompt for a password/passphrase (no password prompts in-app).
• Host key verification must be enabled (StrictHostKeyChecking equivalent). Unknown host keys require manual acceptance via ssh outside the app.
• Clean termination on disconnect (SIGTERM then SIGKILL after timeout).
Discovery
• After tunnel is established, probe a standardized endpoint (e.g., GET /health) through the local forward.
• Require 200 OK and JSON including at least status and version.
• Enforce compatibility (e.g., major version mismatch fails with a Compatibility error).
• Timeouts and retry rules should be defined (initial suggestion: 10s per probe).
Optional Bootstrap
• If discovery fails and bootstrap is enabled, run a single remote command (e.g., opencode server start --port=<p> --json).
• Parse JSON output for port/endpoint data, then retry discovery.
• No user-provided arbitrary command args beyond a port number.
• Timeout bootstrap (initial suggestion: 30s) and surface stderr/stdout in diagnostics (redacted).
Profiles & Integration
• Persist profiles locally (JSON in app data dir).
• Support SSH config options commonly needed: Host, HostName, Port, User, IdentityFile, ProxyJump.
• Respect known_hosts; never modify SSH config or known_hosts.
Error Taxonomy / Diagnostics
• Typed errors: Transport, Discovery, Bootstrap, Compatibility, Configuration.
• Expose actionable messages + include redacted raw ssh stderr/stdout in diagnostics.
Open Questions
• How to choose the remote server port (default vs negotiated if 8080 is in use)?
• Whether to support multiple forwards (if bootstrap returns a different port) vs rebuild tunnel.
• What exact /health JSON contract should be considered stable/minimum?
• Precedence rules: profile values vs ~/.ssh/config Host entries.
Acceptance Criteria (MVP)
• User can connect to a host with an already-running remote OpenCode server using an SSH tunnel created by the desktop app.
• If server not running, user can optionally bootstrap it and then connect.
• Errors are typed and diagnosable without exposing secrets.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
github-actions commentedon Jan 11, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if this specific SSH tunnel + bootstrap implementation addresses your needs differently than these proposals.
Faqahat commentedon Feb 20, 2026
i would love to have this
dhruvkej9 commentedon Mar 20, 2026
@adamdotdevin @rekram1-node We need this, like Vscode has SSH connection support similar to it
jh804 commentedon Apr 4, 2026
This is urgent please.
jeet-nidana commentedon Apr 15, 2026
+1 on this — the lack of a native remote-attach flow in the desktop app is the main thing keeping me on the web UI.
My setup: opencode running on a remote VM (where the code, secrets, and long-running processes live), accessed from macOS. Today my only options are:
opencode serve— works, but I lose the native app polish (window management, system shortcuts, notifications).ssh -Lport-forward — the desktop app has no UI to point atlocalhost:<forwarded-port>, so this dies at the last mile.What would make this great:
user@host) + remote opencode port, sets up the local forward, and attaches the UI to it.~/.ssh/configfor hostnames, jump hosts, and identity files so existing SSH setups Just Work.The architecture already supports this (the OpenAPI server + mobile/web clients prove the split is clean) — it's really just the desktop client missing the remote-target picker. This would close the gap with VS Code Remote / Cursor SSH and unlock opencode for anyone whose dev environment isn't their laptop (GPU boxes, regulated VPCs, shared team VMs).
Happy to test a beta build if it helps.
dhruvkej9 commentedon Apr 15, 2026
@thdxr can we get this?
sebslight commentedon Apr 21, 2026
This would be a big differentiator
p-pl commentedon Apr 23, 2026
+1 on this
YuyueminAustin commentedon Apr 25, 2026
codex already implemented this, though quite buggy. I would appreciate if opencode provide similar functions.
disarticulate commentedon Apr 25, 2026
with vscode and the opencode plugin, this already happens.
dhruvkej9 commentedon Apr 26, 2026
So how will my local opencode config automatically sync with the SSH? (The auth as well)
ChuanqiXu9 commentedon May 13, 2026
I just found openchamber can solve this need perfectly for me. It can support SSH with OpenCode.
snez commentedon May 15, 2026
Hey, I had a similar use case and I built a plugin for it. It opens a persisting ssh connection and proxies all opencode bash commands through it.
Plugin and instructions at https://github.com/snez/opencode-ssh
kahme247 commentedon May 19, 2026
we need this
oe3gwu commentedon Jul 17, 2026
This would be HUGE!
suxiaogang223 commentedon Jul 19, 2026
Hey, I’m interested in helping with this. I noticed the issue is assigned, but there isn’t a linked PR yet. Is anyone actively working on it?
I’d be happy to take a small first pass focused on using the system
sshbinary to manage a tunnel to an existing OpenCode server, while reusing the app’s current “Add server” flow. Things like remote bootstrap, saved profiles, and auto-reconnect could stay out of the first PR.Would that be a useful direction?
cyberxsboy commentedon Aug 24, 2026
You've got it backwards! What we really need is for OpenCode on the local machine to connect to the server via SSH and allow us to write or modify code directly within a specific project directory on the server.
thelittleerik commentedon Aug 24, 2026
I suspect you already are aware of the feature /attach ?
snez commentedon Aug 24, 2026
@thelittleerik the --attach CLI parameter connects the client to an OC server running on the remote machine. @cyberxsboy what you are looking for is at https://github.com/snez/opencode-ssh
neriousy commentedon Oct 1, 2026
OpenCode Desktop v2 can connect to a remote machine over SSH. Open the command palette and choose Add SSH server, or go to the server settings and pick + Add server → Add SSH server. Hosts from
~/.ssh/configcan be selected. Desktop installs a matching OpenCode CLI on the remote host (under~/.opencode/desktop-ssh/<version>) and tunnels to it, so sessions run on the remote machine and its files.Added in #47753.
Closing as completed. If something doesn't work on v2, please open a new issue.