Skip to content
BHIIKTORPublic

About

Rust MCP web-intelligence server — fetch, extract, crawl, monitor, interact, PDF, semantic search

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

web-widow

An MCP server that lets an agent read the web, then keep what it read.

One Rust binary. Give it a URL and it returns the main content as Markdown, with the metadata a model needs and none of the page furniture. Render a JavaScript page when the page needs a browser. Read a PDF, a feed, or a sitemap. Store everything locally, then search it offline by keyword or by meaning.

It is built for people wiring tools into an agent, and for people who have written a scraper before and know where it hurts.

Status: 34 MCP tools, version 0.1.0. There is no published release. Build from source.

Why this exists

Agents read well and acquire badly. The reading half is a solved prompt. The acquiring half is a crawler, and a crawler is a small distributed system with a security boundary around it.

That boundary is the part most tools leave to the caller. A URL from a model is untrusted input. It can point at 127.0.0.1, at a cloud metadata endpoint, at a host that redirects into a private range on the second hop, or at a page that never settles. robots.txt is usually optional, rate limits are usually the caller's problem, and the caps show up after the bill.

web-widow puts those decisions in the request path. Every request and every redirect hop passes the same gate. The address classes, the scheme allowlist, the body caps and the robots rules are enforced in the server, not documented as advice. Two settings can widen reach. They live in a 0600 config file, and one of them announces itself at startup.

The other half is memory. A page an agent fetched once should still be there tomorrow, searchable without a network call and without shipping your corpus to someone else's index. So the store is SQLite, the blobs are content addressed, full-text search is FTS5, and semantic search runs on a local model.

What it does

The tools are grouped here by the job they do. The full reference, with every field and cap, is at the end.

Read one page

fetch_page turns one URL into Markdown plus metadata. mode chooses main (readability, the default), full, text, or raw. You get title, byline, site name, publish time, language, word count, and optional links (URLs only, off-site links flagged). Truncation is always reported, never silent.

Pages that need JavaScript are rendered in an in-process Chrome, which is part of the default build:

  • render: "never" is static HTTP only.
  • render: "auto" is the default. It renders only when the static result looks thin and the page looks like an application shell.
  • render: "always" renders first and fails loudly if it cannot.

A rendered page comes back through the same extractor, blob store and persistence path as a static one, with render_mode telling you which happened: rendered, rendered_partial or static_fallback.

If you only read documentation sites, build without the render feature and you will never miss it.

Search what you already read

There are three search tools, and the split matters.

Tool What it answers
search Web discovery. DuckDuckGo returns titles, URLs and snippets for one page of at most ten results. It never fetches a result page and never stores anything.
search_content Local full-text search over pages you already fetched. FTS5, every term required, title weighted 4× the body, capped plain snippet. No network.
search_semantic Local similarity search over the same store, using a configured local model (minilm-l6-v2-q or multilingual-e5-small). No download at query time, no API key.
embedding_status Coverage for the semantic index: embedded pages and chunks, pending pages, last error. Read-only.

search finds URLs. search_content and search_semantic search your store. A search call makes at most two SERP requests and writes nothing.

Semantic search uses whichever model the operator configured (minilm-l6-v2-q for English, multilingual-e5-small for mixed languages); the response's model field names it. Treat its results as retrieval candidates, not authority.

Pull structure out of a page

extract runs a declarative CSS spec over the page's own DOM and returns typed records with per-field errors. A spec is data: a container selector and named fields with optional attr, all and one of six transforms. There is no XPath, no regex, and no expression language.

extract_rows is the tabular sibling. It reads CSV and TSV (RFC 4180 quoting, delimiter sniffing, BOM and CRLF), JSON through an RFC 6901 pointer, and HTML tables. It is the only tool that fetches text/csv and text/tab-separated-values.

recipe_save, recipe_list and recipe_apply turn a spec into a named, versioned artifact. Applying a recipe is exactly extract with the stored spec, so the guards and caps are identical.

Read documents and lists

Tool What you get
pdf_extract One PDF's text layer as ## Page N Markdown, with document metadata and an explicit ok, no_text_layer or partial outcome. No OCR.
sitemap URL entries from <urlset>, <sitemapindex> or a plain-text sitemap, gzip included. Index children are followed one level. lastmod is returned as data and schedules nothing.
fetch_feed Items from one RSS 2.0, Atom or JSON feed in feed order, deduped by id and canonical URL, with absolute URLs and plain summaries. Item pages are not fetched.

fetch_page and extract refuse PDFs on purpose and name pdf_extract in the error. Only the tool that understands a format is allowed to fetch it.

Watch a page for change

Each monitor stores a snapshot per check: the extracted Markdown, normalized for line endings, trailing whitespace, blank-line runs and zero-width characters. A check is classified none, cosmetic or substantive. A monitor can also watch declared fields, so an attribute-only price change still counts.

Tool What it does
monitor_create Add a URL, an interval, optional field schema and ignore_selectors.
monitor_list Monitors in id order, with due times and labels.
monitor_check Check one monitor, or all due monitors with a bounded wait.
monitor_changes Newest-first change history with stats and a capped unified diff.
monitor_delete Tombstone. History stays queryable.
events The same change history as JSON or RSS 2.0.
webhook_target, webhook_status Attach operator-configured webhook targets and inspect delivery state.

Webhook targets are named in the config file only. A tool never accepts a URL, so page content or a prompt-injected agent cannot introduce an endpoint. Deliveries are HMAC-signed, retried with backoff, and dead letters stay visible.

For cron and systemd, run-due checks every due monitor once, prints one JSON summary and exits. If the server already runs, run-due --http talks to it over loopback instead of opening the data directory.

Crawl a site, carefully

crawl_start, crawl_status, crawl_results and crawl_cancel run a bounded crawl. The frontier lives in SQLite and deduplication is a primary-key constraint, so a URL cannot be enqueued twice even if a caller forgets to check. Workers lease rows, which means a killed process resumes instead of starting over.

Scope is depth, site, path prefixes and exclude patterns. When a page's content was already seen in the same job, the page is stored but its links are not followed, so a calendar trap stops at the first duplicate instead of eating the page budget. Hit a limit and the job ends done with limits_hit naming which one.

Drive a page when you need eyes, not text

screenshot renders one URL through the same gate as fetch_page and stores a PNG in the content-addressed store. The payload carries the hash, size, MIME and CSS-pixel dimensions, never base64.

interact_open, interact_act, interact_state and interact_close hold one page per process for front-end work. The loop is observe, act, observe, so one failed selector does not destroy the plan. The action set is closed: click, type, wait, scroll. There is no caller JavaScript, no eval field and no XPath. Type can enter text into a form, so never type credentials into a page you do not trust.

Move data out

corpus_export writes pages and their extractions as JSONL or a Markdown directory under <data>/exports/, streamed page by page with a record and byte cap. Monitors and recipes are not corpus rows; monitor history is monitor_changes and the recipe library is configuration.

snapshot_compare diffs two snapshots from the same monitor, or two fetch events for the same canonical URL, and reports field changes for a schema monitor.

blob_get resolves a stored hash to a path, size, MIME and the rows that reference it. It returns no bytes: read the file with your own tools.

Inspect the machine without touching the network

robots_cache lists the local robots cache and probes a path from the cached body, returning allow or deny, the matched rule, Crawl-delay and expiry. Zero network requests, and a test asserts the fixture server sees none.

What it does not do

  • No login-gated or paywalled content by default. Authenticated fetching is operator-configured, per-site opt-in, and return-only unless the operator opts in to persistence.
  • No OCR, no PDF images, no forms, no PDF JavaScript.
  • No proxy rotation, no distributed crawling, no multi-user auth.
  • No CAPTCHA solving.
  • No caller JavaScript in interaction sessions.
  • No OR, NEAR or prefix operators in local full-text search. Terms are quoted and ANDed.
  • Sitemap lastmod does not schedule, order or monitor anything.
  • A monitor watches one URL. Multi-page "watch a site" semantics do not exist yet.

Getting started

Prerequisites

Need When Notes
Rust 1.99.1 always Pinned by rust-toolchain.toml.
Chrome or Chromium only for rendering Loaded at runtime. The verified test binary is Chrome for Testing 156.0.8078.4.
libpdfium.so (8125) only for pdf_extract Loaded with libloading. The binary does not link it, so ldd will not list it.
ONNX Runtime 1.31.0 and the model files only for search_semantic Loaded at runtime. Missing files are a typed error, not a crash.

Build

cargo build --release                          # stdio server, render on
cargo build --release --features http          # + loopback streamable HTTP
cargo build --release --no-default-features    # static only, no Chrome
./target/release/web-widow --help
Build Render HTTP Use
default yes no MCP clients that spawn a child process
--features http yes yes long-lived HTTP clients
--no-default-features no no hosts without Chrome
--no-default-features --features http no yes static-only HTTP host

The render feature is on by default because rendering ships in the delivered binary. --no-default-features drops chromiumoxide and keeps every static path working; render: "always" then returns render_unavailable.

A musl build works from the same source when the target is installed:

rustup target add x86_64-unknown-linux-musl
cargo build --release --target x86_64-unknown-linux-musl

The dependency gate is part of the build contract:

cargo deny check    # licenses, advisories, bans, sources
cargo audit         # RustSec advisories

Configure and run

install -d -m 700 ~/.config/web-widow
install -m 600 config.example.toml ~/.config/web-widow/config.toml
install -d -m 700 "${XDG_DATA_HOME:-$HOME/.local/share}/web-widow"

web-widow --config ~/.config/web-widow/config.toml serve

Set fetch.contact to a real address you read. It becomes part of the User-Agent, and it is how a site operator reaches you.

The data directory must be 0700. The config file should be 0600; the server warns at startup if group or other can read it. One process per data directory, enforced by an advisory lock that names the holding pid.

Connect an agent

A stdio client spawns the binary and speaks MCP on stdout; logs go to stderr. A minimal exchange:

{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2026-07-28","capabilities":{},"clientInfo":{"name":"me","version":"1"}}}
{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"fetch_page","arguments":{"url":"https://example.com/","mode":"main","include_links":true}}}

The result is a text block with YAML-ish front matter and the Markdown body, plus structuredContent.

The server is half the pair. The other half is the field-guide skill in skill/web-widow/SKILL.md, which teaches an agent how to pick a tool, read the payload, tell rendered from static content, and treat a blocked_* refusal as final. SKILL-INSTALL.md covers installing both. A server without the skill is a set of tools an agent does not know how to use; the skill without the server is advice with nothing behind it.

Run it over HTTP

WEB_WIDOW_HTTP_TOKEN="$(cat ~/.config/web-widow/http-token)" \
  web-widow --config ~/.config/web-widow/config.toml serve --http 127.0.0.1:8765

The endpoint is http://127.0.0.1:8765/mcp. Every request needs a bearer token. The transport is stateless, POST only, and refuses a non-loopback bind unless --allow-non-loopback is passed deliberately. Local HTTPS is available on the same listener with [http].tls = true; see Running it.

Configuration

A config file is optional. The defaults in config.example.toml are what the binary uses.

[fetch]
contact = "crawler@example.com"    # part of the User-Agent
allow_hosts = []                   # exact hosts or CIDRs; config file only

[storage]
# data_dir defaults to $XDG_DATA_HOME/web-widow; must be 0700

Two settings widen reach, and both exist only in the config file:

  • fetch.allow_hosts permits private addresses or named hosts. Every match is logged at info.
  • robots.enabled = false disables the robots check and announces itself loudly at startup.

Neither is reachable from the MCP tool surface, an environment variable or a CLI flag. That is the point: an agent cannot widen its own reach.

What each section bounds

Section Bounds Default posture
[fetch] Contact, timeouts, redirects, body and header caps, per-host interval and concurrency 10 MiB body, 64 KiB headers, 5 redirects, 30 s total, 1 request/s per host
[robots] robots.txt cache lifetime and body cap Enabled, user-agent group web-widow
[extract] Output mode, Markdown and record caps, cache freshness 200 000 chars, 5 000 records, 300 s
[feed], [sitemap] Item and URL caps, summary and body caps, index children 20 items, 5 000 URLs, 5 children
[pdf] PDFium path and discovery, body, page and character caps 32 MiB, 200 pages, 1 000 000 chars
[search], [fts] DuckDuckGo endpoints, query and result caps, index and snippet caps 10 results, 50 000 indexed chars, 320-char snippet
[render] Chrome path, concurrency, settle and ceiling, per-page bytes and requests, restarts 2 pages, 500 ms settle, 10 s ceiling, 5 MiB, 200 requests
[interaction] Session TTL and action ceiling 120 s idle, 60 actions
[crawl] Server ceilings for a crawl job, lease, attempts 5 000 pages, depth 5, 30 min, 3 attempts
[monitor] Interval bounds, diff cap, bulk-check wait 60 s to 30 days, 20 KiB diff, 30 s wait
[events] Change feed route and item count Enabled, 100 items
[webhooks] Targets, retries, HTTP allowance Disabled, HTTPS only, 5 attempts
[embeddings] Local model, chunking, backfill pacing Disabled, no network
[scheduler] In-process due-check timer Disabled
[http] TLS mode and operator PEM pair Plain HTTP, loopback only
[auth] Credential managers, profiles, persistence, audit retention No profiles, return-only
[retention] Event, extraction, screenshot, webhook and snapshot windows, blob budget 30 days, 20 snapshots, 20 GiB
[logging] Level, JSON, query redaction Info, text, queries redacted

Rendering

[render]
# chrome_path = "/usr/bin/chromium"   # recommended; config file only
discovery = true                      # else check $CHROME_PATH and well-known paths
max_concurrent_pages = 2
settle_ms = 500                       # network-quiet window after the load event
ceiling_ms = 10000                    # hard navigation ceiling, yields rendered_partial
max_bytes = 5242880                   # 5 MiB transferred per page
max_requests = 200                    # requests per page
restart_max = 3
restart_window_s = 600
launch_timeout_ms = 20000

Chrome is discovered lazily at the first render call. If none is found, static requests keep working and render: "always" returns render_unavailable naming render.chrome_path and the locations it checked. chrome_path is config-only, so an agent cannot point the browser at an arbitrary executable.

Credentials

Authentication is config-only. A secret reference (op://, bw://, pass://) lives in the 0600 config file; the agent names an operator-defined profile, and only through fetch_page.profile. No other tool accepts a credential-bearing key, which is schema_invalid before dispatch.

A profile is bound to an exact host:port. It attaches to that origin and never to a subdomain. The default is return-only: no stored body, no blob, no index row, no event. See Authenticated fetching.

Safety and politeness

These are features, not a disclaimer. They are the reason an agent can be given a URL without also being given your network.

The gates run on every request

Gate Rule
Scheme http and https only
Address No loopback, private, link-local, CGNAT, metadata, multicast or reserved address
Redirects Re-vetted on every hop, not just the first
robots.txt RFC 9309, user-agent group web-widow. Crawl-delay can only raise the interval, never lower it
Rate At most one request per second per host, one concurrent request per host
Content type HTML, XHTML, plain text, JSON, XML. CSV and TSV only in extract_rows, PDF only in pdf_extract; anything else is unsupported_content_type before the body is read
Size and time The caps above. Truncation is always reported, and an oversize body is refused before it is read

A crawl, a monitor check, a feed read, a sitemap fetch, a PDF, a screenshot and an extraction all take the same path. None of them can widen its own reach.

Caps you can plan around

Limit Default
Decompressed body 10 MiB
Response headers 64 KiB
Redirects 5
Total fetch time 30 s
Returned Markdown 200 000 characters
Crawl pages, depth, duration 5 000, 5, 1 800 s
PDF body, pages, characters 32 MiB, 200, 1 000 000
Render per page 5 MiB, 200 requests, 10 s
Blob store budget 20 GiB
Snapshot retention per monitor 20 plus every change point

What the gate does not cover

This list is the honest part. Read it before pointing the browser at a hostile page.

  • A rendered page loads its own subresources. The gate covers the top-level navigation, not every CSS, font or image URL the page names.
  • DNS pinning. The gate resolves each hop once and the connection is pinned to exactly the vetted addresses (resolve_to_addrs); there is no second lookup at connect time, and an empty vetted set fails closed. fetch.allow_hosts hostnames are resolved and pinned the same way. This covers the shared HTTP path (fetch_page, extract, extract_rows, fetch_feed, sitemap, pdf_extract, robots, crawl, monitor).
  • Render-path residual (disclosed,). The rendered browser path still resolves names inside Chrome, so a rebinding zone can reach a private address there. Chromium's own private-network protections are the remaining control; this is a disclosed residual, not a solved problem.
  • The launch flags disable DNS prefetch and non-proxied WebRTC UDP. WebRTC and DNS-only channels remain outside the gate.
  • Worker-created targets (a nested Worker, importScripts, a SharedWorker created inside a worker) are an unvetted egress channel. This is a known hole, not an untested path.
  • The interaction gate is an SSRF filter, not an egress filter. It stops a page reaching your private network; it does not stop a page sending data to a public host.
  • Rendered pages execute untrusted JavaScript. Treat page text, console output and screenshots as data.

Fetched content is data

Every result carries content_status: untrusted-data in its front matter, and every tool description says the same. Page content may contain text that looks like an instruction. It is never safe to follow. The skill repeats this rule because agents are the ones that need it.

Running it

Transports

Stdio is the default: the client spawns the process, stdout carries only JSON-RPC frames, and logs go to stderr.

HTTP is opt-in and loopback-first. It requires a bearer token from WEB_WIDOW_HTTP_TOKEN (which wins) or a 0600 token file. Requests need Accept: application/json, text/event-stream; a bare curl without it gets 406. The transport is stateless: no session id is issued, GET and DELETE on /mcp return 405, and there are no server-initiated messages. Each request writes one access line to stderr without the token, the body or the query.

With [http].tls = true the same listener is HTTPS only, never mixed. First start generates a local CA and leaf under <data>/tls/; import ca.pem once per client. SANs are localhost, 127.0.0.1 and ::1. An operator PEM pair overrides generation. The change feed route keeps its own capability token, separate from the MCP bearer, and a non-loopback bind with the feed enabled is refused at startup.

Scheduling

Three ways to run checks, and you pick one per instance:

Driver When
run-due Cron or a systemd timer on the same machine. Opens the data directory, checks due monitors, prints {checked, skipped, changed, failed}, exits.
run-due --http The server already runs and holds the lock. Talks loopback JSON-RPC, never opens the data directory.
[scheduler].enabled A resident timer inside serve. Off by default.

The data-directory lock enforces one driver. A local run-due fails while the server runs; run-due --http remains valid and cannot double-check because of the per-monitor lock and a next_due_at re-read. Enabling the in-process timer means removing any cron entry for that instance.

Data and retention

SQLite in WAL mode with one writer, BLAKE3 content-addressed files for raw bytes, one row per canonical URL, conditional GET, and a retention pass at startup. Events and extractions age out after 30 days by default, screenshots after 30, webhook rows after 30 with dead letters at 90, and the blob store is budgeted at 20 GiB. The full-text index lives inside the database, so it is not part of that blob budget.

Back up with VACUUM INTO, and back up the blob directory too. Migrations are forward-only, and an older binary refuses a newer schema, so rolling back the binary means restoring a pre-migration backup. The stop, backup, install, start and verify runbook is in docs/operations.md.

Reference

The sections above describe intent. This part is the contract.

fetch_page payload

Text block: YAML-ish front matter, then the Markdown body. structuredContent carries url, final_url, status, content_type, title, byline, site_name, published, lang, markdown_chars, markdown, truncated, limit_hit, render_mode, optional render_warning, cached, fetched_at, validated_at, last_attempt_at, last_attempt_failed, duration_ms, links, links_requested, links_truncated, optional render_quality, optional content_warning, word_count.

  • links is always a list. It is [] when include_links was false or omitted; links_requested says which request shape produced the answer. A cached answer re-derives links_requested from the current call. A client that used links: null to mean "not requested" must read links_requested.
  • markdown is the delivered body — the Markdown the text block carries, without the front matter — when include_content is true (the default). include_content: false omits it from structuredContent and turns the text block into a one-line metadata summary (url, status, title, words, render_mode). The body crosses twice when included; the cache stores it once and a cache hit reconstructs it. max_chars/markdown_chars bound it.
  • render_quality is ok or thin (fewer than 200 main-content words) on rendered fetch_page and extract results. It is absent on static and static_fallback, where a short page is simply a short page. It is not part of crawl_results.
  • Freshness facts. Every content result carries four independent facts (schema v11). fetched_at is the capture of the body/records/snippet you got back. validated_at is the last successful origin confirmation of that same representation: a usable 200 sets capture = validation; a 304 sets it only when the validators actually sent belong to the write that produced the served row; a local cache read uses that row's own write's confirmation; a failed attempt and an unclassifiable 304 leave it null. last_attempt_at is the completion time of the last recorded terminal attempt, and last_attempt_failed is false (usable 200 or bound 304), true (terminal failure) or null (unknown: no attempt, or a 304 that could not be bound). Attribution is row → write (pages.write_seq, extractions.source_write_seq), never a content hash, so two representations with identical Markdown cannot borrow each other's confirmation.
  • content_warning: "interstitial_suspect" is set only for the whole conjunction: status 200, the final URL drifted from the requested URL in host or path, the final path has a whole verification/login segment (account-verification, verification, verify, challenge, captcha, login, sign-in, signin, security-check, checkpoint, auth, authorize, validate, case-insensitive), and word_count < 50. It is a warning, never an error, and the body is still delivered; it appears in the text front matter too. A direct login page (no redirect drift) and a short article on a normal path do not warn. render_quality and render_mode keep their meanings independently.

Errors are in-band: isError: true with structuredContent.error = { code, message, detail? }, using the codes from (invalid_url, blocked_scheme, blocked_private_address, blocked_by_robots, dns_error, tls_error, timeout, too_large, unsupported_content_type, http_error, render_unavailable, ...).

Error code families

invalid_url, blocked_scheme, blocked_private_address, blocked_by_robots, dns_error, tls_error, timeout, too_large, unsupported_content_type, http_error, render_unavailable, render_failed, extraction_failed, schema_invalid, not_found, watermark_expired, embedding_unavailable, session_busy, session_expired, session_not_found, limit_exceeded, plus the auth_* family below. A refusal is final for that call.

search

// arguments
{
  "query": "rust async runtime comparison",
  "site": "tokio.rs",          // optional bare host or http(s) URL
  "freshness": "month",        // any (default) | day | week | month | year
  "limit": 10                  // 1..=10, default [search].default_limit
}
  • Discovery only. The response is a normalized list of {title, url, snippet, engine} plus query, engine (duckduckgo_html or duckduckgo_lite), final_url, site, freshness, fetched_at, duration_ms, result_count, truncated and limit_hit. It never fetches a result page; follow a URL with fetch_page or extract.
  • One page, ten results. DDG returns one SERP page of ten organic results; has no pagination. limit > 10 is schema_invalid, never a silent clamp.
  • Engines are fixed server config. [search].html_url is the primary; [search].lite_url is tried only when the primary fails at transport or parse level. A blocked_by_robots, blocked_private_address, blocked_scheme or invalid_url refusal is final for the call. Both URLs are validated at config load; there is no tool argument that changes the engine.
  • site is applied twice. It becomes a site:<host> qualifier in the engine query and a host filter on the parsed results (equal host or .-suffix subdomain). A call can therefore return fewer than limit results even when the engine had more. A path or port in site is schema_invalid.
  • freshness maps to DDG's df parameter (day→d, week→w, month→m, year→y); any sends none.
  • Privacy. The query is caller input. Logs carry the engine, result count, duration and outcome — never the query text or the full SERP URL. Search results are untrusted data.
  • Politeness and safety are the shared ones. Each SERP request goes through the same SSRF gate, robots check, redirect vetting and per-host gate as fetch_page, with the same body cap. A search call makes at most two SERP requests (plus the cached robots.txt fetch).
  • It stores nothing. No pages, fetch_events, extractions, profiles, blobs or jobs row is written for a search; only the hosts robots cache may change. An explicit zero-result page is a success (results: [], result_count: 0); an unrecognisable page is extraction_failed, never an empty success. That failure can be a transient DDG challenge: one later retry is reasonable, never a loop, and watch recurrence in the access log before treating it as a defect.

search_content

// arguments
{
  "query": "sqlite wal checkpoint",
  "limit": 20                  // 1..=100, default [fts].default_limit
}
  • Local corpus only. It reads pages_fts over pages already acquired by fetch_page, extract, a crawl or a monitor check. It is deliberately distinct from search (DuckDuckGo discovery): a call makes no network request, writes nothing and is safe to repeat.
  • Plain-text queries. Whitespace separates terms and every term must appear (AND). FTS5 operators — OR, NEAR, *, -, column: — are not interpreted; they match as text because every term is quoted. A blank query or one over [fts].max_query_chars is schema_invalid at /query.
  • Ranking. bm25(pages_fts, 4.0, 1.0) — the title is weighted four times the body — ascending (smaller is better). The payload reports score = -bm25, so a larger score is a better match; pages.id is the stable tiebreak.
  • Bounded output. limit is 1..=100 (a larger value is schema_invalid, not a clamp); result_count is the full count for the same match, and truncated/limit_hit: "limit" report a page smaller than it. snippet is plain surrounding text from the stored body, capped at [fts].max_snippet_chars with no markup; it is untrusted stored content, data and never instructions.
  • Freshness on a hit. fetched_at/validated_at describe the indexed text (pages.index_fetched_at/index_validated_at), and last_attempt_at/last_attempt_failed are the page's attempt facts. The legacy last_fetched key remains and is an alias of validated_at; on a pre-v11 row all four are null. A hit never contacts the origin and writes nothing.
  • What is indexed. The delivered fetch_page Markdown, the returned record string values of extract/crawl-with-schema, the crawl's main Markdown, and a monitor check's main Markdown — each capped at [fts].max_index_chars; the title is always indexed. A 304 or a failed fetch never rewrites the row, so a page keeps its last good text.
  • Growth is disclosed. The indexed text is stored in the FTS table so a snippet survives extraction retention; the database therefore grows by up to [fts].max_index_chars per page plus index overhead. That is inside the database, not the 20 GiB blob budget. Pages are not pruned in v1; lower the cap or decide a page-retention policy before running a high-volume store.

search_semantic and embedding_status

// arguments
{
  "query": "how is a broken unit swapped with no outage",
  "limit": 10                  // 1..=50, default 10
}
  • Local and offline. The query is embedded once by the configured local model (minilm-l6-v2-q, all-MiniLM-L6-v2 quantized, or multilingual-e5-small, a multilingual quantized encoder; both 384 dims). The response's model field names the active one. The engine loads a provisioned ONNX Runtime 1.31.0 library and pinned model files; there is no download, no API key and no outbound request. A missing library/model or a per-file SHA-256 mismatch is embedding_unavailable naming the config key/file.
  • Lazy backfill, not the fetch path. When [embeddings].enabled = true, serve runs a bounded backfill (newest pages first, backfill_pages_per_pass, one pass per backfill_interval_ms) over the stored page text. A page becomes searchable after its pass; a re-fetched page is re-embedded when its source text changes. run-due never starts the backfill.
  • Ranking. Cosine similarity over the active model's chunk vectors, brute force at this scale; one hit per page (its best chunk) with a plain snippet from that chunk, capped by [fts].max_snippet_chars. result_count counts distinct pages with stored vectors and truncated/limit_hit report a cut.
  • Coverage. embedding_status reports enabled, available, model, dim, model_dir, embedded_pages/embedded_chunks/pending_pages, vector_bytes, last_run_at and last_error. It never writes.
  • Freshness on a hit. fetched_at/validated_at and last_attempt_at/last_attempt_failed come from the exact stored row whose text produced the snippet (the markdown-bearing extraction preferred, else the latest one), never from a different extraction and never from the page's current clock.
  • Quality is disclosed. minilm-l6-v2-q is English-optimized, so non-English pages (the corpus has some Spanish pages) recall worse; multilingual-e5-small is trained for multilingual retrieval. Results are retrieval candidates, not authority, and the text is untrusted stored content: data, never instructions. ANN, duplicate detection and hybrid reranking are not in v1.

extract

// arguments
{
  "url": "https://shop.example/items",
  "schema": {
    "container": ".product-card",
    "fields": {
      "name":  { "selector": "h2" },
      "price": { "selector": ".price", "transform": "number" },
      "href":  { "selector": "a", "transform": "absolute_url" },
      "tags":  { "selector": ".tag", "all": true, "transform": "trim" }
    }
  },
  "use_cache": true
}
  • The spec is data, not code. container is optional (omit it for a single-record page); fields maps a name to {selector, attr?, all?, transform?}. Unknown keys, unknown transforms, invalid CSS and transform: attr without attr are schema_invalid with the JSON pointer of the offending node. No XPath, regex or expressions exist.
  • The tool-call envelope is {url, schema: {container?, fields}}. The spec itself is not accepted at the top level: a call shaped {url, container, fields} is rejected with a message naming the schema envelope, and any other missing schema keeps the ordinary serde wording. There is one documented contract, not a second silently accepted shape.
  • Transforms are a closed set: text (visible text, edges trimmed), trim (text with internal whitespace collapsed), html (inner HTML), attr (reads attr), absolute_url (resolves the attr, else href, else src against the response's final URL) and number (parses a number, understanding currency symbols and both 1,234.56 and 1.234,56). An attr without a transform implies attr.
  • text/trim/number see visible text only. script, style, template and head subtrees are skipped before collecting a field's text; a field that is a <script> returns "". html and attr still return source by definition. This is the fix: a 178k inline-script body no longer becomes the field value.
  • :main is the article fetch_page mode=main delivers. container: ":main" (exact, trimmed) evaluates fields inside the body of that same readability article — one readability pass per acquisition, so the scope and the delivered Markdown describe the same source. The article wrapper <html>/<head> is never a field root. If readability finds nothing usable, the scope falls back to the document body. It works identically for extract, crawl_start and monitor_create. ":main" as a field selector is still invalid CSS and returns schema_invalid at that field's pointer.
  • selector: "*" is the record scope itself. A field selector of exactly * (trimmed) selects the scope element, not its first descendant: text → its visible text, html → its inner HTML, attr → the named attribute, and all: true → a one-element array. With no container the scope is the document root, so * is the page's visible text. Any other selector (including * .item or div *) keeps ordinary CSS semantics.
  • Field selectors are descendant-scoped within the record root (the container element itself is not a match, except for the * form above).
  • Failures are explicit. A scalar selector that matches nothing is reported as selector_no_match with the field absent — never null or "". An all: true field that matches nothing is an empty array. Transform failures are attr_missing, url_join_failed or number_parse_failed. A container that matches nothing returns records: [] plus a page-level error (record: null), never a fabricated record.
  • Caps and counts. Records are capped by extract.max_records (5 000); record_count is the full match count and truncated/limit_hit (max_records) say so. Two additive presentation caps bound the response: max_field_chars (default [extract].max_field_chars, 16 384) cuts every string value and array element and reports truncated_fields; max_chars stops records in evaluation order at the serialized budget and reports limit_hit: "max_chars". Precedence is max_records → max_chars → max_field_chars. The cache stores the full records (caps are presentation-only), so a later larger-cap call still sees the full values.
  • Rendered thin signal. render_quality: "ok" | "thin" is present on rendered/rendered_partial extract results (an approximation from the delivered page's visible words), absent on static/static_fallback, and also in the text front matter.
  • Evaluation is independent of Markdown. The spec runs over the parsed DOM with one parse per page, so content that mode=main omits from its Markdown is still reachable by a spec (see in the milestone plan).
  • Reuse. use_cache: true may answer from a stored extraction for the same page and spec inside extract.cache_freshness_s, otherwise the page is revalidated and a 304 reuses the stored result. profiles stores each spec once, keyed by the BLAKE3 hash of its canonical JSON. The spec text is part of that identity, so the :main scope change and the * meaning do not change profiles.hash: a record cached under the pre- semantics can be served for up to extract.cache_freshness_s (default 300 s) after an upgrade — use use_cache: false when the new scope matters immediately.
  • Freshness facts. fetch_page's four facts apply here too, bound to the served extraction row: a 304 sets validated_at only when the validators sent belong to that row's write, and a cached answer uses that row's own capture plus its write's confirmation. A failed attempt advances neither clock.
  • Empty is a value. A matched text field with nothing visible returns "" and is not a field_error; field_errors reports selectors/attributes that did not match.

extract_rows

// arguments
{
  "url": "https://example.com/prices.csv",
  "format": "auto",            // auto | csv | tsv | json | html_table
  "selector": "table.results", // html_table only; first <table> when omitted
  "delimiter": ",",            // csv only; omit to sniff
  "header_row": true,          // csv/tsv/html_table default true
  "json_pointer": "/items",    // json only; default "" (document root)
  "limit": 200,                // 1..=1000
  "max_field_chars": 8000,     // 1..=20000
  "render": "auto",            // html tables only: auto|never|always
  "use_cache": false
}
  • A sibling of extract, not a mode. extract stays CSS-over-HTML and its identity stays profiles.hash; tabular input has its own spec ({format, selector?, delimiter?, header_row, json_pointer?}), stored in the same profiles table. fetch_page and extract keep their content scope and still refuse text/csv; only this tool's fetch adds text/csv and text/tab-separated-values to the media allowlist. robots.txt, the SSRF gate, the per-host politeness floor, charset decoding and the body caps are the same shared path.
  • format: auto uses the response media type (application/json/+json, text/csv, text/tab-separated-values, text/html/XHTML); anything else is sniffed from the first 4 KiB ({/[, a tab/semicolon/comma header). An application/octet-stream body is unsupported_content_type, never guessed. An explicit format wins over both.
  • CSV/TSV: RFC4180 quoting ("", embedded delimiters and newlines), CRLF or LF, a UTF-8 BOM, and the response charset. The delimiter is sniffed from the header line (unquoted counts; a tie keeps ,) unless delimiter is given. Headers are trimmed; blank → column_N; repeats → name_2. Ragged rows put null in the missing fields and column_N for extra values, and each anomaly is a bounded field_errors entry (20, then field_errors_truncated: true). An unclosed quote is extraction_failed naming the line and byte.
  • JSON: an RFC6901 pointer selects the record set. An array of objects is one record per element, a single object is one record, and an array with no object element becomes {"value": …} per element. Numbers, booleans, null and nested arrays/objects keep their JSON type. A bad pointer, a scalar target or a mixed array is schema_invalid at /json_pointer with the observed shape.
  • HTML table: selector picks the table (first <table> when omitted). Headers come from <thead> when present, else the first row; cells are visible text. colspan/rowspan are not expanded in v1 — the cell text appears once and the table carries one span_ignored note. A selector that matches no table is a table_not_found note with zero records, not an error.
  • Bounds: limit caps returned records and row_count reports what was parsed (one extra row proves truncation: truncated + limit_hit: "limit"). max_field_chars caps each string value and counts truncated_fields.
  • Store and search: the extraction row keeps the uncapped records with record_count = returned, and the row text is indexed fill-empty: it gives a page its first indexed text and never replaces delivered page Markdown. A later search_content finds row values; use_cache: true reuses a stored result for the same URL and spec inside extract.cache_freshness_s.
  • Errors use the existing taxonomy: unsupported_content_type when nothing classifies, schema_invalid at /format, /selector, /json_pointer, /delimiter, /limit, /max_field_chars, and extraction_failed for an unclosed quote or invalid JSON.

recipe_*

// recipe_save
{
  "name": "shop:products",
  "schema": {"container": ".product-card", "fields": {"name": {"selector": "h2"}}},
  "description": "product cards on the shop"
}

// recipe_apply
{
  "name": "shop:products", "version": 1,
  "url": "https://shop.example/items", "use_cache": true
}
  • CSS-spec only in v1. A recipe's schema is exactly the extract envelope ({container?, fields}), validated by the same validator with the same JSON pointers. Tabular (extract_rows) specs are per-call arguments, not recipes.
  • Name is identity. Lowercase [a-z0-9][a-z0-9._-]{0,63}, optionally one :slug segment (shop:products). Uppercase, whitespace and slashes are schema_invalid at /name; there is no rename (save under a new name) and no delete in v1 — history stays resolvable.
  • The spec stays in profiles. recipes/recipe_versions hold only the name, the current version and a pointer to the content-addressed profile hash. An identical save is a no-op (changed: false); a description-only save updates metadata without a bump; a changed spec writes version N+1 while N keeps applying. A monitor created on an earlier version's profile_hash is unaffected by the advance.
  • recipe_apply is extract. It resolves the stored spec and runs the ordinary extraction pipeline: robots.txt, the SSRF gate, the body caps, render, use_cache and max_field_chars/max_chars all behave exactly as extract. The response is the normal extraction payload plus recipe, version and profile_hash; the extraction is stored (and row text indexed fill-empty) exactly as extract does. An unknown recipe or version is not_found; version 0 is schema_invalid at /version.
  • recipe_list returns {name, version, profile_hash, description?, updated_at} in name order; prefix is a literal name prefix (not a pattern), include_schema: true adds the stored canonical spec, and limit is 1..=200 (default 50) with count/total/truncated. Read-only: no network.

pdf_extract

// arguments
{
  "url": "https://example.com/report.pdf",
  "max_pages": 200,            // 1..=[pdf].max_pages (default 200)
  "max_chars": 1000000         // 1..=[pdf].max_chars (default 1 000 000)
}
  • Text layer only. The document's text is returned as Markdown with one ## Page N section per page in range, plus metadata (title, author, subject, creator, producer, creation/modification dates — absent values are null) and pages / declared_pages (PDFium's page count) / pages_with_text / empty_pages (bounded to 20 with empty_pages_truncated). No OCR, no images, no forms, no JavaScript.
  • Outcomes. ok = every page parsed and text exists; no_text_layer = every page parsed and none has text (a successful call: an OCR decision is explicit); partial = extraction stopped before the declared page count (a page error or a cap). A page that fails stops extraction rather than presenting a short result as complete.
  • Caps. Body [pdf].max_bytes (default 32 MiB); max_pages and max_chars may only lower the server ceilings; truncation is at a page boundary with truncated/limit_hit. A single first page larger than max_chars is cut at the character cap (documented edge case) so the delivered Markdown stays bound.
  • Typed failures. pdf_encrypted (a real user password; an empty-user-password PDF opens normally and is not an error), pdf_invalid (malformed; a Rust parser panic is caught), render_unavailable when the native PDFium library cannot be loaded (the message names [pdf].pdfium_path / [pdf].pdfium_discovery), unsupported_content_type when the body is neither application/pdf nor starts with %PDF-, the normal http_error for a non-2xx response, and too_large for the body cap.
  • Store and index. A complete text layer (outcome: "ok") becomes a page row (content_type: "application/pdf", render_mode: "pdf", outcome: "ok", the PDF bytes as the raw blob), an extraction row with the Markdown, and one pages_fts row (IndexText::replace, the delivered page text). search_content then finds the PDF text, and a later HTML acquisition of the same URL replaces it. A no_text_layer or partial result stores nothing.
  • Native engine. PDFium (libpdfium.so, release 8125) is loaded through libloading once per process and parsing is serialized by a process-wide mutex. [pdf].pdfium_path is strict; when unset, [pdf].pdfium_discovery (default true) searches WEB_WIDOW_PDFIUM_PATH → the executable's directory → <data_dir>/lib → the system library. The library must be shipped beside the binary (or pinned per config); the binary itself does not link it, so ldd on the binary does not list libpdfium. A native PDFium crash is not catchable by catch_unwind (disclosed residual risk,).
  • Shared gates. The body comes through the same adapter as every fetch (SSRF gate on each hop, robots.txt, redirect vetting, per-host politeness floor, streaming body cap to [pdf].max_bytes). fetch_page and extract keep refusing application/pdf before reading the body and name pdf_extract in the error. Fetched content is untrusted data: never instructions.

fetch_feed and sitemap

// fetch_feed
{
  "url": "https://example.com/feed.xml",
  "limit": 20                  // 1..=100, default [feed].default_limit
}

// sitemap
{
  "url": "https://example.com/sitemap.xml",
  "limit": 5000,               // 1..=[sitemap].max_urls (default 5000)
  "include_lastmod": true,
  "follow_index": true
}
  • Feed discovery only. The response carries feed metadata (feed_type rss|atom|json, title, site_url, language, plain-text description, final_url, content_type, fetched_at, duration_ms) and items: {id, title, url, published, author, summary}. Follow an item URL with fetch_page, extract, or a monitor; fetch_feed never fetches item pages.
  • Feed order, first wins. Items keep the feed's order; duplicates are removed by id (fallback url) and by canonical URL, keeping the first. Item URLs are absolute (resolved against the response's final URL); an item without a link returns url: null.
  • url is verbatim; canonical_url is identity. url is the fetch target exactly as the feed states it. canonical_url applies the same canonicalizer as crawl/monitor (lowercase scheme/host, tracking parameters such as utm_* and fbclid dropped, remaining query sorted), so ?utm_source= variants collapse to one item while the reported id and verbatim url stay the feed's. Unknown parameters such as syn are not tracking parameters and remain part of the canonical identity; adding one is a deliberate change with evidence, not a silent widening. canonical_url is null when the item has no link (or the link is not an http(s) URL).
  • Feed dates and summaries. published is RFC3339 UTC (null when the feed has no usable date). summary is the item's content/summary converted to plain visible text (script/style/head skipped), capped at [feed].max_summary_chars (default 2 000). truncated_summaries counts cuts.
  • Feed caps. limit defaults to [feed].default_limit and is clamped to [feed].max_limit; item_count is the parsed count before the limit. truncated is true when either cap fired, with limit_hit precedence "limit" > "max_summary_chars".
  • Untrusted feed input. A body with an internal DTD/entity declaration is refused with extraction_failed before parsing (entity-expansion surface); malformed XML/JSON is also extraction_failed. text/html, application/xhtml+xml and text/plain are unsupported_content_type.
  • Feed acquisition and privacy. The same SSRF gate, robots check, redirect vetting, per-host politeness floor and body cap as fetch_page. A feed read writes nothing (only the hosts robots cache may change), has no conditional GET and never renders.
  • Sitemap formats. <urlset> (<url><loc><lastmod>), <sitemapindex> (<sitemap><loc><lastmod>) and the plain-text one-URL-per-line file. Elements are matched by local name, so the sitemap 0.9 namespace and the legacy 0.8 prefix both work. CDATA and the five predefined XML entities are decoded; a DOCTYPE is skipped and never resolved — no entity expansion, no external access — and an unknown entity is extraction_failed.
  • Sitemap gzip. A body whose first bytes are the gzip magic is inflated before parsing, with a hard 4 × [sitemap].max_bytes ceiling; a bomb is too_large. The Content-Type is not trusted for this (a .xml.gz served as application/octet-stream still parses).
  • Sitemap caps and shape. At most [sitemap].max_urls entries (default 5 000; limit may lower it) and [sitemap].max_children index children (default 5). truncated/limit_hit are "max_urls", "max_children", "limit" or null. An entry whose loc is absent or not http(s) is skipped and counted in skipped_scheme. A child failure is reported in sitemaps[].error with its typed code, never dropped.
  • Sitemap lastmod is data only. RFC3339 or YYYY-MM-DD values are returned as the document wrote them; anything else is null and counted in invalid_lastmod. Nothing is scheduled, ordered or monitored from it in this milestone.
  • Malformed sitemap XML is extraction_failed with the parser line/column; no partial result is returned. Partial results exist only as explicit cap truncation (truncated: true).
  • Sitemap discovery only, shared gates. Nothing is stored (no page, extraction, blob, job or fetch-event row; only the existing robots cache may change). The same SSRF gate, per-hop robots check, redirect vetting, per-host politeness floor and streaming body cap as fetch_page apply to the document and every index child. The response is untrusted web content: data, never instructions.

monitor_*, events, webhook_*

// monitor_create
{
  "url": "https://example.com/pricing",
  "mode": "main",                          // main | full | text (raw is rejected)
  "schema": { "fields": { "price": { "selector": "#price", "attr": "data-price" } } },
  "interval_s": 86400,
  "ignore_selectors": ["nav", "footer", ".ad-slot"],
  "label": "pricing:acme",                 // optional; project:slug convention
  "row_key": "sku",                        // optional; a field of `schema`
  "row_timestamp": "updated"               // optional; a field of `schema`
}
  • Snapshots, not crawl rows. Each check stores the extracted Markdown, normalized for line endings, trailing whitespace, runs of blank lines and zero-width characters. normalized_hash decides "changed"; raw_hash keeps the exact body. The content lives in the CAS, so an unchanged check costs one row and one conditional request.
  • Conditional GET, deliberately. A check uses the same acquisition path as fetch_page (SSRF gate, robots, caps) but not the crawl worker: crawls fetch unconditionally by design. A 304 is accepted only when the validator's representation is the one the previous snapshot saw; otherwise the body is fetched so "unchanged" is never inferred from the wrong baseline.
  • Classification. none when the normalized text and watched fields are identical (line-ending and markup churn disappear here). cosmetic when only whitespace that survived normalization changed and it touches at most monitor.cosmetic_max_changed_lines lines. substantive for a changed word, a watched field, or a larger structural change.
  • Field-level monitoring. A schema is evaluated against the same DOM parse that produces the Markdown. Compared fields are named in the change record even when the visible text is identical (an attribute-only price change still counts). monitor_create rejects the same invalid specs as extract.
  • Row digest. A single-monitor monitor_check that produced a snapshot also returns digest: {from_snapshot, to_snapshot, next_cursor, identity, rows: {new, removed, changed}, truncated}. identity is key when the monitor declared row_key (a field of its schema), so a same-content reorder is not a change; without it the digest matches positionally and reports identity: "index" — it never claims row identity. A changed row carries the full old/new records, the differing field names, and the configured row_timestamp value from each side (a stale origin timestamp is surfaced, not corrected). Pass a previous next_cursor as since_snapshot to resume across checks you skipped; the comparison starts at that snapshot. If retention pruned the watermark (retention.snapshots_per_monitor, default 20) the call is the typed watermark_expired — never a partial or false diff, and no request is spent. truncated means a compared record set reached the extraction max_records cap, so rows beyond it are not represented. No new tool and no change to monitor_changes or events.
  • Diffs are capped, stats are not. monitor_changes returns newest-first with from_snapshot/to_snapshot timestamps, kind, full line/word/field counts and a unified diff capped at monitor.max_diff_bytes (truncated: true; the counts are never truncated).
  • Failures are one terminal result. A permanent 404 is requested once, stored as a fetch_event, advances next_due_at, and appears in the check's failed list — no fabricated snapshot and no crawl-style retries.
  • Delete is a tombstone. monitor_delete sets active = 0; history and snapshots stay queryable, and checks skip it.
  • Listing. monitor_list returns up to 500 monitors in id order with label, mode, active, has_schema, interval_s, created_at, last_checked_at and next_due_at; include_inactive: true also returns tombstones. truncated and limit_hit: "limit" report a page smaller than the matching total. A label is optional (project:slug convention), trimmed, 1..=64 characters, not unique and not pattern-enforced; every pre-v5 row is null.
  • Bounded bulk checks. monitor_check(all: true) returns pending: true with a job id immediately. Add wait_ms (bounded by [monitor] max_wait_ms, default 30 000) to check inline and sequentially up to that budget: if the set finishes, pending: false and no job exists; when the deadline hits between monitors, the remainder is enqueued as one job with the remaining ids and the partial typed results are returned. One in-flight check may overrun by at most one check. monitor_id with wait_ms is schema_invalid.
  • Scheduler: opt-in in-process timer (amended). The decision chose no scheduler. amends it: with [scheduler].enabled = true (default false), serve runs a resident timer that checks due monitors via the same run_due pass; tick_ms (default 30 s) and max_checks_per_tick (also clamped by [monitor].max_checks_per_call) bound each pass. run-due is unchanged, and one driver per instance is enforced by the data-directory lock: a local run-due fails while the server runs, while run-due --http goes through the server (the per-monitor lock and next_due_at re-read prevent doubles). Default off keeps cron/systemd valid.
  • Retention. The newest 20 snapshots per monitor plus every change point (and the snapshots its diffs reference) survive GC; blobs are retained while a page or snapshot references them. A digest watermark that GC pruned is watermark_expired, not an empty diff.

events

// arguments
{
  "format": "json",          // json (default) | rss
  "monitor_id": null,        // one monitor
  "since": "2026-01-01T00:00:00Z",  // RFC3339, inclusive
  "limit": 50,               // 1..=200
  "include_diff": false
}
  • Data. Newest-first changes joined to monitors (label) and the page title by canonical URL: {change_id, monitor_id, monitor_label, url, title, detected_at, kind, stats, diff?, from_snapshot, to_snapshot}. stats is the same shape monitor_changes returns; include_diff adds the capped diff (the RSS document never carries it). count/truncated/limit_hit report a page. Read-only: no change is fabricated and nothing is written.
  • RSS. format: "rss" returns {xml, bytes, item_count, feed_url} — RSS 2.0 (channel title/link/description/lastBuildDate, item title/link/guid/pubDate/description), newest first, at most 100 items, every text node XML-escaped and control-stripped. The description carries the stats, never the diff. Tests parse the document with feed-rs (the same parser fetch_feed uses).
  • Served GET (loopback only). With the http feature and [events] feed_enabled (default true), the listener serves GET /feeds/changes.xml?token=<capability token> with Content-Type: application/rss+xml; charset=utf-8, an ETag (body hash), Cache-Control: max-age=60 and a 304 on a matching If-None-Match. Missing or wrong token → 401; feed_enabled=false → 404. The feed token is separate from the MCP bearer (WEB_WIDOW_FEED_TOKEN or a 0600 <data_dir>/feed-token created on first start; rotate by replacing it and restarting). The route is outside /mcp, requires no bearer, performs no outbound fetch, and the access log records the path only (never the query). The route is loopback-only by enforcement: a non-loopback HTTP bind with the feed enabled is refused at startup (the operator sets [events].feed_enabled = false for an MCP-only network deployment), and http::serve returns an error if called with a non-loopback address while the feed is on. feed_url in the tool payload is non-null only while that listener is active; stdio has no route.

webhook_target / webhook_status

// webhook_target
{
  "monitor_id": 7,
  "targets": ["ops"]          // configured names only; [] clears; 0..=8
}
  • Config-named targets only. [webhooks.targets.<name>] in the operator's config holds url, kind (generic/slack/discord), one of secret_env/secret_file, one of auth_env/auth_file, and include_diff. Tools and monitor_create.webhook_targets accept names, never URLs, so page content or a prompt-injected agent cannot introduce an endpoint. HTTPS only unless [webhooks].allow_http = true (loopback/test); no userinfo; no redirects. The URL is treated as a secret and never logged or returned.
  • Atomic outbox. A changed check inserts one webhook_deliveries row per attached target inside the change transaction. A separate dispatcher (in serve, or one bounded flush in local run-due) attempts it: 2xx delivered; 408/429/5xx/timeout retried; other 4xx/redirect dead; backoff [60,300,1800,7200,21600] s + deterministic jitter; dead after max_attempts. The check path never touches the network.
  • Signing. With a secret, posts carry X-Web-Widow-Timestamp and X-Web-Widow-Signature: sha256=<hex HMAC-SHA256(secret, timestamp + "." + body)> plus X-Web-Widow-Event: change and X-Web-Widow-Delivery: <id>.
  • Status. webhook_status shows enabled, targets (name, kind, host, has_secret, has_auth, include_diff), monitor attachments, recent rows (status, attempts, last_status, next_attempt_at, last_error) with include_deliveries: true, and pending/dead counts. Only the host is returned; secrets and URL paths never are.
  • Egress disclosure. Enabling a webhook deliberately sends monitor metadata — the watched URL, its label, the change kind, stats and a short summary, and the capped diff only when the target opts in — to the configured endpoint. It can leave the host's network and is not gated by robots/SSRF (the target is operator-chosen). A misconfigured target or a compromised config file is an exfiltration path. No webhook fires without an attachment; remove the target or set [webhooks].enabled = false to stop all delivery.
  • Retention. Delivered rows age out after [retention].webhook_deliveries_days; dead letters after the longer webhook_dead_days; pending rows are never pruned. Tombstoning a monitor dead-letters its pending rows.

crawl_*

// crawl_start
{
  "start_urls": ["https://docs.example.com/"],
  "sitemap_urls": [],                    // up to 5; start_urls may be empty
  "scope": { "include_paths": ["/docs/"], "exclude_patterns": ["\\?page="],
             "max_depth": 3, "allow_offsite": false },
  "render_policy": "thin_only",          // never | thin_only | always; auto = thin_only
  "limits": { "max_pages": 500, "per_host_rate": 1.0, "max_duration_s": 1800 },
  "schema": { "container": ".entry", "fields": { "title": { "selector": "h1" } } }
}
  • Frontier in SQLite, dedup as a constraint. Every enqueue is INSERT ... ON CONFLICT DO NOTHING on PRIMARY KEY(job_id, url_hash), so a URL cannot be enqueued twice even if a caller forgets to check. Canonical identity is the same rule fetch_page uses (lowercase host, default port and fragment dropped, tracking parameters removed, query parameters sorted); a trailing slash is a different resource.
  • Leases, not in-memory queues. A worker leases a row with lease_until; an expired lease is requeued with attempts+1, and after crawl.max_attempts the URL becomes failed with its last error. A killed process therefore resumes on the next start (crawl_status reports running until leases expire), and no completed page is fetched again.
  • Politeness and safety are the shared ones. Each page goes through the same fetch_page path: SSRF gate on every address and redirect hop, robots.txt per hop, streamed caps, retries. per_host_rate adds a per-job interval floor; the configured minimum interval and any robots Crawl-delay can only raise it. A crawl cannot widen its own reach.
  • Scope applies to discovered links (seeds are taken as given): depth, registrable site (off-site skipped unless allow_offsite), include_paths prefixes, and exclude_patterns regexes matched against path?query.
  • Trap resistance. When a fetched page's content identity — the Markdown with link targets removed — was already seen in the same job, the page is stored but its links are not followed. A calendar trap therefore stops after the first duplicate instead of consuming the page budget.
  • Limits are honest. max_pages and max_duration_s stop the job with state: done, limits_hit naming the limit, and the remaining frontier reported as counters.queued. crawl_results paginates with an opaque cursor bound to the job (a cursor from another job is not_found).
  • Per-item freshness. Each crawl_results item carries fetched_at, validated_at, last_attempt_at and last_attempt_failed for the exact row it reports: with a schema, the joined extraction row's own capture and write sequence, so a later same-spec extract is dated from its own write and never from the earlier crawl's clock; without one, the page write the crawl made. A failed attempt renews nothing.
  • Sitemap seeding. sitemap_urls (at most 5) are fetched and parsed before the job is persisted, each through the same gate. Their entries are discovered URLs, not explicit seeds: the job's scope filters them (include_paths, exclude_patterns, off-site) and they are deduped against start_urls and max_pages, then enqueued at depth 0. Explicit start_urls keep the "seeds bypass scope" rule. With empty start_urls, the scope's site set comes from the sitemap URL, so a cross-site entry is skipped. The start payload gains sitemap: {urls_found, urls_enqueued, urls_skipped, errors: [{url, code}]} only when sitemap_urls is supplied; a sitemap failure is recorded there and the other seeds still start. lastmod is never used for ordering or scheduling.
  • Cancel is cooperative. In-flight pages finish, no new rows are leased, the job ends cancelled, and partial results stay readable.

corpus_export and snapshot_compare

// corpus_export
{
  "format": "jsonl",            // jsonl | markdown
  "name": "corpus",             // slug [a-z0-9][a-z0-9._-]{0,63}
  "site": "example.com",        // optional canonical-site filter
  "since": "2026-10-01T00:00:00Z",
  "limit": 1000,                // 1..=10000
  "include_text": true, "include_extraction": true,
  "max_bytes": 268435456        // 1 MiB..=1 GiB
}

// snapshot_compare
{
  "kind": "monitor",            // monitor (snapshots.id) | page (fetch_events.id)
  "from": 12, "to": 15,
  "include_diff": true,
  "max_chars": 20000            // 1..=100000
}
  • What a corpus row is. A page whose latest fetch succeeded and that has stored text. The text is the delivered Markdown or the record text, capped at 200 000 characters per row (text_truncated); the latest extraction is embedded (omitted with extraction_truncated: true when it alone exceeds the same cap). A page with no stored text (failure-only, or an extraction pruned by retention) is counted in skipped_no_text and never emitted with an invented body.
  • The boundary. Monitors and recipes are not corpus rows: monitor history is monitor_changes/changes, and the recipe library is a configuration surface over profiles. The export covers pages + their extractions only.
  • Shapes. JSONL: one JSON object per line with url, canonical_url, title, lang, site, first_seen, last_fetched, fetched_at, validated_at, last_attempt_at, last_attempt_failed, status, content_type, render_mode, text_hash, text, text_truncated, extraction, extraction_truncated. Markdown: a directory with index.md (front matter: generated_at, filters, record count) and pages/<url_hash>.md (front matter url/title/fetched_at/validated_at/last_attempt_at/last_attempt_failed + body). In both shapes fetched_at is the page text's capture, the JSONL last_fetched key aliases validated_at, and a failed attempt renews neither.
  • Paths are not caller-controlled. The filename is <slug>-<UTC stamp> inside <data_dir>/exports/ (created 0700), written to a dot-temp and renamed on success, create_new and never overwritten. An invalid name is schema_invalid at /name.
  • Bounds. Streamed page by page (no job, no corpus in the response): the record limit or max_bytes stops it, with truncated and limit_hit (limit|max_bytes). The response carries the path, counts and bytes only.
  • Compare pairs. kind: monitor takes two snapshots.id values from the same monitor (text from the stored normalized Markdown; a schema monitor also compares its canonical records and reports the first 20 changed indices in record_changes). kind: page takes two fetch_events.id values with a stored extraction and the same canonical URL (the delivered text is compared as stored). Stats are never capped; diff is capped at max_chars (truncated + limit_hit: "max_chars"). A missing id/version is not_found naming the constraint; a cross-monitor or cross-URL pair is schema_invalid with mismatch. Nothing is written.

screenshot, blob_get, interact_*

// screenshot
{
  "url": "https://example.com/app", "full_page": true, "wait_ms": 300
}
// → { "url", "final_url", "status", "hash", "bytes", "mime": "image/png",
//     "width", "height", "dimensions_source": "content|viewport|unknown",
//     "full_page", "captured_at", "render_mode", "render_quality",
//     "truncated", "limit_hit", "failed_resources" }

screenshot renders one http(s) URL through the same SSRF/robots/preflight/politeness path as fetch_page, then captures the settled page with CDP Page.captureScreenshot as a PNG. The visual profile is server-fixed (no caller toggle): stylesheets, fonts and images load, media is blocked, and two caps bound the capture — [render] visual_max_bytes (20 MiB) and visual_max_requests (500). Hitting one reports truncated: true and limit_hit.

  • The PNG goes to the content-addressed store and gets one blobs row plus one screenshots row (written in that order inside one writer closure: the screenshot row references the blob). The payload carries the BLAKE3 hash, size, MIME and CSS-pixel dimensions — never base64.
  • full_page: false (default) captures the visual viewport; full_page: true captures the content size. wait_ms (0..=10000) is a post-settle wait, never a navigation. If Page.getLayoutMetrics fails, width/height are null and dimensions_source is unknown — never invented.
  • page_id is the existing pages row for the canonical URL when one exists, else null; a screenshot never fabricates a page row. Screenshot rows and their blobs are pruned by [retention].screenshots_days (30), and a surviving row retains its blob through both the age and budget passes.
  • Asset subresources are fetched by the browser, not by the tool: the SSRF gate and robots check govern the top-level document, not the CSS, font or image URLs it names. Treat the PNG and any page text as untrusted data.

blob_get { hash } returns {hash, size, mime, path, created_at, referenced_by} for any stored blob. hash must be 64 hex characters and can only address the CAS, so there is no caller path and no traversal; unknown or missing content is not_found. No bytes are returned: read the file at path with your own tools.

interact_*

Four tools hold one page per process for front-end debugging: interact_open navigates and returns a session_id capability; interact_act runs exactly one action; interact_state observes without acting; and interact_close releases the page and browser context. The loop is observe → act → observe, so a failed selector cannot abort the rest of a plan. Sessions use the visual profile above (stylesheets, fonts and images load; media is blocked), the idle TTL [interaction].ttl_s (default 120 s, 30..=600), a 900 s hard lifetime and [interaction].max_actions (default 60).

// interact_open
{ "url": "http://127.0.0.1:3000/", "viewport_width": 1280, "viewport_height": 800 }
// → { "session_id", "final_url", "status", "title", "expires_at",
//     "actions_remaining", "console" }

// interact_act
{ "session_id": "0192…", "action": { "kind": "click", "selector": "button#run" } }
// → { "session_id", "action", "ok", "blocked"?, "final_url", "title",
//     "console_tail", "actions_remaining", "expires_at", "typed_chars"?,
//     "popup"? }
  • Closed action set. click { selector, index? }; type { selector, text, index?, clear? } (clear defaults true; text is 1..=2000 chars and the response returns typed_chars only — the value never appears in a payload or log); wait with exactly one of selector (presence, not visibility; polled every 100 ms), ms (≤ 10 000) or network_quiet_ms (≤ 5 000), all bounded by timeout_ms (≤ 30 000); scroll { to: "element"|"top"|"bottom", selector? }. There is no caller JavaScript, no script/eval field, no XPath and no text-based targeting — pass an exact CSS selector and disambiguate repeats with index. An unknown action kind or field is schema_invalid.
  • One action at a time. A concurrent action returns session_busy; a second interact_open while a session is live returns session_busy with the existing id. An idle-expired id is session_expired; an unknown or already-closed id is session_not_found; the action ceiling is limit_exceeded.
  • Console capture. interact_state returns the last console_limit entries (default 50, max 200; ring of 200): {level, text, at, source} from Runtime.consoleAPICalled and Log.entryAdded, plus uncaught exceptions. Primitive arguments become text; objects are reduced to their description or a bounded preview, never expanded, and each entry is capped at 500 chars. Console text is untrusted data.
  • Network gate (defense in depth). Every request routed through the session page's target is paused with CDP Fetch before it leaves the browser: data:/blob: continue, file:/ws:/wss: and any non-http(s) scheme are refused, and every http(s) request passes the SSRF gate. Documents additionally pass robots.txt; every request takes a per-host politeness lease, so the session keeps the ≤1 request/s host floor. A refusal appears on the action as blocked: {reason, detail} (blocked_private_address, blocked_by_robots, blocked_scheme, blocked_iframe, request_cap, or a visual cap) and no request reaches the target. interact_open itself passes the normal top-level render path. Per-session bounds: the visual caps, a 500-paused-request abuse cap (refused requests included), and 10 state screenshots.
  • Target scope (what the gate does and does not cover). The gate covers requests routed through the intercepted page target's network stack. It does not cover requests from other targets, so this implementation refuses subframe documents (iframes are out of scope), disables service-worker registration and the SharedWorker constructor, and prevents popups at the document level (window.open own property and prototype, form.submit/requestSubmit reading the content attribute, shadow-root forms, and a server-side pre-dispatch hit-test at the click point: the deepest node is resolved in the pierced DOM and its ancestor chain (shadow hosts included) is checked against the hit node's own document's first <base target>. Every click-policy input — the base target, each target/formtarget/type attribute, and a submit control's form owner (a non-empty form attribute resolved by id in that control's own tree — resolved per chain node, so a chain crossing a shadow boundary never borrows the hit node's tree — so a sibling form in a shadow tree is modelled even though it is invisible to an event path) — is read through DOM.querySelector/DOM.getAttributes and the pierced DOM tree, so page JavaScript cannot intercept or fake it. A hit <label> is resolved to its labeled control (for in the same tree, otherwise the first labelable descendant) and that control is evaluated with the same rule, because label activation forwards a click the guard cannot see through a closed declarative root (review 2026-11-02). The label pass is suppressed only for the spec's interactive content — an anchor with href, button, form control outside the hidden state, select, textarea, details, embed, iframe, label, audio/video with controls, or img with usemap — not for a bare tabindex element or an href-less anchor, which the UA still forwards to the control (g33, g33d). The hit test sets ignorePointerEventsNone, so a pointer-events:none overlay is transparent to the check as it is to the press. The click point is computed once from the browser's content quads and dispatched with Input.dispatchMouseEvent; DOM.scrollIntoViewIfNeeded replaces page scrollIntoView, and the element's box is re-read immediately before the press, so a box that moved between the check and the dispatch is refused (click_point_moved). There is no page-order candidate budget; the pierced-tree read itself is bounded (5 s, 50 000 examined nodes) and a limit is reported (walk_truncated), never an unchecked dispatch, and an action refusal is reported even when a subresource was blocked earlier in the same action). A mousedown/pointerdown handler is a page callback between the check and the click default action; the box re-read closes the layout version of it, and the guard's window click capture listener (re-asserted across document.open/write) cancels a target flipped by it; the submit listener applies the same effective-target rule (a present formtarget takes precedence over the form's target, even when empty; an empty effective target then falls to the base target and then _self — g35/g36 measured both halves), so a formtarget="_self" submit inside a _blank form is not over-blocked, and the listener is load-bearing for any submit whose effective target differs from the form's target and for shadow-tree submissions. Typing cannot deliver Enter (the key table has no newline entry, so a newline fails the action), so an implicit submission is not reachable from type_text. The close-on-attach backstop is cleanup, not an egress control: the guard-disabled discriminator evidence shows every creation shape reached the private listener (2 TCP) with the backstop alone, so creation prevention is the only egress control. A dedicated worker's own fetch is observed on the page target and gated on the verified Chrome 156 build; worker-created targets (a nested Worker, importScripts, and a SharedWorker created from a worker's WorkerGlobalScope) are an unvetted egress channel — a known hole, not only untested — and are a recorded residual (review 2026-11-01). It is an SSRF filter, not an egress filter: it does not stop a page sending data to a public host, and WebRTC/UDP and DNS-only channels are outside it (launch flags disable DNS prefetch and non-proxied WebRTC UDP). The vet resolves and pins the shared HTTP path's addresses; the rendered browser path still resolves inside Chrome, so a rebinding zone can reach a private address there — a disclosed residual, with Chromium's private-network protections as the remaining control, not a solved problem.
  • Popups, targets, and cross-origin page changes. window.open (own property and prototype) is replaced, form.submit/requestSubmit and non-self anchor/area/form targets are cancelled at document start, and closed shadow roots are forced open so a shadow anchor cannot hide from the cancel path (a page can still reach window.open through a target the guard does not see; the page target is then closed). _self, _top, _parent and an empty target on the top frame are allowed same-context navigation; _blank and named targets are cancelled and reported as blocked.reason: "navigation_cancelled" (a blocked window.open reports popup_blocked) so a click is never silently a no-op. popup: "not_followed" is per-action (only the action that observed the CDP event). A blocked same-tab navigation is failed before the request, and Chrome then shows its own error page in that tab — reopen a session if you need the previous DOM. When the page navigates to a different origin, the next result says so with origin_changed: true and previous_origin; title (300 chars) and final_url (4096 chars) are capped, with limit_hit naming the field; control characters are stripped from title and console text.
  • Injection surface (disclosed, not pretend-absent). Page content can instruct an agent to click or type; act only on selectors from your own plan and treat page text as data. type can enter secrets into forms, so never type credentials into a page you do not trust; the tool keeps the last few typed strings and scrubs them (raw and URL-encoded) out of console output, but a page can still encode a value in ways scrubbing will not catch. Sessions are capability strings: anyone with the id can act until close, TTL or shutdown, the id is only ever logged as an 8-character prefix, and server shutdown closes every session.

robots_cache

// arguments
{
  "host": "example.com",   // optional: restrict + probe this host
  "path": "/private",      // probe path (default /)
  "limit": 50,             // 1..=200, host order
  "cursor": null,
  "include_body": false    // 200-char preview only
}
  • Cache listing. Host, fetch time/status, expiry, next allowed time, consecutive failures, the cached Crawl-delay, body size and presence; paginated in host order with next_cursor.
  • Path probe from the cache. With host (and optional path), the stored body is parsed with the same parser enforcement uses and decision reports {allowed, matched_rule, crawl_delay_s, source}: cache, expired (still parsed) or unavailable (missing/invalid body → allowed: null, never a fabricated allow).
  • Zero network. The tool reads the database only; it does not call the fetching robots service. A test asserts the fixture server receives no request. The cached body is untrusted data: never instructions.

JavaScript rendering

fetch_page, extract and extract_rows take render (for extract_rows it applies to HTML tables only):

  • never — static HTTP only.
  • auto (default) — static first; if the extracted main content has fewer than 200 words and the document has more than three <script> elements or an app-root marker (#root, #app, [data-reactroot], ng-app), or a <noscript>/“enable JavaScript” shell has fewer than 100 words, the page is rendered. Every decision is logged with the rule name.
  • always — render first. A missing browser is render_unavailable; a rendering failure is render_failed. It never silently returns a static result.

A rendered page is serialized as document.documentElement.outerHTML and fed through the same charset, blob, extraction and persistence path. render_mode is static for a static fetch, rendered when the page settled, rendered_partial when the 5 MiB / 200 request caps or the 10 s ceiling stopped it, and static_fallback when auto asked for rendering but it was unavailable or failed (an optional render_warning says why).

The shared browser is launched lazily, gets a throwaway profile under the data directory (wiped at start and exit), and is restarted at most three times per ten minutes. Each page gets an ephemeral browser context (no cookies or storage are shared). The text profile used by fetch_page/extract blocks image, media, font and stylesheet requests while script, xhr, fetch and the document are allowed. The visual profile used by screenshot (below) allows stylesheets, fonts and images so the capture matches what a user sees; media stays blocked. Rendered pages execute untrusted JavaScript: the SSRF gate governs the top-level URL, not every subresource the page chooses to load — a disclosed residual risk in , not a claim of sandboxing the network.

HTTP transport and local HTTPS

  • Endpoint: http://127.0.0.1:8765/mcp. Every request needs Authorization: Bearer <token> and Accept: application/json, text/event-stream (MCP clients send the latter for you; a raw curl probe must include it or the streamable transport answers 406). A missing/wrong token is 401 with WWW-Authenticate: Bearer; the token is read from WEB_WIDOW_HTTP_TOKEN (wins) or a 0600 file and is never logged.
  • --http refuses a non-loopback address unless --allow-non-loopback is also passed. Local HTTPS is available on the same listener with [http].tls = true (see below); multi-user auth remains out of scope. Keep the bind on loopback unless you have deliberately reviewed the network exposure.
  • The change feed is loopback-only. A non-loopback --http bind with [events].feed_enabled is refused at startup (before any token is resolved or provisioned): set [events].feed_enabled = false for an MCP-only network deployment. http::serve re-checks the bound address, so a library caller cannot bypass the refusal.
  • The loopback HTTP transport is stateless. Every POST is served directly; Mcp-Session-Id is neither required nor issued, and stale/unknown/absent ids are ignored instead of returning 404. initialize completes the handshake normally (application/json). Only POST is served: GET and DELETE on /mcp return 405 with Allow: POST, and the server emits no server-initiated messages. Bearer auth, Host validation and the body cap are unchanged.
  • Each request writes one access line to stderr: method, path, status, session (the first 8 characters of a supplied id, or none) and duration_ms; INFO for status ≥ 400, DEBUG otherwise. The bearer token, the body and the query string are never logged.
  • stdout stays empty in HTTP mode; all logs are stderr.
  • SIGINT/SIGTERM stops the listener, cancels job workers, closes the browser, wipes the throwaway profile and releases the data-directory lock (target: exit within 10 s).

Local HTTPS (T1)

Set [http].tls = true to serve the same /mcp and /feeds routes over HTTPS on the --http listener. TLS is strict either-or: that port is HTTPS only, never plaintext. With no certificate paths, the first start generates a local CA and server certificate under <data>/tls/ (ca.pem/server.pem 0644, ca-key.pem/server-key.pem 0600, meta.json; directory 0700). Trust the CA once in each client, or provide an operator PEM pair with tls_cert_file/tls_key_file (both or neither; an override skips generation).

openssl verify -CAfile <data>/tls/ca.pem <data>/tls/server.pem
openssl x509 -in <data>/tls/ca.pem -noout -subject -dates -fingerprint -sha256
curl --cacert <data>/tls/ca.pem https://127.0.0.1:8765/feeds/changes.xml
export NODE_EXTRA_CA_CERTS=<data>/tls/ca.pem   # Node-based MCP clients

Firefox: Settings → Privacy & Security → Certificates → View Certificates → Authorities → Import → ca.pem → trust for websites. Chrome/Chromium (Linux, NSS): certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n "web-widow local CA" -i <data>/tls/ca.pem (needs nss-tools), or import in chrome://settings/certificates. System store (Debian/Ubuntu): copy ca.pem to /usr/local/share/ca-certificates/web-widow-local-ca.crt and run sudo update-ca-certificates. The SANs are localhost, 127.0.0.1 and ::1; connect by one of those names. The CA lasts ~10 years and the leaf ~13 months with startup renewal; an expired CA is a typed startup error (delete <data>/tls/ to re-mint, then re-import). Generated material is loopback-only; a non-loopback bind needs an override with the right SAN. See docs/operations.md for the full lifecycle, override and error contract.

Authenticated fetching

Credentials are config-only. A secret reference (op://, bw://, pass://) lives in the 0600 config file; the agent names an operator-defined profile, and only through fetch_page.profile. No other tool accepts profile (or any other credential-bearing key) — that is schema_invalid before dispatch.

[auth]
audit_days = 90                  # auth_audit retention, 1..=3650
manager_timeout_ms = 5000        # hard per-resolution timeout, 100..=60000
allow_loopback_http = false      # plain HTTP for literal loopback addresses only
persist = false                  # store authenticated bodies (return-only when false)
index_authenticated = false      # include stored ones in FTS + embeddings
events_authenticated = false     # include events derived from them in the feed
page_retention_days = 7          # retention for stored authenticated pages

[auth.managers.op]               # absolute path; PATH is never searched
path = "/usr/bin/op"
env_allow = ["OP_SERVICE_ACCOUNT_TOKEN"]   # the only extra vars the child sees

[auth.profiles.github]           # bearer (default) | basic | header
kind = "bearer"
host = "github.com"              # lowercase bare host
port = 443                       # exact credential origin port, 1..=65535
reference = "op://Private/github/token"
  • Per-site opt-in. The operator configures the profile, the binding host and the reference (or, for kind = "session", the login/verify URLs); nothing is authenticated until a profile exists and is named. A header profile refuses a redirect to another host (auth_redirect_blocked); an SSO/session-gated site uses a kind = "session" profile, where the operator logs in with auth login (once per session lifetime; session_max_age_days, default 30) and the sealed jar is reused.
  • Return-only by default. An authenticated fetch_page persists no authenticated content and no credential — no page or extraction row, no blob, no FTS/embedding, no cache, no event, no webhook — and reports cached: false, authenticated: true and the profile name. The only store writes are its single value-free auth_audit row and the unauthenticated robots cache (hosts), which the hop guard updates before the binding check. [auth].persist = true opts in to storing the body labelled (authenticated, auth_site) and extraction-only; stored pages are excluded from corpus_export, the feed and webhooks, and from FTS/embeddings and events unless index_authenticated / events_authenticated is set, with page_retention_days (default 7) retention. A store failure on that persistence path is a typed error that stores nothing (no page, event or extraction row, and no failure record, which would store an unlabelled page); return-only calls are unaffected because they write no row. A header profile stays static (render = always → auth_render_unsupported); with render = always, a session profile renders through the dedicated authenticated browser.
  • Trail. Exactly one value-free auth_audit row per attempt (profile name, host, method, status, bytes, outcome, resolution time — never a value, a reference, a path or a query), pruned after [auth].audit_days. The runbook and the SQL to read it are in docs/operations.md §12.
  • Exact origin. A credential attaches only to the configured host:port (default 443) and never to a subdomain, even with allow_subdomains = true, which widens browser reachability only. Plain HTTP is admitted for the literal addresses 127.0.0.1 and ::1 only, and only with allow_loopback_http.
  • Authenticated reuse. A session profile uses a sealed jar against a dedicated pipe-only headless browser (ephemeral context per fetch, host-only cookie injection, the egress policy on every request plus a loopback proxy) or the static cookie path. It is read-only: GET/HEAD only, no mutation authority. An HTTP auth challenge fails the fetch (auth_challenge_refused). The launch carries --webrtc-ip-handling-policy=disable_non_proxied_udp — the force- spelling is a no-op on Chrome 156 and must not be reintroduced. The requested document is SSRF/robots/lease-vetted before the browser starts; a rendered page's own subresources are outside robots (they remain subject to the egress policy). Details: docs/operations.md §12.8.
  • Errors. auth_profile_unknown, auth_manager_failed, auth_manager_timeout, auth_secret_unavailable, auth_rejected, auth_redirect_blocked, auth_host_not_allowed, auth_insecure_url, auth_render_unsupported, auth_header_rejected, auth_store_unavailable, auth_store_locked, auth_store_invalid, auth_session_missing, auth_session_expired, auth_challenge_refused, auth_method_refused, auth_session_unsupported. A failure never falls back to an unauthenticated fetch.
  • Disclosure. Authenticated fetching is the operator's responsibility: use a credential you are entitled to use against that site, respect its terms of service and robots policy, and prefer a narrow read-only token. By default the server returns the body to the calling agent and never persists it; with [auth].persist the body is stored labelled and egress-restricted as above, and the operator owns the decision. What the agent does with a returned body is outside the server's control.

Schema and upgrades

Current schema: v12.

Migrations are forward-only. An older binary refuses a newer database with database schema vN is newer than this binary, so rolling back the binary requires restoring a pre-migration backup.

  • profiles.hash is versioned (spec/v1/...). Cached extraction rows written by an older unversioned build are simply missed and re-fetched; nothing is corrupted. An in-flight pre-upgrade crawl job that carried a schema should be restarted as a new job so its profile identity and crawl_results.extracted join stay consistent.
  • If a unit passes --http, install a release built with the http feature and keep the rollback artifact outside the build tree. The shared unit's ExecStart points into target/release, so any feature-different cargo build --release overwrites the deployed file (the running process keeps its image) and the next restart fails with this binary was built without the http feature. Verify the installed file's sha256sum and that it is http-capable before starting; the B01 default build is not a rollback for an --http unit. docs/operations.md names the durable artifacts by sha.
  • ** is code-only** (no schema or data change). The previous 99ab3a4 http binary is the rollback; preserve/install a feature-matched artifact and check its sha before start, as above. docs/operations.md records the upgrade/rollback note.
  • v5 added the nullable monitors.label; v6 added the FTS5 table pages_fts and the meta marker table, then backfilled one index row per existing page in 200-page transactions at the first start (idempotent; the fts_backfill_v6 marker makes a second start a no-op). Back up the database and the blob directory before running a newer binary; an older binary refuses a newer schema (database schema vN is newer than this binary), so rolling back the binary requires restoring a pre-migration backup. docs/operations.md has the stop → backup → install → start → verify runbook, the v6 note and the restore drill.
  • v12 added monitors.row_key and monitors.row_timestamp (nullable, additive) for the monitor digest; every v11 monitor becomes keyless and keeps its rows and history unchanged. watermark_expired names a pruned digest watermark.
  • v11 added the corpus-freshness provenance (pages.write_seq, content_*, index_*, validators_write_seq, last_attempt_* and extractions.source_write_seq) and backfilled conservatively in the same transaction: the old pages.last_fetched became the attempt pair (not_modified → unknown), and the success clock was recomputed from retained events that prove a usable 200 (no error, HTTP 200, a body hash or an extraction created by that same event). No capture or validation is invented for a legacy row: those columns stay null, and a page whose only retained success is a 304 gets a null internal clock. pages.last_fetched is now success-anchored (see docs/operations.md §13).
  • Snapshots created before v4 have an unknown render mode; their first post-upgrade check fetches the body unconditionally and records the actual mode, so the static 304 shortcut only applies from then on.

Limits and intended use

Intended use: internal agent tooling over publicly accessible pages such as docs, news and reference sites, with robots.txt respected and at most one request per second per host. Authenticated access is operator-configured, per-site and opt-in. Session-gated sites are reached only through an operator-captured kind = "session" login, and only for content the operator is entitled to access; the server adds no paywall or access-control bypass. There is no open-web discovery, proxy rotation, distributed crawling or multi-user auth.

Known limits, stated rather than hidden:

  • mode=main uses readability and can drop sibling blocks, for example a comparison table beside an article. A bounded repair restores a missing run only when it starts with an undelivered sibling section heading and the repair stays under 25% of the delivered text. Use mode=full or mode=text when completeness matters.
  • Monitors watch one URL each. Schema monitors compare declared fields, not a full JSON delta.
  • A rendered monitor re-fetches every check, because the static validator cannot prove the rendered DOM is unchanged.
  • monitor_check(all: true) has no cancel tool; shutdown is cooperative, and a crash marks the job failed while monitors stay due.
  • A permanent 404 is one terminal check, not a three-attempt retry.
  • crawl_results rows are page-current, not per-attempt snapshots: each item's freshness facts come from the exact row it reports, and a later unrelated write is never retro-dated onto it. The page's status/title/raw_hash remain the page's current values (a pre- behaviour, unchanged).
  • A crawl whose seeds are all blocked ends done with fetched: 0 and limits_hit distinguishing a limit stop.
  • Local search has no OR, NEAR or prefix operators, no page-level retention, and no authenticated crawling.
  • The change feed is loopback-only with its own token, not a multi-user service.
  • Sitemap ingestion is discovery only; lastmod schedules nothing and a nested index child is reported as an error rather than recursed.
  • pdf_extract reads the text layer only, uses no password, and stores only a complete result.

Layout

src/core/       pure domain: URL canonicalization, IP classification, robots decisions, truncation
src/config.rs   TOML + env + CLI, path resolution, permission checks
src/fetch/      HTTP adapter, SSRF gate, per-host gate, robots cache, charset, content scope
src/extract/    readability + Markdown + metadata + links; spec validation and evaluation
src/render/     renderer port, CDP browser lifecycle, discovery, auto heuristic
src/store/      SQLite repository, migrations, content-addressed blobs, retention, jobs/frontier
src/crawl/      crawl scope predicate, job worker, crawl service
src/monitor/    normalization, classification, monitor service, run-due
src/search/     DuckDuckGo html/lite parser and the search payload
src/fts/        query validation, FTS5 expression, payload
src/auth/       credential profiles, egress policy, sealed sessions
src/pdf/        PDFium loading and text-layer extraction
src/sitemap/    sitemap parsing
src/rows/       CSV, TSV, JSON and HTML table parsing
src/webhooks/   outbox dispatcher and signing
src/export/     corpus export and snapshot comparison
src/interaction/ page session and the click guard
src/tls.rs      generated local CA and leaf lifecycle
src/mcp/http.rs loopback streamable HTTP transport (feature `http`)
src/mcp/        rmcp server and the tool surface
src/pipeline.rs single-URL orchestration
docs/operations.md  operator runbook: data, GC, backup, HTTP, troubleshooting
AGENTS.md       short repository build, test and run instructions

Documentation

File What is in it
docs/operations.md Install and verify, data layout, retention and GC, backup and restore, migration runbooks, Chrome discovery, HTTP and TLS, monitoring ops, auth runbooks, troubleshooting, uninstall
AGENTS.md Toolchain, build and test commands, run modes, guardrails for contributors
SKILL-INSTALL.md Installing the server and the field-guide skill together
skill/web-widow/SKILL.md The agent-facing field guide
config.example.toml Annotated defaults

License

MIT. See LICENSE.

About

Rust MCP web-intelligence server — fetch, extract, crawl, monitor, interact, PDF, semantic search

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages