[Bug] Claude in Chrome fails when Claude Desktop native messaging host config exists (macOS)
Description
Claude Code CLI cannot connect to the Chrome extension when Claude Desktop's native messaging host config file
exists, even if Claude Desktop is not running. The extension sidebar works fine, but CLI's MCP tools fail with
"Browser extension is not connected."
## Environment
- Claude Code version: 2.1.17
- macOS version: 26.2
- Chrome extension version: (check yours)
- Chrome version: (check yours)
## Root Cause
Both Claude Desktop and Claude Code register native messaging host configs for the same Chrome extension ID
(fcoeoabgfenejglbffodgkkbkcdhcgfn):
- Desktop: `~/Library/Application
Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_browser_extension.json`
- Points to
/Applications/Claude.app/Contents/Helpers/chrome-native-host - Creates socket in
/tmp/claude-mcp-browser-bridge-*/
- CLI: `~/Library/Application
Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_code_browser_extension.json`
- Points to
~/.claude/chrome/chrome-native-host(wrapper script) - Creates socket in
$TMPDIR(/var/folders/.../T/claude-mcp-browser-bridge-{user})
Chrome preferentially loads Desktop's config (possibly alphabetical ordering), spawning Desktop's native host.
CLI's MCP looks for the socket in $TMPDIR, not /tmp/, so the connection fails.
## Steps to Reproduce
- Have both Claude Desktop and Claude Code installed
- Install the Claude Chrome extension
- Run
/chromein Claude Code - shows "Status: Enabled" - Try to use any
mcp__claude-in-chrome__*tool - Fails with "Browser extension is not connected"
## Diagnostic Commands
```bash
# Shows Desktop's native host running instead of CLI's
ps aux | grep chrome-native-host
# Desktop creates socket here:
ls -la /tmp/claude-mcp-browser-bridge-*/
# CLI expects socket here:
ls -la $TMPDIR/claude-mcp-browser-bridge-*
Workaround
Rename or remove the Desktop config:
mv ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_browser_extension.json \
~/Library/Application\
Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_browser_extension.json.bak
Then restart Chrome. CLI will work, but Desktop's browser control will break.
Expected Behavior
Both Claude Desktop and Claude Code should be able to coexist and control Chrome, either:
- Using separate extension IDs, or
- Using a shared native host with consistent socket location, or
- Having the MCP check both socket locations
Additional Context
The extension sidebar (within Chrome) works fine in both cases - only the external CLI/Desktop connection is
affected.This issue has 11 comments on GitHub. Read the full discussion on GitHub ↗