CLI --chrome flag does not connect to native host socket

Resolved 💬 6 comments Opened Mar 23, 2026 by ChickenBreast-ky Closed Jun 7, 2026

Bug Description

When running claude --chrome, the CLI correctly enables the mcp__claude-in-chrome__* tools, but never connects to the native host Unix socket. All MCP tool calls return "Browser extension is not connected."

Environment

  • Claude Code: 2.1.81
  • Chrome extension: Claude v1.0.63 (ID: fcoeoabgfenejglbffodgkkbkcdhcgfn)
  • macOS 25.3.0 (Apple Silicon)
  • Chrome: 146.0.7680.81

Steps to Reproduce

  1. Install Claude Chrome extension, log in
  2. Open Chrome side panel (Claude icon)
  3. Run claude --chrome in terminal
  4. Call any mcp__claude-in-chrome__* tool (e.g., tabs_context_mcp)

Expected: Tool returns tab information
Actual: "Browser extension is not connected"

Diagnosis

Through extensive testing, we confirmed:

  1. Chrome extension <-> Native host: WORKS
  • chrome.runtime.connectNative("com.anthropic.claude_code_browser_extension") succeeds
  • Ping/pong handshake works
  • get_status returns {"type":"status_response","native_host_version":"1.0.0"}
  1. Native host socket: EXISTS and WORKS
  • Socket created at /tmp/claude-mcp-browser-bridge-{user}/{pid}.sock
  • Uses Chrome native messaging protocol (4-byte LE length prefix + JSON)
  • Manually sending {"method":"execute_tool","params":{"tool":"tabs_context_mcp","args":{"createIfEmpty":true}}} returns correct tab data
  1. CLI <-> Socket: NEVER CONNECTS
  • lsof -p {cli_pid} shows no connection to the bridge socket
  • The CLI process has --chrome flag confirmed via ps aux
  • Socket is accessible (manual Python connection works)

Workaround

Direct socket communication via Python script works perfectly. We wrote a bridge script that connects to the native host socket and executes tools:

sock.connect('/tmp/claude-mcp-browser-bridge-{user}/{pid}.sock')
send_msg(sock, {"method": "execute_tool", "params": {"tool": "tabs_context_mcp", "args": {}}})
# Returns correct response

Additional Context

  • Also encountered native messaging host config file conflict: com.anthropic.claude_browser_extension.json (Desktop) vs com.anthropic.claude_code_browser_extension.json (CLI). Both files existed, and Chrome's extension tries Desktop first by alphabetical order. This was resolved by pointing both files to the CLI native host path.
  • The extension's service worker code in service-worker.ts-Cx-yMGFD.js shows it tries both native host names in order: Desktop first, then Claude Code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗