ACP/Extension openExternalUrl silently fails — OAuth flows broken for tools running in code-server terminal
Summary
When CLI tools running inside a code-server terminal session use the ACP (Agent Communication Protocol) openExternalUrl capability to open an OAuth authorization URL in the user's browser, the request is silently dropped. No browser window opens, no error is returned to the caller, and no fallback mechanism is provided.
This breaks OAuth authentication for any MCP (Model Context Protocol) server that requires browser-based login, including:
- Atlassian Rovo MCP
- Cloudflare MCP
- Any OAuth 2.0 PKCE flow relying on localhost callback
Environment
- code-server: accessed via HTTPS reverse proxy (e.g.,
https://code.example.com)
- Host OS: Linux (Ubuntu)
- Client: macOS browser (Safari/Chrome)
- Tool: Kiro CLI 2.16.2 running in code-server's integrated terminal
- Protocol: ACP with
openExternalUrl capability negotiated successfully
Reproduction Steps
- Access code-server from a browser on macOS
- Open integrated terminal
- Run
kiro-cli chat
- Kiro negotiates ACP capabilities including
openExternalUrl: true
- Configure an OAuth-based MCP server (e.g., Atlassian)
- Trigger authentication — Kiro sends
_kiro/openExternalUrl with the OAuth URL
- Nothing happens — no browser opens, no error surfaces
Expected Behavior
One of:
- code-server forwards the
openExternalUrl request to the client browser and opens the URL in a new tab
- If opening is not possible, code-server returns an error/rejection so the calling tool can fall back (e.g., print the URL for manual copy)
- code-server provides a notification/toast with the URL that the user can click
Actual Behavior
- The ACP capability
openExternalUrl is advertised as supported during handshake
- The actual
openExternalUrl request is received but silently dropped
- No browser opens on the client machine
- No error is returned to the requesting tool
- The tool (Kiro) waits for an OAuth callback that never arrives, eventually timing out
Analysis
code-server's integrated terminal runs on the remote host. When a tool calls openExternalUrl, there are two issues:
- No browser on remote: The remote Linux host typically has no display server or browser.
xdg-open or equivalent fails silently.
- No forwarding to client: Unlike VS Code Remote SSH (which forwards
vscode.env.openExternal to the local VS Code instance), code-server does not appear to relay external URL open requests to the connected browser client.
The VSCODE_PROXY_URI environment variable is set (e.g., https://code.example.com/proxy/{{port}}/), but this only handles port forwarding for HTTP services, not arbitrary URL opening.
Suggested Solutions
- Implement client-side URL forwarding: When
openExternal / openExternalUrl is called, relay the request via WebSocket to the connected browser and open it in a new tab using window.open().
- Return an error when forwarding is unavailable: Instead of silently dropping the request, return a rejection so tools can implement fallback behavior (displaying the URL for manual copy).
- Show a notification: Display a toast/notification in the code-server UI with the URL as a clickable link, similar to how VS Code shows "open in browser" prompts for forwarded ports.
Impact
This affects any tool, extension, or CLI application running in code-server's terminal that needs to open a URL in the user's browser. OAuth flows for MCP servers are a prominent use case, but this also affects:
- Git credential helpers with browser-based auth
- Cloud CLI login flows (e.g.,
gcloud auth login, aws sso login)
- Any tool using
xdg-open or equivalent
Workaround
For OAuth specifically with fixed localhost callbacks:
- Configure the tool to use a fixed callback port
- Set up SSH local port forwarding from the client machine to the remote host
- Manually obtain and open the authorization URL (requires tool-specific patching or log inspection)
See related Kiro CLI issue for detailed workaround steps.
Labels
bug, feature-request, terminal, oauth, remote
ACP/Extension
openExternalUrlsilently fails — OAuth flows broken for tools running in code-server terminalSummary
When CLI tools running inside a code-server terminal session use the ACP (Agent Communication Protocol)
openExternalUrlcapability to open an OAuth authorization URL in the user's browser, the request is silently dropped. No browser window opens, no error is returned to the caller, and no fallback mechanism is provided.This breaks OAuth authentication for any MCP (Model Context Protocol) server that requires browser-based login, including:
Environment
https://code.example.com)openExternalUrlcapability negotiated successfullyReproduction Steps
kiro-cli chatopenExternalUrl: true_kiro/openExternalUrlwith the OAuth URLExpected Behavior
One of:
openExternalUrlrequest to the client browser and opens the URL in a new tabActual Behavior
openExternalUrlis advertised as supported during handshakeopenExternalUrlrequest is received but silently droppedAnalysis
code-server's integrated terminal runs on the remote host. When a tool calls
openExternalUrl, there are two issues:xdg-openor equivalent fails silently.vscode.env.openExternalto the local VS Code instance), code-server does not appear to relay external URL open requests to the connected browser client.The
VSCODE_PROXY_URIenvironment variable is set (e.g.,https://code.example.com/proxy/{{port}}/), but this only handles port forwarding for HTTP services, not arbitrary URL opening.Suggested Solutions
openExternal/openExternalUrlis called, relay the request via WebSocket to the connected browser and open it in a new tab usingwindow.open().Impact
This affects any tool, extension, or CLI application running in code-server's terminal that needs to open a URL in the user's browser. OAuth flows for MCP servers are a prominent use case, but this also affects:
gcloud auth login,aws sso login)xdg-openor equivalentWorkaround
For OAuth specifically with fixed localhost callbacks:
See related Kiro CLI issue for detailed workaround steps.
Labels
bug,feature-request,terminal,oauth,remote