Skip to content

[FEATURE]: SSH-based remote server connections to OpenCode Desktop #7790

Closed

Description

@dl-alexandre

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.

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Jan 11, 2026
  2. github-actions commented on Jan 11, 2026

    @github-actions
    Contributor

    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.

  3. Faqahat commented on Feb 20, 2026

    @Faqahat

    i would love to have this

  4. dhruvkej9 commented on Mar 20, 2026

    @dhruvkej9

    @adamdotdevin @rekram1-node We need this, like Vscode has SSH connection support similar to it

  5. jh804 commented on Apr 4, 2026

    @jh804

    This is urgent please.

  6. jeet-nidana commented on Apr 15, 2026

    @jeet-nidana

    +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:

    1. Web UI via opencode serve — works, but I lose the native app polish (window management, system shortcuts, notifications).
    2. SSH + TUI in a terminal — fine, but then I'm not using the desktop app at all.
    3. Manual ssh -L port-forward — the desktop app has no UI to point at localhost:<forwarded-port>, so this dies at the last mile.

    What would make this great:

    • A "Connect to remote server" entry in the desktop app that takes an SSH target (user@host) + remote opencode port, sets up the local forward, and attaches the UI to it.
    • Bonus: saved connection profiles, auto-reconnect on network blips, and a clear indicator of which server the current window is attached to (local vs. remote-X).
    • Bonus: respect ~/.ssh/config for 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.

  7. dhruvkej9 commented on Apr 15, 2026

    @dhruvkej9

    +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:

    1. Web UI via opencode serve — works, but I lose the native app polish (window management, system shortcuts, notifications).
    2. SSH + TUI in a terminal — fine, but then I'm not using the desktop app at all.
    3. Manual ssh -L port-forward — the desktop app has no UI to point at localhost:<forwarded-port>, so this dies at the last mile.

    What would make this great:

    • A "Connect to remote server" entry in the desktop app that takes an SSH target (user@host) + remote opencode port, sets up the local forward, and attaches the UI to it.
    • Bonus: saved connection profiles, auto-reconnect on network blips, and a clear indicator of which server the current window is attached to (local vs. remote-X).
    • Bonus: respect ~/.ssh/config for 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.

    @thdxr can we get this?

  8. sebslight commented on Apr 21, 2026

    @sebslight

    This would be a big differentiator

  9. p-pl commented on Apr 23, 2026

    @p-pl

    +1 on this

  10. YuyueminAustin commented on Apr 25, 2026

    @YuyueminAustin

    codex already implemented this, though quite buggy. I would appreciate if opencode provide similar functions.

  11. disarticulate commented on Apr 25, 2026

    @disarticulate

    with vscode and the opencode plugin, this already happens.

  12. dhruvkej9 commented on Apr 26, 2026

    @dhruvkej9

    with vscode and the opencode plugin, this already happens.

    So how will my local opencode config automatically sync with the SSH? (The auth as well)

  13. removed
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    webRelates to opencode on web / desktop
    on May 3, 2026
  14. ChuanqiXu9 commented on May 13, 2026

    @ChuanqiXu9

    I just found openchamber can solve this need perfectly for me. It can support SSH with OpenCode.

  15. snez commented on May 15, 2026

    @snez

    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

  16. kahme247 commented on May 19, 2026

    @kahme247

    we need this

  17. oe3gwu commented on Jul 17, 2026

    @oe3gwu

    This would be HUGE!

  18. suxiaogang223 commented on Jul 19, 2026

    @suxiaogang223

    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 ssh binary 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?

  19. cyberxsboy commented on Aug 24, 2026

    @cyberxsboy

    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.

  20. thelittleerik commented on Aug 24, 2026

    @thelittleerik

    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.

    I suspect you already are aware of the feature /attach ?

  21. snez commented on Aug 24, 2026

    @snez

    @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

  22. neriousy commented on Oct 1, 2026

    @neriousy
    Member

    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/config can 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions