Troubleshoot Claude Browser Extension Connectivity
Fixes Claude in Chrome MCP connection failures on macOS caused by Claude.app and Claude Code fighting over the native messaging host.
Why it matters
Resolve issues where Claude's browser extension fails to connect or operates unreliably, ensuring seamless browser automation for macOS users.
Outcomes
What it gets done
Diagnose "Browser extension is not connected" errors.
Fix erratic browser automation and timeouts.
Resolve conflicts between Claude.app and Claude Code CLI native hosts.
Ensure correct native messaging host configuration.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-claude-in-chrome-troubleshooting | bash Overview
Claude in Chrome MCP Troubleshooting
Diagnoses and fixes Claude in Chrome MCP connection failures on macOS, mainly caused by Claude.app and Claude Code CLI registering conflicting native messaging hosts. Use when Claude in Chrome MCP tools report 'Browser extension is not connected' or work unreliably on macOS, especially after switching between Claude.app and Claude Code.
What it does
This skill diagnoses and fixes Claude in Chrome MCP tools that fail to connect or work unreliably on macOS. The core problem: Claude.app's Cowork feature and Claude Code CLI each register their own native messaging host with Chrome, and the two use incompatible socket formats and locations - Claude.app's chrome-native-host binary writes PID-named socket files under /tmp/claude-mcp-browser-bridge-$USER/, while Claude Code's wrapper writes a single socket file under $TMPDIR/claude-mcp-browser-bridge-$USER. Both register native messaging configs in Chrome (com.anthropic.claude_browser_extension.json for Claude.app, com.anthropic.claude_code_browser_extension.json for Claude Code); if the wrong config is active, Chrome launches the wrong binary, which creates sockets in a format the MCP client on the other side doesn't expect, producing "Browser extension is not connected" even though everything appears to be running. They cannot be used simultaneously - the fix is to disable the native messaging config for whichever tool isn't in active use, by renaming its .json config to .json.disabled.
The skill provides a chrome-mcp-toggle shell function (for ~/.zshrc) that detects which config is currently active and swaps it for the other, and a quick-diagnosis sequence covering which native host binary is running (ps aux | grep chrome-native-host), where its socket lives, what the native host process has open (lsof -U), and which Chrome native messaging configs are active. A critical insight it flags: MCP connects at startup, so if the browser bridge wasn't ready when Claude Code started, the whole session's connection fails - the standard fix is to get Chrome and the extension running with the correct config first, then restart Claude Code.
A full reset procedure for Claude Code CLI walks through disabling Claude.app's config, writing a dynamic-version wrapper script at ~/.claude/chrome/chrome-native-host that always execs the latest installed Claude Code version rather than a hardcoded one, killing the existing native host process and cleaning up stale sockets, restarting Chrome via osascript, clicking the extension icon, and verifying both the running binary and the socket file before restarting Claude Code. It also documents a longer diagnostic-deep-dive script that dumps the native host process, both possible socket locations, open files, active configs, the wrapper contents, and the TMPDIR value in one pass.
Other documented failure causes: having the Claude extension enabled in multiple Chrome profiles (each spawns its own native host and socket, causing confusion - fix by enabling it in only one profile); running multiple Claude Code sessions at once (causes socket conflicts - run one at a time, or use /mcp to reconnect); a hardcoded version string in the wrapper script going stale after a Claude Code update (fix with the dynamic $(ls -t ...)-based wrapper); and TMPDIR not being set, which the fix addresses by exporting TMPDIR="${TMPDIR:-$(getconf DARWIN_USER_TEMP_DIR)}" in the shell profile. A file reference table lists every relevant binary, config, and socket path involved.
When to use - and when NOT to
Use when mcp__claude-in-chrome__* tools fail with "Browser extension is not connected," browser automation is erratic or times out, after updating Claude Code or Claude.app, when switching between Claude Code CLI and Claude.app (Cowork), or when the native host process is running but MCP tools still fail. Do not use on Linux or Windows (this skill is macOS-specific, covering ~/Library/Application Support/ and osascript), for general Chrome automation issues unrelated to the Claude extension, for Claude.app desktop issues unrelated to the browser, for network connectivity problems, or for Chrome extension installation issues (use Chrome Web Store support instead).
Inputs and outputs
Input is a macOS system with Chrome, the Claude browser extension, and either Claude.app or Claude Code CLI (or both, conflicting) installed. Output is a working native-messaging connection: the correct config active, the correct native host binary running, a valid socket in the expected location, and MCP tools reconnected after a Chrome/Claude Code restart.
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.disabled
Integrations
Google Chrome's native messaging host system, Claude.app (Cowork), Claude Code CLI, and macOS tools osascript, lsof, pgrep, and getconf.
Who it's for
macOS users running both Claude.app and Claude Code CLI who hit "Browser extension is not connected" or unreliable browser automation because the two apps' native messaging hosts are fighting over the Chrome extension.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.