6# Claude in Chrome MCP Troubleshooting
7
8Use this skill when Claude in Chrome MCP tools fail to connect or work unreliably.
9
10## When to Use
11
12- mcp__claude-in-chrome__* tools fail with "Browser extension is not connected"
13- Browser automation works erratically or times out
14- After updating Claude Code or Claude.app
15- When switching between Claude Code CLI and Claude.app (Cowork)
16- Native host process is running but MCP tools still fail
17
18## When NOT to Use
19
20- **Linux or Windows users** - This skill covers macOS-specific paths and tools (~/Library/Application Support/, osascript)
21- General Chrome automation issues unrelated to the Claude extension
22- Claude.app desktop issues (not browser-related)
23- Network connectivity problems
24- Chrome extension installation issues (use Chrome Web Store support)
25
26## The Claude.app vs Claude Code Conflict (Primary Issue)
27
28**Background:** When Claude.app added Cowork support (browser automation from the desktop app), it introduced a competing native messaging host that conflicts with Claude Code CLI.
29
30### Two Native Hosts, Two Socket Formats
31
32| Component | Native Host Binary | Socket Location |
33|-----------|-------------------|-----------------|
34| **Claude.app (Cowork)** | /Applications/Claude.app/Contents/Helpers/chrome-native-host | /tmp/claude-mcp-browser-bridge-$USER/<PID>.sock |
35| **Claude Code CLI** | ~/.local/share/claude/versions/<version> --chrome-native-host | $TMPDIR/claude-mcp-browser-bridge-$USER (single file) |
36
37### Why They Conflict
38
391. Both register native messaging configs in Chrome:
40 - com.anthropic.claude_browser_extension.json → Claude.app helper
41 - com.anthropic.claude_code_browser_extension.json → Claude Code wrapper
42
432. Chrome extension requests a native host by name
443. If the wrong config is active, the wrong binary runs
454. The wrong binary creates sockets in a format/location the MCP client doesn't expect
465. Result: "Browser extension is not connected" even though everything appears to be running
47
48### The Fix: Disable Claude.app's Native Host
49
50**If you use Claude Code CLI for browser automation (not Cowork):**
51
52```bash
53# Disable the Claude.app native messaging config
54mv ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_browser_extension.json \
55 ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_browser_extension.json.disabled
56
57# Ensure the Claude Code config exists and points to the wrapper
58cat ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_code_browser_extension.json
59```
60
61**If you use Cowork (Claude.app) for browser automation:**
62
63```bash
64# Disable the Claude Code native messaging config
65mv ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_code_browser_extension.json \
66 ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_code_browser_extension.json.disabled
67```
68
69**You cannot use both simultaneously.** Pick one and disable the other.
70
71### Toggle Script
72
73Add this to ~/.zshrc or run directly:
74
75```bash
76chrome-mcp-toggle() {
77 local CONFIG_DIR=~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts
78 local CLAUDE_APP="$CONFIG_DIR/com.anthropic.claude_browser_extension.json"
79 local CLAUDE_CODE="$CONFIG_DIR/com.anthropic.claude_code_browser_extension.json"
80
81 if [[ -f "$CLAUDE_APP" && ! -f "$CLAUDE_APP.disabled" ]]; then
82 # Currently using Claude.app, switch to Claude Code
83 mv "$CLAUDE_APP" "$CLAUDE_APP.disabled"
84 [[ -f "$CLAUDE_CODE.disabled" ]] && mv "$CLAUDE_CODE.disabled" "$CLAUDE_CODE"
85 echo "Switched to Claude Code CLI"
86 echo "Restart Chrome and Claude Code to apply"
87 elif [[ -f "$CLAUDE_CODE" && ! -f "$CLAUDE_CODE.disabled" ]]; then
88 # Currently using Claude Code, switch to Claude.app
89 mv "$CLAUDE_CODE" "$CLAUDE_CODE.disabled"
90 [[ -f "$CLAUDE_APP.disabled" ]] && mv "$CLAUDE_APP.disabled" "$CLAUDE_APP"
91 echo "Switched to Claude.app (Cowork)"
92 echo "Restart Chrome to apply"
93 else
94 echo "Current state unclear. Check configs:"
95 ls -la "$CONFIG_DIR"/com.anthropic*.json* 2>/dev/null
96 fi
97}
98```
99
100Usage: chrome-mcp-toggle then restart Chrome (and Claude Code if switching to CLI).
101
102## Quick Diagnosis
103
104```bash
105# 1. Which native host binary is running?
106ps aux | grep chrome-native-host | grep -v grep
107# Claude.app: /Applications/Claude.app/Contents/Helpers/chrome-native-host
108# Claude Code: ~/.local/share/claude/versions/X.X.X --chrome-native-host
109
110# 2. Where is the socket?
111# For Claude Code (single file in TMPDIR):
112ls -la "$(getconf DARWIN_USER_TEMP_DIR)/claude-mcp-browser-bridge-$USER" 2>&1
113
114# For Claude.app (directory with PID files):
115ls -la /tmp/claude-mcp-browser-bridge-$USER/ 2>&1
116
117# 3. What's the native host connected to?
118lsof -U 2>&1 | grep claude-mcp-browser-bridge
119
120# 4. Which configs are active?
121ls ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic*.json
122```
123
124## Critical Insight
125
126**MCP connects at startup.** If the browser bridge wasn't ready when Claude Code started, the connection will fail for the entire session. The fix is usually: ensure Chrome + extension are running with correct config, THEN restart Claude Code.
127
128## Full Reset Procedure (Claude Code CLI)
129
130```bash
131# 1. Ensure correct config is active
132mv ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_browser_extension.json \
133 ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_browser_extension.json.disabled 2>/dev/null
134
135# 2. Update the wrapper to use latest Claude Code version
136cat > ~/.claude/chrome/chrome-native-host << 'EOF'
137#!/bin/bash
138LATEST=$(ls -t ~/.local/share/claude/versions/ 2>/dev/null | head -1)
139exec "$HOME/.local/share/claude/versions/$LATEST" --chrome-native-host
140EOF
141chmod +x ~/.claude/chrome/chrome-native-host
142
143# 3. Kill existing native host and clean sockets
144pkill -f chrome-native-host
145rm -rf /tmp/claude-mcp-browser-bridge-$USER/
146rm -f "$(getconf DARWIN_USER_TEMP_DIR)/claude-mcp-browser-bridge-$USER"
147
148# 4. Restart Chrome
149osascript -e 'quit app "Google Chrome"' && sleep 2 && open -a "Google Chrome"
150
151# 5. Wait for Chrome, click Claude extension icon
152
153# 6. Verify correct native host is running
154ps aux | grep chrome-native-host | grep -v grep
155# Should show: ~/.local/share/claude/versions/X.X.X --chrome-native-host
156
157# 7. Verify socket exists
158ls -la "$(getconf DARWIN_USER_TEMP_DIR)/claude-mcp-browser-bridge-$USER"
159
160# 8. Restart Claude Code
161```
162
163## Other Common Causes
164
165### Multiple Chrome Profiles
166
167If you have the Claude extension installed in multiple Chrome profiles, each spawns its own native host and socket. This can cause confusion.
168
169**Fix:** Only enable the Claude extension in ONE Chrome profile.
170
171### Multiple Claude Code Sessions
172
173Running multiple Claude Code instances can cause socket conflicts.
174
175**Fix:** Only run one Claude Code session at a time, or use /mcp to reconnect after closing other sessions.
176
177### Hardcoded Version in Wrapper
178
179The wrapper at ~/.claude/chrome/chrome-native-host may have a hardcoded version that becomes stale after updates.
180
181**Diagnosis:**
182```bash
183cat ~/.claude/chrome/chrome-native-host
184# Bad: exec "/Users/.../.local/share/claude/versions/2.0.76" --chrome-native-host
185# Good: Uses $(ls -t ...) to find latest
186```
187
188**Fix:** Use the dynamic version wrapper shown in the Full Reset Procedure above.
189
190### TMPDIR Not Set
191
192Claude Code expects TMPDIR to be set to find the socket.
193
194```bash
195# Check
196echo $TMPDIR
197# Should show: /var/folders/XX/.../T/
198
199# Fix: Add to ~/.zshrc
200export TMPDIR="${TMPDIR:-$(getconf DARWIN_USER_TEMP_DIR)}"
201```
202
203## Diagnostic Deep Dive
204
205```bash
206echo "=== Native Host Binary ==="
207ps aux | grep chrome-native-host | grep -v grep
208
209echo -e "\n=== Socket (Claude Code location) ==="
210ls -la "$(getconf DARWIN_USER_TEMP_DIR)/claude-mcp-browser-bridge-$USER" 2>&1
211
212echo -e "\n=== Socket (Claude.app location) ==="
213ls -la /tmp/claude-mcp-browser-bridge-$USER/ 2>&1
214
215echo -e "\n=== Native Host Open Files ==="
216pgrep -f chrome-native-host | xargs -I {} lsof -p {} 2>/dev/null | grep -E "(sock|claude-mcp)"
217
218echo -e "\n=== Active Native Messaging Configs ==="
219ls ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.anthropic*.json 2>/dev/null
220
221echo -e "\n=== Custom Wrapper Contents ==="
222cat ~/.claude/chrome/chrome-native-host 2>/dev/null || echo "No custom wrapper"
223
224echo -e "\n=== TMPDIR ==="
225echo "TMPDIR=$TMPDIR"
226echo "Expected: $(getconf DARWIN_USER_TEMP_DIR)"
227```
228
229## File Reference
230
231| File | Purpose |
232|------|---------|
233| ~/.claude/chrome/chrome-native-host | Custom wrapper script for Claude Code |
234| /Applications/Claude.app/Contents/Helpers/chrome-native-host | Claude.app (Cowork) native host |
235| ~/.local/share/claude/versions/<version> | Claude Code binary (run with --chrome-native-host) |
236| ~/Library/Application Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_browser_extension.json | Config for Claude.app native host |
237| ~/Library/Application Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_code_browser_extension.json | Config for Claude Code native host |
238| $TMPDIR/claude-mcp-browser-bridge-$USER | Socket file (Claude Code) |
239| /tmp/claude-mcp-browser-bridge-$USER/<PID>.sock | Socket files (Claude.app) |
240
241## Summary
242
2431. **Primary issue:** Claude.app (Cowork) and Claude Code use different native hosts with incompatible socket formats
2442. **Fix:** Disable the native messaging config for whichever one you're NOT using
2453. **After any fix:** Must restart Chrome AND Claude Code (MCP connects at startup)
2464. **One profile:** Only have Claude extension in one Chrome profile
2475. **One session:** Only run one Claude Code instance
248
249---
250
251*Original skill by [@jeffzwang](https://github.com/jeffzwang) from [@ExaAILabs](https://github.com/ExaAILabs). Enhanced and updated for current versions of Claude Desktop and Claude Code.*
252