[PR #7884] fix(mcp): show auth URL when browser cannot open in remote sessions #12551

Closed
opened 2026-02-16 18:17:27 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7884

State: closed
Merged: Yes


When running opencode mcp auth in headless environments (SSH, devcontainers, WSL), the browser cannot be opened automatically. Previously this would fail with a cryptic "Something went wrong" error. Now the auth URL is displayed so users can manually open it in their local browser.

The fix catches three failure modes from the open package:

  • Synchronous exception: thrown when open() itself fails
  • "error" event: fires when the command doesn't exist (ENOENT)
  • "exit" event with non-zero code: fires when the command exists but fails (e.g., xdg-open can't connect to a display server)

What does this PR do?

Description above.

How did you verify your code works?

I tested this on my vscode devcontainer that was initially having this issue.

Fixes https://github.com/anomalyco/opencode/issues/7887

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7884 **State:** closed **Merged:** Yes --- When running `opencode mcp auth` in headless environments (SSH, devcontainers, WSL), the browser cannot be opened automatically. Previously this would fail with a cryptic "Something went wrong" error. Now the auth URL is displayed so users can manually open it in their local browser. The fix catches three failure modes from the `open` package: - Synchronous exception: thrown when open() itself fails - "error" event: fires when the command doesn't exist (ENOENT) - "exit" event with non-zero code: fires when the command exists but fails (e.g., xdg-open can't connect to a display server) ### What does this PR do? Description above. ### How did you verify your code works? I tested this on my vscode devcontainer that was initially having this issue. Fixes https://github.com/anomalyco/opencode/issues/7887
yindo added the pull-request label 2026-02-16 18:17:27 -05:00
yindo closed this issue 2026-02-16 18:17:27 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12551