browser39
A headless browser for AI agents that fetches modern web pages, runs JavaScript, manages sessions, and returns token-efficient Markdown.
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Badge for your README
Markdown
[](/listings/alejandroqh--browser39)HTML
<a href="/listings/alejandroqh--browser39"><img src="/api/listings/alejandroqh--browser39/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
These steps run a script from the network that findsafeskills does not scan.
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](https://github.com/alejandroqh/browser39/releases).
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
README.md · README · 318 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.
- <p align="center">
- <img src="https://raw.githubusercontent.com/alejandroqh/browser39/main/docs/logo.png" alt="browser39" width="500">
- </p>
- # 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](https://en.wikipedia.org/wiki/Artemis_II) (full page: ~14,600 tokens).
- | | Raw HTTP | WebFetch (Claude Code built-in) | [Mistral Web Search](https://docs.mistral.ai/agents/tools/built-in/websearch) | 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](https://mistral.ai/pricing#api) | 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
- ```bash
- npm install @aquintanar/browser39
- ```
- Or via Cargo:
- ```bash
- 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**.
- ```sh
- curl -fsSL https://raw.githubusercontent.com/alejandroqh/marketplace/main/h39.sh | bash
- ```
- Pre-built binaries available on the [releases page](https://github.com/alejandroqh/browser39/releases).
- ## Quick Start
- ### MCP config
- Add to your MCP client config:
- ```json
- {
- "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
- ```bash
- 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: one-shot search
- Search the web using the configured search engine:
- ```bash
- browser39 search "rust async traits"
- ```
- Add `--output json` for structured results suitable for piping into other tools.
- ### CLI: read in the terminal
- An elinks-style viewer for humans: pages open in reader mode (main content only) as highlighted markdown with numbered links.
- ```bash
- browser39 browse https://en.wikipedia.org/wiki/Artemis_II
- browser39 browse en.wikipedia.org/wiki/Artemis_II -s "lunar flyby" # open at a section
- browser39 browse rust async traits # not a URL: web search
- ```
- Scroll with `j`/`k`/space or the mouse wheel, follow links by clicking them, with `Tab` + `Enter`, or by typing their number, go back with `h`. Hovering a link shows its URL, and right- or middle-clicking copies the section under the pointer; press `m` to release the mouse so the terminal can select text. Press `t` for the table of contents, `y` to copy the current section as markdown, `Y` for the whole page, `/` to find, `o` to open a URL or search, `r` to toggle reader/full page, `?` for all keys. Copied markdown includes `[n]: url` definitions for its links, so it pastes as valid markdown.
- When stdout isn't a terminal it prints the markdown instead, so it pipes cleanly:
- ```bash
- browser39 browse https://en.wikipedia.org/wiki/Artemis_II -s crew | pbcopy
- ```
- ### CLI: agent integration (watch mode)
- Long-running subprocess that any language can talk to via JSONL files:
- ```bash
- touch commands.jsonl
- browser39 watch commands.jsonl --output results.jsonl
- ```
- ```bash
- # From your agent (Python, Node, Rust, shell, anything):
- echo '{"id":"1","action":"fetch","v":1,"seq":1,"url":"https://example.com"}' >> commands.jsonl
- ```
- Drop-in `web_search` and `visit_website` tool examples: **[Python](examples/browser39_tools.py)** | **[TypeScript](examples/browser39_tools.ts)** | **[Rust](examples/browser39_tools.rs)**
- See [docs/install-cli.md](docs/install-cli.md) for the full integration guide.
- ### Rust library
- Embed browser39 directly in a Rust application — no subprocess, no IPC.
- ```toml
- [dependencies]
- browser39 = "2.0"
- tokio = { version = "1", features = ["full"] }
- anyhow = "1"
- ```
- ```rust
- use std::collections::HashMap;
- use browser39::{BrowserService, Config, HttpMethod, InMemoryStore, SessionStore};
- #[tokio::main]
- async fn main() -> anyhow::Result<()> {
- let store: Box<dyn SessionStore> = Box::new(InMemoryStore);
- let mut service = BrowserService::new(Config::default(), store).await?;
- let options = service.default_fetch_options();
- let page = service
- .fetch(
- "https://example.com",
- &HttpMethod::Get,
- &HashMap::new(),
- None,
- None,
- &options,
- )
- .await?;
- println!("{}", page.markdown);
- Ok(())
- }
- ```
- The crate root re-exports the common types: `BrowserService`, `Config`, `PersistenceMode`, `FetchOptions`, `HttpMethod`, `SessionStore`, `InMemoryStore`, `create_session_store`. Lower-level modules (`browser39::core`, `browser39::cli`, `browser39::mcp`) are also public if you need direct access to the HTML→Markdown engine, JSONL runner, or MCP server.
- ## Features
- ### Token optimization
- browser39 minimizes token usage when feeding web content to LLMs:
- - **Content preselection**: on first fetch, returns available content sections with token estimates instead of dumping the full page. The agent picks the relevant section and re-fetches with a targeted `selector`.
- - **Heading auto-expand**: `selector: "#Astronauts"` returns the full section until the next same-level heading, not just the heading text.
- - **HTML to Markdown**: strips scripts, styles, and non-content elements.
- - **Compact link references** (JSON mode): `[text][N]` instead of inline URLs, with full URLs in the `links` array.
- - **Same-origin URL shortening**: links on the same domain show path-only.
- - **Link deduplication**: same-URL links (image + headline cards) emitted once.
- ### JavaScript execution
- V8 (via deno_core) runs JavaScript against a full DOM environment:
- - **Traversal**: `parentElement`, `children`, `firstChild`, `lastChild`, `nextSibling`, `previousSibling`, `closest()`, `matches()`, `contains()`
- - **Lookup**: `getElementById`, `getElementsByClassName`, `getElementsByTagName`, `getElementsByName`
- - **Mutation**: `createElement`, `createTextNode`, `appendChild`, `removeChild`, `insertBefore`, `setAttribute`, `removeAttribute`, `textContent`/`innerHTML` setters
- - **Events**: `addEventListener`, `removeEventListener`, `dispatchEvent`, `new Event`/`CustomEvent`/`MouseEvent`/`KeyboardEvent`/`InputEvent`
- - **Web APIs**: `localStorage`, `document.cookie`, `console.log` (captured), `setTimeout`, `atob`/`btoa`, `getComputedStyle`, `MutationObserver`
- - **Forms**: `element.value` get/set, `element.click()`, `form.submit()`
- ```json
- {"action": "dom_query", "script": "document.querySelectorAll('a').length"}
- {"action": "dom_query", "script": "document.getElementById('content').closest('section').textContent"}
- {"action": "dom_query", "script": "document.querySelector('h1').setAttribute('class', 'modified')"}
- ```
- ### Session persistence
- Cookies, localStorage, and browsing history are persisted to disk by default (`~/.local/share/browser39/session.enc`, AES-256-GCM encrypted). An agent can log in once and stay authenticated across restarts.
- Disable with `--no-persist` or config:
- ```toml
- [session]
- persistence = "memory"
- ```
- ### Forms
- Fill fields by CSS selector and submit. browser39 handles `enctype`, builds the HTTP request, and returns the response page:
- ```json
- {"action": "fill", "fields": [{"selector": "#user", "value": "agent"}, {"selector": "#pass", "value": "secret", "sensitive": true}]}
- {"action": "submit", "selector": "form#login"}
- ```
- ### Security
- Auth profiles keep credentials out of the LLM conversation. The agent references a profile name and never sees the token:
- ```toml
- [auth.github]
- header = "Authorization"
- value_env = "GITHUB_TOKEN"
- value_prefix = "Bearer "
- domains = ["api.github.com"]
- ```
- ```json
- {"action": "fetch", "url": "https://api.github.com/repos", "auth_profile": "github"}
- ```
- ### Config management via MCP
- Agents can manage browser39's configuration directly through MCP tools: change the search engine, store credentials, manage auth profiles, cookies, storage, and headers. Sensitive values are stored securely on disk but **never returned** via MCP; `config_show` masks them with `••••••`.
- ```
- > browser39_config_set key="search.engine" value="https://www.google.com/search?q={}"
- Set search.engine = https://www.google.com/search?q={}
- > browser39_config_auth_set name="github" header="Authorization" value="Bearer ghp_..." domains=["api.github.com"]
- Auth profile 'github' saved
- > browser39_config_show section="auth"
- {"auth": {"github": {"header": "Authorization", "value": "••••••", ...}}}
- ```
- 10 config tools: `config_show`, `config_set`, `config_auth_set/delete`, `config_cookie_set/delete`, `config_storage_set/delete`, `config_header_set/delete`.
- ### All transports
- | Transport | Command | Use case |
- |-----------|---------|----------|
- | MCP (stdio) | `browser39 mcp` | Local MCP clients |
- | MCP (HTTP) | `browser39 mcp --transport sse --port 8039` | Remote agents, cloud deployments |
- | JSONL watch | `browser39 watch commands.jsonl` | Any language, long-running agent IPC |
- | JSONL batch | `browser39 batch commands.jsonl` | One-shot scripted operations |
- | CLI fetch | `browser39 fetch <url>` | Quick page retrieval, shell scripts |
- | CLI search | `browser39 search <query>` | Quick web search from shell scripts |
- | Rust library | `cargo add browser39` | Embed in Rust apps, no subprocess |
- ## Configuration
- ```bash
- browser39 --config path/to/config.toml fetch https://example.com
- ```
- Precedence: `--config` flag > `BROWSER39_CONFIG` env > `~/.config/browser39/config.toml`
- See [docs/config.md](docs/config.md) for the full reference.
- ## Documentation
- | Doc | Description |
- |-----|-------------|
- | [install-cli.md](docs/install-cli.md) | CLI integration guide with Rust, Python, TypeScript examples |
- | [jsonl-protocol.md](docs/jsonl-protocol.md) | Full JSONL protocol specification |
- | [config.md](docs/config.md) | Configuration reference |
- ## Development
- ```bash
- cargo build # Build
- cargo run # Run
- cargo test # Run all tests
- cargo clippy # Lint
- cargo fmt # Format
- ```
- ## Contributors
- [@nathan-widjaja](https://github.com/nathan-widjaja)
- [@janpauldahlke](https://github.com/janpauldahlke)
- ## License
- Apache-2.0
.mcp.json · Bundled script · 9 lines · 1 finding marked
- {
- "mcpServers": {
- "browser39": {
- "type": "stdio",
- "command": "/Users/aquintanar/Development/h39/browser39/target/debug/browser39",
- Note: Contains a long base64-looking blob — not necessarily malicious, but worth inspecting what it decodes to
- Line 5 on GitHub
- "args": ["mcp"]
- }
- }
- }
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.