claude-in-chrome: connection drops after localStorage write via javascript_tool

Resolved 💬 4 comments Opened Feb 22, 2026 by myidentity Closed Feb 25, 2026

Description

The claude-in-chrome MCP connection drops specifically after writing to localStorage via the javascript_tool. Once dropped, all subsequent mcp__claude-in-chrome__* calls fail silently. The only recovery is to close Claude Code entirely and resume the session, which forces a fresh WebSocket connection.

This is distinct from general "long session" timeouts — the drop is triggered by localStorage writes, not by idle time.

Steps to Reproduce

  1. Start Claude Code with --chrome flag, Chrome extension connected
  2. Call mcp__claude-in-chrome__tabs_context_mcp — works fine
  3. Use mcp__claude-in-chrome__javascript_tool to write to localStorage:

``javascript
localStorage.setItem('test-key', JSON.stringify({data: 'value'}));
``

  1. The call may succeed, but subsequent calls to any mcp__claude-in-chrome__* tool fail with "Browser extension is not connected"
  2. The Chrome extension is still visibly active in Chrome — only the MCP WebSocket is dead

Recovery

The only way to recover is:

  1. Close Claude Code (Ctrl+C or quit)
  2. Resume the session (claude --resume or pick the session)
  3. This establishes a fresh WebSocket connection
  4. Chrome tools work again until the next localStorage write triggers another drop

There is no in-session reconnect mechanism. The /chrome reconnect does not exist or does not work.

Expected Behavior

  • localStorage writes via javascript_tool should not affect the MCP transport layer
  • If the connection does drop, auto-reconnect with backoff
  • At minimum, provide a way to reconnect without restarting Claude Code

Frequency

  • Happens consistently when using javascript_tool for localStorage operations
  • Observed across multiple sessions over several days
  • Not every localStorage write triggers it, but it happens frequently enough (roughly every 3-5 writes) to make localStorage-based workflows fragile

Workaround

We've been working around this by batching localStorage operations and accepting that the session will need periodic restarts. But for workflows that depend on reading/writing page state (e.g., posting comments to a localStorage-backed notes system), this is a significant friction point.

Environment

  • Claude Code: latest (claude-opus-4-6)
  • Chrome: latest stable
  • OS: Linux (Ubuntu 24.04, kernel 6.17)
  • Chrome extension: installed, logged in, shows as active

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗