Browser CLI: A Token-Efficient Browser Automation Tool for AI Coding Agents

What Browser CLI Does
Browser CLI is a browser automation tool built to address token overhead in AI coding agents. The creator noticed browser verification was consuming ~30,000 tokens per session through Playwright MCP protocol overhead, with each browser_navigate + browser_snapshot call costing ~1,500 tokens in JSON schema framing.
The solution is a persistent headless Chromium daemon that you interact with via Bash commands. It uses the same Playwright ARIA snapshot technology underneath but achieves ~50-100 tokens per call instead of ~1,500.
Commands and Usage
Available commands include:
browser-cli goto https://example.com- Navigate to URLbrowser-cli snapshot -i- ARIA tree with @e refsbrowser-cli click @e3- Click by refbrowser-cli fill @e5 "hello"- Fill inputbrowser-cli css @e3 font-size- Get computed CSS valuebrowser-cli inspect @e3- Full box model + stylesbrowser-cli screenshot /tmp/page.png- Screenshotbrowser-cli snapshot -D- Diff: what changed since last snapshotbrowser-cli responsive /tmp- Screenshots at mobile/tablet/desktop
The server auto-starts on first call (~3s), then subsequent calls are ~100-200ms. It stays alive for 30 minutes, preserving cookies, tabs, and state between commands.
Token Savings
Token comparison:
- Playwright MCP: ~1,500 tokens per call, ~30,000 tokens for 20 calls
- Browser CLI: ~75 tokens per call, ~1,500 tokens for 20 calls
That's 95% savings on browser verification. For automated pipelines that do multiple tasks per session, this compounds fast.
Features Beyond Playwright MCP
- CSS inspection -
css @e3 paddingreturns computed values.inspect @e3gives full box model + 16 key styles as JSON. - Live style mutation -
style @e3 color redwithstyle --undo. Debug CSS without touching source code. - Snapshot diffing -
snapshot -Dcompares before/after ARIA trees. - Responsive presets -
responsive /tmptakes mobile + tablet + desktop screenshots in one command. - Auth profiles -
handoffopens a visible Chrome for manual SSO/MFA login,resumegoes back to headless,auth-save adminencrypts the session (AES-256). Next time:goto-auth https://app.com/dashboard --profile admin— no login needed. - Command batching -
chain [["goto","url"],["snapshot","-i"],["console"]]runs multiple commands in one call.
Technical Implementation
Architecture: AI Agent → Bash → CLI client (bin/browse.mjs) → HTTP POST (localhost) → Server (src/server.mjs) → Playwright API → Chromium (headless).
Pure Node.js. Playwright is the only dependency. No Bun, no Rust, no MCP overhead.
Claude Code Integration
Install globally:
npm install -g @tuandm/browser-cliAdd to .claude/settings.json:
{
"permissions": {
"allow": ["Bash(browser-cli*)"]
}
}Add a rule at .claude/rules/browser-cli.md telling Claude to use Browser CLI instead of Playwright MCP. The creator ran 5 eval scenarios and Claude picked the right command every time with the rule loaded.
It also ships as a Claude Code plugin (plugin.json included) for future marketplace distribution.
Inspiration and Technology
Inspired by gstack by Garry Tan, which pioneered the persistent Chromium CLI approach for AI agents. The core insight was that Bash commands are dramatically more token-efficient than MCP for browser automation. The underlying technology is Playwright by Microsoft.
📖 Read the full source: r/ClaudeAI
👀 See Also

ClawControl iOS client released for OpenClaw self-hosted servers
ClawControl v1.50 is now available on iOS as a privacy-focused mobile client for self-hosted OpenClaw/Claw servers. The open-source app enables real-time chat with streaming responses, agent management, and session control from mobile devices.

Simplifying OpenClaw Hosting: BestClaw Keeps SSH and User-Friendly Functionality
BestClaw emerges as a straightforward solution for OpenClaw hosting, balancing ease of use with crucial SSH access, as discussed on r/openclaw.

Automate daily briefings into personal Spotify podcasts with OpenClaw and the Save to Spotify CLI
OpenClaw runs daily at 7am, pulls Slack threads + GitHub notifications + calendar, summarizes into mp3, and uploads as a private episode via the Save to Spotify CLI. Works on Free and Premium.

ExposureGuard MCP Server Adds Domain Security Scanning to Claude Desktop
A developer built an MCP server for domain security scanning using Claude Code, exposing four tools that check SPF, DMARC, SSL, security headers, DNSSEC, open ports, MX, and HTTPS. The server is available via pip install exposureguard-mcp with a free tier of 100 API calls per day.