opencode
opencode copied to clipboard
opencode mcp auth fails silently in remote/headless sessions (SSH, devcontainer)
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
- SSH into a remote server or use a devcontainer
- Run
opencode mcp auth <server-name> - Observe the error with no actionable information
Operating System
Linux (tested in devcontainer)
Terminal
Any