Claude-in-Chrome: Sandbox blocks access to native messaging socket
Description
The Claude-in-Chrome browser extension fails to connect when Claude Code is running with sandbox enabled. The native messaging host creates its Unix socket at a path that is not included in the sandbox's default write allowlist.
Environment
- OS: macOS (Darwin 25.2.0)
- Claude Code Version: Latest (installed via Homebrew)
- Node.js: v25.4.0
- Chrome Extension Version: 1.0.40
Root Cause
The Chrome native messaging host creates its socket at:
/tmp/claude-mcp-browser-bridge-{username}/{pid}.sock
However, the sandbox's default write allowlist only includes:
/tmp/claude/
/private/tmp/claude/
This path mismatch means Claude Code (running in sandbox) cannot connect to the socket created by the native host (launched by Chrome outside the sandbox).
Steps to Reproduce
- Enable sandbox in Claude Code settings
- Start Chrome with the Claude extension installed and enabled
- Attempt to use any
mcp__claude-in-chrome__*tool - Connection fails with "Browser extension is not connected"
Diagnostic Evidence
Socket exists and native host is running:
$ lsof -U | grep claude.*bridge
chrome-na 2896 user 10u unix ... /tmp/claude-mcp-browser-bridge-user/2896.sock
Connection test from outside sandbox:
import socket
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect('/tmp/claude-mcp-browser-bridge-user/2896.sock')
# Success!
Connection test from inside sandbox:
import socket
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect('/tmp/claude-mcp-browser-bridge-user/2896.sock')
# Error: [Errno 1] Operation not permitted
Suggested Fix
Either:
- Update the native host to create sockets inside
/tmp/claude/(e.g.,/tmp/claude/browser-bridge-{username}/{pid}.sock)
- Or update the default sandbox allowlist to include
/tmp/claude-mcp-browser-bridge-*
Option 1 seems cleaner as it keeps all Claude-related temp files in a single directory.
Workaround
Users can manually add the paths to their sandbox configuration in .claude/settings.local.json:
{
"sandbox": {
"enabled": true,
"additionalWritePaths": [
"/tmp/claude-mcp-browser-bridge-*",
"/private/tmp/claude-mcp-browser-bridge-*"
]
}
}
(Note: I'm not 100% certain this configuration key exists - this was my attempted workaround)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗