Overview
The CLI daemon provides a persistent browser session over a Unix socket. Use the-c flag to execute Python code directly from Bash — no MCP server, no LLM, just code and a browser.
The daemon starts automatically on first use, persists variables across calls, and shuts down after 10 minutes of inactivity.
Quick Start
Variable Persistence
Variables set in one-c call are available in the next, as long as the daemon is running:
Daemon Management
~/.openbrowser/daemon.sock. Logs are written to ~/.openbrowser/daemon.log.
Windows: On Windows, the daemon uses a localhost TCP connection on port 19222 instead of a Unix socket. This means any process on the same machine can connect. The Unix socket on macOS/Linux is restricted to the file owner (mode 0600).
Available Functions
All functions from the MCPexecute_code tool are available in -c mode:
Pre-imported libraries:
json, csv, re, datetime, asyncio, Path, requests
Optional (imported on first use): numpy/np, pandas/pd, matplotlib/plt, BeautifulSoup, PdfReader, tabulate
Multi-Action Batching
Batch multiple actions in a single call for efficiency:Architecture
- The CLI is a thin client (~30ms startup) that sends code over the Unix socket
- The daemon holds the browser session, CodeExecutor, and persistent namespace in memory
- The browser connects via Chrome DevTools Protocol (CDP)
Configuration
Comparison with MCP Server
Both use the same
CodeExecutor engine and browser automation functions.
Troubleshooting
Daemon won’t start- Check
~/.openbrowser/daemon.logfor errors - Verify Chrome/Chromium is installed
- Remove stale files:
rm ~/.openbrowser/daemon.sock ~/.openbrowser/daemon.pid
- The daemon shuts down after 10 minutes of inactivity
- Run any
-ccommand to auto-start it
- The socket is created with
0600permissions (owner-only) - Check that
~/.openbrowser/is owned by your user
- The daemon may have restarted (idle timeout or crash)
- Use
openbrowser-ai daemon statusto check if the daemon is running