Logo browser39

browser39

Cộng đồng
alejandroqh

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

Nhà phát hànhalejandroqh
Kho mãbrowser39
Ngôn ngữRust
Bản fork
11
Sao
86
Công cụ có sẵn
0
Phương thức truyền tảistdio, streamable-http
Danh mục
Giấy phépApache-2.0
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    browser39 cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    86 sao và 11 bản fork từ kho mã được liên kết.

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

Cài đặt

TypingMind
Yêu cầu:

Node.js 18+

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

Dùng MCP browser39 với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối browser39, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. Bạn có thể chạy MCP ngay trên thiết bị của mình hoặc kết nối qua URL của máy chủ MCP từ xa.

Cách 1: Dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm browser39 làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của browser39.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "alejandroqh-browser39": {
      "command": "npx",
      "args": [
        "-y",
        "browser39"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của browser39, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của browser39.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng browser39 giúp tôi làm việc này không?
browser39
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng browser39.

Cách 2: Thêm URL máy chủ MCP

Dùng cách này khi browser39 đã được lưu trữ từ xa hoặc nhóm của bạn muốn có một trình kết nối dùng chung cho nhiều người dùng.

1

Mở mục Trình kết nối MCP

Trong TypingMind, vào Plugin, mở mục Trình kết nối MCP, rồi chọn Thêm URL.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Vào mục Plugin.
  3. Mở mục Trình kết nối MCP.
  4. Nhấp vào Thêm URL.
Biểu mẫu Thêm URL máy chủ MCP tùy chỉnh của TypingMind
2

Dán URL máy chủ

Nhập URL máy chủ của bạn vào trường URL máy chủ. Thêm tên kết nối, mô tả, biểu tượng, header HTTP tùy chỉnh hoặc cài đặt ứng dụng khách OAuth nếu máy chủ yêu cầu.

  1. Dán URL máy chủ của bạn vào trường URL máy chủ.
  2. Nhập tên kết nối cho browser39.
  3. Thêm mô tả và biểu tượng nếu bạn muốn dễ nhận biết kết nối hơn.
  4. Thêm header HTTP tùy chỉnh hoặc thông tin ứng dụng khách OAuth nếu máy chủ yêu cầu xác thực.
3

Tạo kết nối

Nhấp vào Tạo kết nối, sau đó quay lại danh sách Plugin và xác nhận kết nối MCP mới đang hoạt động.

  1. Nhấp vào Tạo kết nối.
  2. Quay lại danh sách trình kết nối MCP.
  3. Xác nhận kết nối browser39 hiển thị trạng thái đang hoạt động.
  4. Làm mới danh sách plugin nếu kết nối chưa xuất hiện ngay.
4

Đổi mô hình mà không cần kết nối lại

Bắt đầu cuộc trò chuyện với mô hình bạn thích, bật các công cụ của browser39 trong mục Plugin và chuyển sang mô hình khác khi cần. Kết nối MCP vẫn sẵn dùng trong không gian làm việc TypingMind.

  1. Bắt đầu cuộc trò chuyện mới trong TypingMind.
  2. Chọn mô hình AI bạn muốn dùng.
  3. Bật các công cụ của browser39 trong mục Plugin.
  4. Yêu cầu mô hình dùng công cụ khi cần.
  5. Chuyển sang mô hình AI khác và dùng lại cùng kết nối MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng browser39 giúp tôi làm việc này không?
browser39
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng browser39.

Câu hỏi thường gặp

Máy chủ MCP browser39 dùng để làm gì?

browser39 là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP browser39 với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng browser39 với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP browser39 với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối browser39, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP browser39 với TypingMind?

Bạn có thể kết nối browser39 trong TypingMind bằng trình kết nối MCP cục bộ hoặc bằng cách thêm URL máy chủ MCP từ xa. Dùng trình kết nối cục bộ khi máy chủ cần truy cập tệp, ứng dụng hoặc tài nguyên riêng trên thiết bị của bạn; dùng URL máy chủ khi máy chủ MCP được lưu trữ từ xa.

MCP browser39 cung cấp những công cụ nào trong TypingMind?

browser39 cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP browser39 không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu browser39 yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇