claude-code - 💡(How to fix) Fix [BUG] Claude Agent View: localhost URLs returned by tools are not surfaced as previews / no browser handoff

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

In Claude Agent View (cloud-hosted background sessions on claude.ai), when an MCP tool or subprocess invokes webbrowser.open() or surfaces a http://localhost:<port>/ URL, no browser is opened and the URL is not previewed inline. The URL appears as plain text in chat, but is unreachable from the user's machine because the server is bound to the agent sandbox's loopback interface.

This makes any tool that depends on a local rendered page effectively unusable in Agent View. Examples: streamlit run, matplotlib plt.show(), Jupyter kernel launchers, any "render and open in browser" affordance.

Root Cause

In Claude Agent View (cloud-hosted background sessions on claude.ai), when an MCP tool or subprocess invokes webbrowser.open() or surfaces a http://localhost:<port>/ URL, no browser is opened and the URL is not previewed inline. The URL appears as plain text in chat, but is unreachable from the user's machine because the server is bound to the agent sandbox's loopback interface.

RAW_BUFFERClick to expand / collapse

Summary

In Claude Agent View (cloud-hosted background sessions on claude.ai), when an MCP tool or subprocess invokes webbrowser.open() or surfaces a http://localhost:<port>/ URL, no browser is opened and the URL is not previewed inline. The URL appears as plain text in chat, but is unreachable from the user's machine because the server is bound to the agent sandbox's loopback interface.

This makes any tool that depends on a local rendered page effectively unusable in Agent View. Examples: streamlit run, matplotlib plt.show(), Jupyter kernel launchers, any "render and open in browser" affordance.

Repro

  1. Run a background session in Claude Agent View.
  2. Invoke any tool that opens a localhost URL via webbrowser.open("http://localhost:<port>/").
  3. Tool stdout reports the URL; agent surfaces it in chat.

Expected: URL is auto-previewed inline (like the desktop app's Preview pane), or there is a clickable affordance to open it.

Actual: Nothing visible happens. The URL is plain text. Copy-pasting into a local browser fails because 127.0.0.1:<port> inside the agent sandbox is not reachable from the user's machine.

Why it matters

  • Many local renderers ship with a "render then open in browser" contract. These are silently broken in Agent View today.
  • Background sessions are otherwise ideal for long-running render workflows, but the missing browser handoff defeats the loop.

Related issues

  • #57253 PreviewContext blocks localhost URLs (desktop app) - related but desktop-specific
  • #46228 Background subagents OAuth limitations - related background-session gap
  • #47195 Preview should allow localhost subdomains

Suggested directions

  • Auto-render localhost URLs in agent message output via the Agent View UI's preview pane (parity with desktop app behaviour).
  • Or: introduce a "render artifact" tool result type (HTML / image / iframe) so MCP tools can return inline-displayable payloads instead of relying on a side-channel browser.
  • Or: tunnel the agent sandbox's localhost ports back to the user's browser session (Cloudflare-tunnel-style relay).

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Claude Agent View: localhost URLs returned by tools are not surfaced as previews / no browser handoff