opencode icon indicating copy to clipboard operation
opencode copied to clipboard

opencode mcp auth fails silently in remote/headless sessions (SSH, devcontainer)

Open danlapid opened this issue 4 days ago • 3 comments

Description

When running opencode mcp auth in a remote or headless environment (SSH, devcontainer, WSL without display), the command fails with a cryptic "Something went wrong" error because it cannot open a browser.

The open package tries to launch xdg-open (on Linux) which either:

  • Doesn't exist (ENOENT error)
  • Exists but fails because there's no display server

In both cases, the user has no way to complete the OAuth flow because the authorization URL is not shown.

Expected Behavior

When browser opening fails, the authorization URL should be displayed so users can manually copy it and open it in a browser on their local machine.

Actual Behavior

$ opencode mcp auth jira --log-level DEBUG --print-logs true
...
INFO  opening browser for oauth
▲  Something went wrong
ERROR e=Executable not found in $PATH: "xdg-open" exception

OpenCode version

1.1.8

Steps to reproduce

  1. SSH into a remote server or use a devcontainer
  2. Run opencode mcp auth <server-name>
  3. Observe the error with no actionable information

Operating System

Linux (tested in devcontainer)

Terminal

Any

danlapid avatar Jan 11 '26 23:01 danlapid