claude-code - 💡(How to fix) Fix --chrome flag: MCP client never connects to Chrome native host socket [1 comments, 2 participants]

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…
GitHub stats
anthropics/claude-code#47202Fetched 2026-04-14 05:55:27
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
1
Author
Timeline (top)
labeled ×5commented ×1

Root Cause

Root Cause (diagnosed)

Code Example

# Direct socket test (length-prefixed protocol)
send({"method": "execute_tool", "params": {"tool": "tabs_context_mcp", "args": {"createIfEmpty": true}}})
# Response: {"result": {"content": [{"type": "text", "text": "{\"availableTabs\":[...]}"}]}}
RAW_BUFFERClick to expand / collapse

Environment

  • Claude Code 2.1.104
  • macOS Darwin 25.3.0 (Apple Silicon)
  • Chrome extension v1.0.66 (ID: fcoeoabgfenejglbffodgkkbkcdhcgfn)

Symptom

All mcp__claude-in-chrome__* tool calls return "Browser extension is not connected", despite the Chrome extension being fully functional.

Root Cause (diagnosed)

Claude Code with --chrome registers Chrome MCP tools but never opens a connection to the native host socket. Verified via lsof -p <pid>: zero connections to /tmp/claude-mcp-browser-bridge-<user>/*.sock.

Evidence that Chrome side works correctly

  1. Chrome spawns native host successfully (parent PID = Chrome)
  2. Native host creates socket at /tmp/claude-mcp-browser-bridge-kc/<pid>.sock
  3. Manual execute_tool call via the socket returns valid results:
# Direct socket test (length-prefixed protocol)
send({"method": "execute_tool", "params": {"tool": "tabs_context_mcp", "args": {"createIfEmpty": true}}})
# Response: {"result": {"content": [{"type": "text", "text": "{\"availableTabs\":[...]}"}]}}
  1. Console errors: zero

Repro steps

  1. claude --chrome (or claude --dangerously-skip-permissions --chrome)
  2. Open Chrome with Claude extension enabled and side panel open
  3. Confirm native host is running: pgrep -fl chrome-native-host → shows process with Chrome as parent
  4. Confirm socket exists: ls /tmp/claude-mcp-browser-bridge-$USER/ → shows <pid>.sock
  5. Call any mcp__claude-in-chrome__* tool → returns "Browser extension is not connected"
  6. lsof -p <claude-pid> | grep bridgeempty (no socket connection from Claude Code)
  7. Meanwhile, manual socket connection via Python works perfectly (see evidence above)

Additional context

  • Native host config files are correctly placed in ~/Library/Application Support/Google/Chrome/NativeMessagingHosts/
  • Both com.anthropic.claude_browser_extension.json and com.anthropic.claude_code_browser_extension.json exist with correct paths
  • Native host responds correctly to Chrome's ping/pong handshake (verified via manual length-prefixed stdin test)
  • The issue persists across session restarts, Chrome restarts, and killing/restarting the native host process

extent analysis

TL;DR

The issue is likely due to Claude Code not establishing a connection to the native host socket, and a potential fix involves ensuring the socket connection is properly initialized.

Guidance

  • Verify that the --chrome flag is correctly registering the Chrome MCP tools and that the native host socket is created at the expected location (/tmp/claude-mcp-browser-bridge-<user>/*.sock).
  • Check the Claude Code configuration to ensure it is set up to connect to the native host socket, and consider adding logging or debugging statements to confirm the connection attempt.
  • Review the native host configuration files (com.anthropic.claude_browser_extension.json and com.anthropic.claude_code_browser_extension.json) to ensure they contain the correct paths and settings.
  • Attempt to establish a manual connection to the native host socket using a tool like socat or nc to verify that the socket is listening and responding correctly.

Example

import socket

# Attempt to connect to the native host socket
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect('/tmp/claude-mcp-browser-bridge-kc/<pid>.sock')

Notes

The issue appears to be specific to the Claude Code and Chrome extension interaction, and further debugging may be required to determine the root cause. The provided evidence suggests that the Chrome extension and native host are functioning correctly, but the Claude Code is not establishing a connection to the native host socket.

Recommendation

Apply a workaround by manually establishing a connection to the native host socket using a tool like socat or nc, or by modifying the Claude Code to properly initialize the socket connection. This will allow for further debugging and testing to determine the root cause of the issue.

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