Skip to content

MCP OAuth: wrapped authorization URL is not clickable / hyperlinked in terminal #3470

@BZ-D

Description

@BZ-D

Description

When qwen-code initiates an MCP OAuth flow, the CLI prints the authorization URL that the user needs to open in a browser. If the URL is long enough to exceed the terminal width, it wraps across multiple lines. When that happens, most terminal emulators fail to detect it as a single hyperlink, so:

  • The URL is not rendered as a clickable link (cmd/ctrl+click does nothing, or only opens a truncated fragment).
  • Selecting it with the mouse copies extra whitespace / line breaks and produces a broken URL.

The recently added "press c to copy" shortcut helps, but the URL still isn't directly clickable, which is the most natural interaction on modern terminals (iTerm2, WezTerm, Kitty, Windows Terminal, VS Code integrated terminal, etc.).

Steps to reproduce

  1. Configure an MCP server that requires OAuth (any provider whose authorization URL is long, e.g. includes client_id, redirect_uri, scope, state, code_challenge, etc.).
  2. Run qwen-code and trigger the OAuth flow.
  3. Observe the printed authorization URL in a terminal narrower than the URL length.

Expected behavior

The authorization URL should be clickable regardless of terminal width. Common approaches:

  • Emit the URL as an OSC 8 hyperlink (\x1b]8;;URL\x1b\\text\x1b]8;;\x1b\\) so terminals that support OSC 8 render it as a single clickable link even when it visually wraps.
  • Avoid inserting hard line breaks inside the URL string itself; let the terminal wrap the raw characters, or print the URL on its own line without any wrapping logic.
  • Optionally keep the c to copy affordance as a fallback for terminals without OSC 8 / clickable URL support.

Actual behavior

The URL wraps with hard newlines (or is split by the renderer) and is no longer recognized as a clickable link by the terminal.

Environment

  • qwen-code version: (please fill in)
  • OS / terminal: (please fill in — reproduces across multiple terminals that otherwise support clickable URLs)

Additional context

Related existing UX: the c shortcut to copy the URL is useful, but it's a workaround rather than a fix for the hyperlink detection problem.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions