Skip to content

Commit 97f6034

Browse files
Add Chrome for Claude setup section to CLI guide
Add a new "Chrome for Claude in Devcontainers" section between Browser Integration and Checking Status. Provides step-by-step setup: 1. Configure socket forwarding with watch_paths glob for native host sockets 2. Create username symlink (host user vs container user mismatch) 3. Add claude-chrome wrapper function to patch GrowthBook feature flag 4. Verify with dbr status Links to the full technical deep-dive for developers who need the architectural details. Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 0a7ad4a commit 97f6034

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

docs/cli-guide.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,86 @@ the host daemon.
219219

220220
---
221221

222+
## Chrome for Claude in Devcontainers
223+
224+
Claude Code's "Chrome for Claude" feature lets Claude read browser tabs, take
225+
screenshots, and navigate pages. This requires the Chrome extension on the host
226+
and the MCP server inside the container to communicate. `dbr` bridges this gap
227+
via Unix socket forwarding.
228+
229+
> See [Chrome for Claude Integration](claude-chrome-integration.md) for the
230+
> full technical deep-dive.
231+
232+
### Prerequisites
233+
234+
- Chrome running on the host with the Claude Code extension installed
235+
- `dbr` socket forwarding enabled (see [Unix Socket Forwarding](#unix-socket-forwarding) above)
236+
- Claude Code installed inside the container
237+
238+
### 1. Configure socket forwarding
239+
240+
Add the native host socket pattern to `~/.config/dbr/config.toml`:
241+
242+
```toml
243+
[socket_forwarding]
244+
watch_paths = ["/tmp/claude-mcp-browser-bridge-*/*.sock"]
245+
```
246+
247+
### 2. Create the username symlink
248+
249+
The native host creates sockets under your host username, but Claude Code in
250+
the container looks under the container username. Create a symlink inside the
251+
container:
252+
253+
```bash
254+
# In your container's shell profile or entrypoint
255+
HOST_USER="$(ls /tmp/claude-mcp-browser-bridge-* -d 2>/dev/null | head -1 | xargs basename | sed 's/claude-mcp-browser-bridge-//')"
256+
CONTAINER_USER="$(whoami)"
257+
if [ -n "$HOST_USER" ] && [ "$HOST_USER" != "$CONTAINER_USER" ]; then
258+
ln -sfn "/tmp/claude-mcp-browser-bridge-$HOST_USER" "/tmp/claude-mcp-browser-bridge-$CONTAINER_USER"
259+
fi
260+
```
261+
262+
### 3. Add the Claude Code wrapper
263+
264+
Claude Code defaults to a cloud WebSocket bridge for Chrome communication,
265+
which doesn't work from containers. This wrapper forces the local socket path:
266+
267+
```bash
268+
# Add to your container shell profile (.zshrc / .bashrc)
269+
claude-chrome() {
270+
python3 -c "
271+
import json
272+
f = '$HOME/.claude.json'
273+
try:
274+
d = json.load(open(f))
275+
except (FileNotFoundError, json.JSONDecodeError):
276+
d = {}
277+
d.setdefault('cachedGrowthBookFeatures', {})['tengu_copper_bridge'] = False
278+
json.dump(d, open(f, 'w'), indent=2)
279+
" 2>/dev/null
280+
command claude "$@"
281+
}
282+
```
283+
284+
Then launch Claude Code with `claude-chrome` instead of `claude`.
285+
286+
### 4. Verify
287+
288+
```bash
289+
# Check socket forwarding is active
290+
dbr status
291+
292+
# Should show something like:
293+
# Socket Forwards
294+
# Host Path Container Path
295+
# /tmp/claude-mcp-browser-bridge-user/12345.sock /tmp/claude-mcp-browser-bridge-user/12345.sock
296+
297+
# In Claude Code, the Chrome for Claude indicator should show "connected"
298+
```
299+
300+
---
301+
222302
## Checking Status with `dbr status`
223303

224304
See what ports are currently forwarded:

0 commit comments

Comments
 (0)