You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opencode mcp auth does not print authorize URL to terminal, making it unusable over SSH #23951
When running opencode mcp auth <server> in a headless / SSH environment where no browser can be launched on the host, the CLI shows only a spinner (Starting OAuth flow...) and never prints the authorization URL to stdout. The URL is only written to the log file at ~/.local/share/opencode/log/*.log.
This makes OAuth-based MCP authentication effectively unusable over SSH without either:
Grepping the log file manually to extract the URL, or
Knowing in advance to set up an SSH port-forward for 127.0.0.1:19876.
What happened
Ran opencode mcp auth atlassian over an SSH session. The CLI showed:
...and hung indefinitely. No URL was printed. The browser-open attempt silently failed because the remote host has no browser / DISPLAY.
I only recovered the URL by grepping the OpenCode log file:
grep "opening browser for oauth"~/.local/share/opencode/log/*.log | tail -1
which revealed the authorize URL. After setting up an SSH tunnel from my local machine:
ssh -L 19876:127.0.0.1:19876 user@remote
pasting the URL in my local browser, and completing the Atlassian consent, the callback succeeded and tokens were stored correctly.
Expected behavior
Print the authorize URL to stdout so the user can copy it into a local browser. Other tools (e.g. gh auth login, flyctl auth login, Claude Code) handle this by always printing the URL to the terminal as a fallback when xdg-open / open fails — or simply by default.
Optionally, detect headless environments ($SSH_CONNECTION set, no $DISPLAY) and skip the browser-open attempt entirely.
Suggested fix
Unconditionally print the authorize URL to stdout in addition to attempting to open the browser. One-line change, makes the flow work everywhere.
Plugins
None (default install)
OpenCode version
1.14.21
Steps to reproduce
SSH into a remote host with no browser / no DISPLAY set.
Run opencode mcp auth atlassian (or any OAuth-enabled MCP server).
Observe: spinner only, no URL printed. Command hangs.
(Workaround) In a second SSH session, run grep "opening browser for oauth" ~/.local/share/opencode/log/*.log | tail -1 to recover the URL.
Screenshot and/or share link
n/a
Operating System
Ubuntu 24.04 (remote host, accessed over SSH from Windows 11)
Terminal
Windows Terminal (client) -> OpenSSH -> bash on Ubuntu (remote)
Reacted by LufyCZ, Alan Liu, Evan Goode and Sahib Bhai
Activity
stefanotorresi commentedon May 12, 2026
this also happens to me in a normal WSL2 session on Windows Terminal, no remote ssh.