Claude in Chrome: Extension connects to Claude.app native host instead of Claude Code
Bug Description
When both Claude.app (desktop app) and Claude Code are installed, the Chrome extension always connects to Claude.app's native messaging host instead of Claude Code's, even when Claude Code initiates the browser automation.
Root Cause Analysis
After investigation, I found the root cause in the extension's service worker (service-worker.ts-qgEiMtH4.js):
const s=[
{name:"com.anthropic.claude_browser_extension",label:"Desktop"},
{name:"com.anthropic.claude_code_browser_extension",label:"Claude Code"}
];
for(const n of s) try {
const a=chrome.runtime.connectNative(n.name);
// ... ping test ...
// If successful, keeps this connection and breaks loop
}
The extension tries native hosts in a hardcoded order:
com.anthropic.claude_browser_extension(Claude.app) - first prioritycom.anthropic.claude_code_browser_extension(Claude Code) - second priority
If Claude.app's native host responds to the ping, it's used and Claude Code's host is never tried.
Environment
- Claude Code version: 2.1.15
- Chrome Extension version: 1.0.40
- OS: macOS Darwin 25.2.0
- Browser: Google Chrome
Steps to Reproduce
- Have both Claude.app and Claude Code installed
- Run Claude Code with
--chromeflag - Try to use browser automation tools (e.g.,
tabs_context_mcp) - Observe that Claude.app's native host (
/Applications/Claude.app/Contents/Helpers/chrome-native-host) is invoked instead of Claude Code's (~/.claude/chrome/chrome-native-host)
Evidence
Running ps aux | grep chrome-native-host shows:
/Applications/Claude.app/Contents/Helpers/chrome-native-host chrome-extension://fcoeoabgfenejglbffodgkkbkcdhcgfn/
Claude Code's native host is never invoked, so the socket file for MCP communication is never created.
Workaround Attempted
Renaming Claude.app's manifest:
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.backup"
This doesn't fully resolve the issue as Chrome may need to be restarted, and it breaks Claude.app's browser integration.
Suggested Fix
The extension should:
- Allow users to choose which native host to use in settings, OR
- Detect which Claude process (Claude.app or Claude Code) initiated the browser session and connect to the appropriate host, OR
- Reverse the priority order (try Claude Code first, then Claude.app), OR
- Allow passing a parameter/environment variable to indicate preference
Impact
Users who have both Claude.app and Claude Code installed cannot use Claude Code's browser automation features.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗