claude-in-chrome: connection drops after localStorage write via javascript_tool
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
- Start Claude Code with
--chromeflag, Chrome extension connected - Call
mcp__claude-in-chrome__tabs_context_mcp— works fine - Use
mcp__claude-in-chrome__javascript_toolto write tolocalStorage:
``javascript``
localStorage.setItem('test-key', JSON.stringify({data: 'value'}));
- The call may succeed, but subsequent calls to any
mcp__claude-in-chrome__*tool fail with "Browser extension is not connected" - The Chrome extension is still visibly active in Chrome — only the MCP WebSocket is dead
Recovery
The only way to recover is:
- Close Claude Code (
Ctrl+Cor quit) - Resume the session (
claude --resumeor pick the session) - This establishes a fresh WebSocket connection
- 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
localStoragewrites viajavascript_toolshould 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_toolfor 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
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗