browser39 logo

browser39

Community
alejandroqh

A headless browser for AI agents that fetches modern web pages, runs JavaScript, manages sessions, and returns token-efficient Markdown.

Publisheralejandroqh
Repositorybrowser39
LanguageRust
Forks
11
Stars
86
Available tools
0
Transport typestdio, streamable-http
Categories
LicenseApache-2.0
Links
  • Connect tools to AI workflows

    browser39 exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    86 stars and 11 forks from the linked repository.

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

browser39Playwright / PuppeteerRaw HTTP (requests, ureq)
External browserNone (single binary)Requires Chrome/ChromiumNone
Binary size~52MB~280MB with browserN/A (library)
PlatformsmacOS, Linux, WindowsmacOS, Linux, WindowsAny
JavaScriptYes (V8 via deno_core)Yes (full V8)No
HTML to MarkdownBuilt-in, token-optimizedNo (raw HTML or screenshots)DIY
Token preselectionContent sections, agent picks what to readNoNo
Cookies & sessionsAutomatic, persisted, encryptedManualManual
DOM queriesCSS selectors + full JS DOM APIFull DOM APINo
Formsfill + submitFull interactionManual POST
Auth & secretsProfiles, redaction, opaque handlesManualManual
TransportsMCP (stdio + HTTP), JSONL, CLILibrary APILibrary API

Token savings in practice

Real test: extracting the "Optical communications" section from Artemis II on Wikipedia (full page: ~14,600 tokens).

Raw HTTPWebFetch (Claude Code built-in)Mistral Web Searchbrowser39
How it worksFetch full page, truncate to ~1,000 tokensSend full page (~14,600 tokens) to intermediate model with extraction promptCloud API: search + page processing by Mistral modelFetch → content selectors list → targeted section fetch
Tokens consumed~1,000 (truncated)~14,600 (processed by intermediate model)Cloud processed, not disclosed196
Found the section?No. Section is at token ~6,320, truncated awayYes, but returns a lossy summaryDepends on search rankingYes. Exact original content
Content qualityNav menus, infobox, article introParaphrased, no links, no referencesSummary with citationsLossless markdown with links and citations
Session stateNoneNoneNoneCookies, history, follow-up queries free
Data processingLocalProcessed remotelyProcessed remotelyLocal
Cost per callFreeBundled$30 / 1,000 callsFree
Retries neededPagination to find itNone, but no control over outputMay not find specific sectionNone. 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.

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: 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 | TypeScript | Rust

See 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 = "1.8"
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

TransportCommandUse case
MCP (stdio)browser39 mcpLocal MCP clients
MCP (HTTP)browser39 mcp --transport sse --port 8039Remote agents, cloud deployments
JSONL watchbrowser39 watch commands.jsonlAny language, long-running agent IPC
JSONL batchbrowser39 batch commands.jsonlOne-shot scripted operations
CLI fetchbrowser39 fetch <url>Quick page retrieval, shell scripts
CLI searchbrowser39 search <query>Quick web search from shell scripts
Rust librarycargo add browser39Embed 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 for the full reference.

Documentation

DocDescription
install-cli.mdCLI integration guide with Rust, Python, TypeScript examples
jsonl-protocol.mdFull JSONL protocol specification
config.mdConfiguration reference

Development

bash
cargo build              # Build
cargo run                # Run
cargo test               # Run all tests
cargo clippy             # Lint
cargo fmt                # Format

Contributors

@nathan-widjaja

@janpauldahlke

License

Apache-2.0

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "alejandroqh-browser39": {
      "command": "",
      "args": []
    }
  }
}

Use browser39 MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once browser39 is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add browser39 as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the browser39 MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "alejandroqh-browser39": {
      "command": "npx",
      "args": [
        "-y",
        "browser39"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the browser39 MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the browser39 MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use browser39 to help me with this task?
browser39
Sure. I read it.
Here is what I found using browser39.

Option 2: Add an MCP server URL

Use this when browser39 is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter your server URL in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste your server URL into the Server URL field.
  2. Enter a connection name for browser39.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the browser39 connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the browser39 tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the browser39 tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use browser39 to help me with this task?
browser39
Sure. I read it.
Here is what I found using browser39.

Frequently asked questions

What is the browser39 MCP server used for?

browser39 is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use browser39 MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use browser39 with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use browser39 MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With browser39 connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect browser39 MCP to TypingMind?

browser39 can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does browser39 MCP provide in TypingMind?

browser39 exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use browser39 MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If browser39 requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇