browser39
A headless browser for AI agents that fetches modern web pages, runs JavaScript, manages sessions, and returns token-efficient Markdown.
- Handles modern sites. Executes JavaScript, fills forms, queries the DOM, persists cookies and sessions across runs.
- LLM-usable output. Compact Markdown with content preselection, so the agent reads the section it needs, not the whole page.
- Local-only. No data sent to third-party services.
- Single binary. No Chrome, no Puppeteer. ~52MB. macOS, Linux, Windows.
Comparison
| browser39 | Playwright / Puppeteer | Raw HTTP (requests, ureq) |
|---|
| External browser | None (single binary) | Requires Chrome/Chromium | None |
| Binary size | ~52MB | ~280MB with browser | N/A (library) |
| Platforms | macOS, Linux, Windows | macOS, Linux, Windows | Any |
| JavaScript | Yes (V8 via deno_core) | Yes (full V8) | No |
| HTML to Markdown | Built-in, token-optimized | No (raw HTML or screenshots) | DIY |
| Token preselection | Content sections, agent picks what to read | No | No |
| Cookies & sessions | Automatic, persisted, encrypted | Manual | Manual |
| DOM queries | CSS selectors + full JS DOM API | Full DOM API | No |
| Forms | fill + submit | Full interaction | Manual POST |
| Auth & secrets | Profiles, redaction, opaque handles | Manual | Manual |
| Transports | MCP (stdio + HTTP), JSONL, CLI | Library API | Library API |
Token savings in practice
Real test: extracting the "Optical communications" section from Artemis II on Wikipedia (full page: ~14,600 tokens).
| Raw HTTP | WebFetch (Claude Code built-in) | Mistral Web Search | browser39 |
|---|
| How it works | Fetch full page, truncate to ~1,000 tokens | Send full page (~14,600 tokens) to intermediate model with extraction prompt | Cloud API: search + page processing by Mistral model | Fetch → content selectors list → targeted section fetch |
| Tokens consumed | ~1,000 (truncated) | ~14,600 (processed by intermediate model) | Cloud processed, not disclosed | 196 |
| Found the section? | No. Section is at token ~6,320, truncated away | Yes, but returns a lossy summary | Depends on search ranking | Yes. Exact original content |
| Content quality | Nav menus, infobox, article intro | Paraphrased, no links, no references | Summary with citations | Lossless markdown with links and citations |
| Session state | None | None | None | Cookies, history, follow-up queries free |
| Data processing | Local | Processed remotely | Processed remotely | Local |
| Cost per call | Free | Bundled | $30 / 1,000 calls | Free |
| Retries needed | Pagination to find it | None, but no control over output | May not find specific section | None. Agent sees structure first |
browser39 returns the exact section in 196 tokens at zero cost. The raw approach misses it entirely, WebFetch burns 75x more tokens through an intermediate model, and cloud tools like Mistral's charge $0.03 per call.
Install
npm install @aquintanar/browser39
Or via Cargo:
cargo install browser39
Install for any AI CLI / IDE
Installs the binary and auto-configures it for every MCP client detected: Claude Code, Claude Desktop, Codex, OpenCode, OpenClaw.
curl -fsSL https://raw.githubusercontent.com/alejandroqh/marketplace/main/h39.sh | bash
Pre-built binaries available on the releases page.
Quick Start
MCP config
Add to your MCP client config:
{
"mcpServers": {
"browser39": {
"command": "browser39",
"args": ["mcp"]
}
}
}
29 tools available instantly: browser39_fetch, browser39_click, browser39_links, browser39_dom_query, browser39_fill, browser39_submit, browser39_search, cookies, storage, history, config management, and more.
CLI: one-shot fetch
browser39 fetch https://example.com
# Example Domain
This domain is for use in documentation examples without needing permission.
[Learn more](https://iana.org/domains/example)
CLI: agent integration (watch mode)
Long-running subprocess that any language can talk to via JSONL files:
touch commands.jsonl
browser39 watch commands.jsonl --output results.jsonl
# From your agent (Python, Node, Rust, shell, anything):
echo '{"id":"1","action":"fetch","v":1,"seq":1,"url":"https://example.com"}' >> commands.jsonl