AI News HubLIVE
In-site rewrite3 min read

High-integrity HTML extraction for AI agents (with native MCP)

Mission is a fast, robust HTML parser and CSS selector engine written in Rust, with zero dependencies, no network layer, crash immunity, and built-in MCP tool support for AI agents to extract structured data locally.

SourceHacker News AIAuthor: MerlijnW70

Notifications You must be signed in to change notification settings

Fork 0

Star 3

BranchesTags

Open more actions menu

Folders and files

NameName

Last commit message

Last commit date

Latest commit

History

14 Commits

14 Commits

.github

.github

benches

benches

docs

docs

src

src

tests

tests

.gitignore

.gitignore

Cargo.lock

Cargo.lock

Cargo.toml

Cargo.toml

LICENSE-APACHE

LICENSE-APACHE

LICENSE-MIT

LICENSE-MIT

README.md

README.md

RELEASE.md

RELEASE.md

install.sh

install.sh

Repository files navigation

A fast, robust HTML parser and CSS selector engine that won't crash on bad HTML. Zero dependencies, one small binary, no network — turn messy real-world HTML into clean text or structured data. Free and open source (MIT / Apache-2.0).

Mission is the open core of Mission Cloud — the managed platform for extraction that heals itself when sites change. The parser is yours to keep, forever. ☁️

⚡ Install in one line — no toolchain needed

macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/MerlijnW70/mission/main/install.sh | sh

Windows / other: grab a binary from the latest release (all platforms · x86-64 & arm64), or with Rust: cargo install --git https://github.com/MerlijnW70/mission mission.

🚀 60-second start

mission page.html # render HTML → readable text mission page.html --select 'a[href]' --attr href # extract every link mission page.html --select 'h2' --json # structured data out curl -s https://example.com | mission - --select h1 # slice a live page (pipe HTML in)

$ curl -s https://en.wikipedia.org/wiki/Rust_(programming_language) | mission - --select '.infobox a[href^="http"]' --attr href https://www.rust-lang.org/ https://github.com/rust-lang/rust ...

There is no mission fetch — Mission has no network layer by design. Feed it HTML from a file, a pipe, or curl. That keeps it small, fast, and safe on untrusted input.

🤖 Use it as an MCP tool (give your agent HTML superpowers)

Installing Mission also gives you mission-mcp, a Model Context Protocol server. Point any MCP-compatible editor or environment at it and your agent gets four tools — select, select_text, render, attributes — to slice HTML with CSS selectors, deterministically and locally.

Most MCP hosts take the same block — add it to your client's server config and restart:

{ "mcpServers": { "mission": { "command": "mission-mcp" } } }

For CLI-based clients it's usually a one-liner, e.g. mcp add mission mission-mcp.

Now your agent can do "fetch this page and pull out the product prices" without shipping the whole HTML into the context window — Mission does the slicing and hands back just the matches.

What it does

HTML → tokenize → parse (DOM) → query (CSS) → render

Renders HTML to clean, readable text — headings, lists, tables, blockquotes, emphasis, links.

Queries with a near-complete CSS selector engine (below).

Extracts structured data — attribute values, JSON, or a streaming NDJSON slicer.

CLI

Invocation Effect

mission ... render one or more HTML files (- reads stdin)

… --select print the elements matching a CSS selector

… --attr print that attribute of each match instead of its text

… --json / --jsonl / --pretty machine-readable JSON (array, NDJSON per-line, or indented)

… --count print the number of matches (grep-style)

… --fail-on-empty exit non-zero if nothing matched (for CI pipelines)

… --width wrap rendered text to n columns at word boundaries

mission --filter NDJSON pipe mode: one {"html","selector"} job per line in, one {"matches":[…]} line out

CSS selector engine

Category Selectors

Simple div · .card · #main · *

Attribute [href] · [type="text"] · [href^="/a"] · [src$=".png"] · [class*="col"] · [rel~="me"] · [lang|="en"]

Structural :first-child · :last-child · :nth-child(An+B | odd | even) · :only-child · :nth-last-child(…)

Of-type :first-of-type · :last-of-type · :nth-of-type(…) · :only-of-type · :nth-last-of-type(…)

Relational :has() — the container that holds X

Negation :not()

Combinators descendant (space) · child > · adjacent + · general sibling ~ · groups h1, h2

Why it holds up

Won't crash on bad HTML. Lenient, browser-like recovery plus depth caps and bounded matching mean adversarial or broken markup produces output, not a panic.

Zero runtime dependencies. The tokenizer, DOM, CSS engine, renderer, and JSON are all from-scratch; the [dependencies] table is empty. #![forbid(unsafe_code)] throughout.

No network, by design. The parser and renderer never open a socket — small attack surface, fully deterministic.

Mutation-tested. Behaviour is pinned by an extensive, mutation-tested suite — a green build means the tested behaviour is genuinely exercised, not merely that the code compiles.

Performance

Single core, zero dependencies, no SIMD — and the benchmark itself has no dependencies either (a std-only harness). Reproduce any time with cargo bench:

Stage Throughput 1 MB page

Parse HTML → DOM ~50 MB/s ~20 ms

CSS select over the parsed tree > 1 GB/s the docs.

"); assert_eq!(render_text(&dom), "# Title\nSee the docs [/x].");

let hrefs: Vec = select(&dom, "a[href]").iter().filter_map(|n| n.attr("href")).collect(); assert_eq!(hrefs, ["/x"]);

☁️ Mission is one part of a bigger family — meet Mission Cloud

Mission (this repo) is the extraction engine: given HTML and a selector, it returns the data. That's the hard, deterministic part — and it's free forever.

But real extraction at scale has a second, messier problem: the web changes. Selectors rot, pages get redesigned, endpoints flake. That's what Mission Cloud solves — a managed platform that wraps this engine with a self-healing brain:

Mission (free, open source) Mission Cloud (managed)

HTML parse · CSS query · render ✅ ✅

Run locally / self-host ✅ ✅

Auto-retry with fallback selectors when one breaks — ✅

Strategy escalation + circuit breaking (no 3am pages) — ✅

High-throughput binary transport for pipelines — ✅

Managed, distributed, monitored extraction at scale — ✅

☁️ Read about the platform → · Join the early-access waitlist →

The parser you're installing here is the genuine core of that platform — not a crippled demo. Use it free, forever; reach for Mission Cloud when extraction becomes something you have to keep running.

License

The Mission parser is licensed under either Apache-2.0 or MIT, at your option. (Mission Cloud is a separate commercial offering.)

About

Robust HTML parser and CSS selector engine. Won't crash on bad HTML

Resources

Readme

License

Apache-2.0, MIT licenses found

Apache-2.0

LICENSE-APACHE

MIT

LICENSE-MIT

Uh oh!

There was an error while loading. Please reload this page.

Activity

Stars

3 stars

Watchers

0 watching

Forks

0 forks

Report repository

Releases 2

v0.1.1

Latest

Jul 14, 2026

+ 1 release

Packages 0

Uh oh!

There was an error while loading. Please reload this page.

Contributors

Uh oh!

There was an error while loading. Please reload this page.

Languages

Rust 99.3%

Shell 0.7%