Chrome MCP: no recovery when native messaging port dies mid-session
Resolved 💬 2 comments Opened Mar 17, 2026 by DCLAW Closed Apr 16, 2026
Problem
The Chrome browser automation (Claude-in-Chrome MCP) has no reconnect mechanism when the native messaging port between the extension and Claude Code dies mid-session. Once broken, the only recovery is starting an entirely new Claude Code session.
Observed Behavior
tabs_context_mcpandtabs_create_mcpcontinue to work (they use Chrome'schrome.tabsextension API directly)- All per-tab commands (
read_page,computer,navigate,screenshot) fail with "No tab available" - Creating new tabs doesn't help — even freshly-created tabs get "No tab available"
- Toggling the extension off/on in
chrome://extensionsdoesn't help - Clicking the extension icon doesn't help
Root Cause
Chrome native messaging spawns a new host process each time the extension establishes a connection. When the connection dies:
- The current Claude Code session's MCP client is still bound to the old (dead) native host process
- Toggling the extension makes Chrome spawn a fresh native host, but the current session's MCP client doesn't know about it
- Result: two disconnected sides — extension talks to a new host, Claude Code talks to a dead one
Chrome Extension Console Errors
Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist.
Unchecked runtime.lastError: Debugger is not attached to the tab with id: XXXXXX
Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received
Executing inline script violates the following Content Security Policy directive 'script-src self'...
The CSP errors originate from sidepanel.html — the extension's own inline <script> for dark mode detection is blocked by Manifest V3 CSP.
What Triggers the Break
- Long idle time between browser commands (service worker sleeps, port dies)
- Vite HMR / dev server hot reloads
- Manual interaction with the controlled tab
- Unknown — sometimes it just breaks
Requested Fix
- MCP client reconnect mechanism — detect when the native messaging port is dead and re-establish the connection without requiring a new session
- Better error message — "No tab available" is misleading. The tab IS available (proven by
tabs_context_mcp). The error should say something like "Native messaging disconnected — reconnecting..." or at minimum "Browser connection lost" - Heartbeat/keepalive — periodic ping to detect and recover from broken ports before the user hits a failure
Environment
- Claude Code: 2.1.76
- macOS Darwin 25.4.0
- Chrome with Claude browser extension
- Two native messaging hosts registered:
com.anthropic.claude_browser_extension(Claude Desktop) andcom.anthropic.claude_code_browser_extension(Claude Code CLI)
Workaround
Start a new Claude Code session. This is the only thing that works — it initializes a fresh MCP client that properly handshakes with Chrome's native messaging.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗