You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(adapters): document CLI --explain and Botasaurus OpenAPI 2.0 options
auto/capture --explain print telemetry on stderr. MCP inspect payload includes admission and XHR recon. request.botasaurus matches the scrape-API contract (no extra keys, window_size object).
Copy file name to clipboardExpand all lines: src/content/docs/ruby-gem/reference/cli-reference.mdx
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@ Automatically discovers items from a page and prints the generated RSS or JSONFe
26
26
html2rss auto https://example.com/articles --limit 10 ; \\
27
27
BOTASAURUS_SCRAPER_URL="http://localhost:4010" html2rss auto https://example.com/protected --strategy botasaurus ; \\
28
28
html2rss auto https://example.com/articles --items_selector ".post-card" ; \\
29
+
html2rss auto https://example.com/articles --explain ; \\
29
30
html2rss auto --input sample.html ; \\
30
31
html2rss auto https://example.com/articles --input sample.html
31
32
`}
@@ -38,11 +39,12 @@ Available options:
38
39
39
40
-`--strategy`: Optional request strategy (`auto`, `faraday`, `botasaurus`, `local_file`). Defaults to `auto`, which tries `faraday` -> `botasaurus`.
40
41
-`--format`: Output format for the auto-sourced feed (`rss` or `jsonfeed`). Defaults to `rss`.
41
-
-`--limit`: Maximum number of articles to extract during discovery (defaults to `20`).
42
+
-`--limit`: Maximum number of articles to extract during discovery (defaults to `25`).
42
43
-`--items_selector`: Optional CSS selector hint for item extraction.
43
44
-`--max-redirects`: Maximum redirects to follow per request.
44
45
-`--max-requests`: Maximum requests to allow for this feed build (defaults to `4` for auto discovery).
45
46
-`--input`: Local HTML file path to read input from without making network requests. When provided without a `URL`, `html2rss` attempts to detect the base URL from `<link rel="canonical">` or OpenGraph metadata in the HTML.
47
+
-`--explain`: Print `Html2rss::Status` JSON to stderr (`version`, `dedup_dropped`, and when present `scraper_tallies`, `selected_strategy`, `attempt_count`, `strategy_attempts`, `admission_drops`). Stdout stays the RSS or JSON Feed.
46
48
47
49
#### URL Surface Guidance For `auto`
48
50
@@ -131,13 +133,14 @@ The CLI keeps `strategy` as a top-level override and writes runtime request limi
131
133
132
134
### Capture
133
135
134
-
Analyzes a URL using auto-source structural analysis and prints a reusable YAML feed configuration with derived CSS selectors to stdout.
136
+
Analyzes a URL using auto-source structural analysis and prints a reusable YAML feed configuration (`items` selector + `enhance: true`) to stdout.
When AutoFallback (or a pinned strategy) selects a concrete transport, the printed YAML includes a top-level `strategy:` so later `html2rss feed` uses the same hop.
156
162
157
163
### MCP
158
164
@@ -174,7 +180,7 @@ Available options:
174
180
-`--transport`: MCP transport protocol (`stdio` or `http`). Defaults to `stdio`.
175
181
-`--port`: Port for HTTP transport (default: `8080`). Bound strictly to `127.0.0.1` (loopback only).
176
182
177
-
HTTP transport requires the `rack`, `rackup`, and `webrick` gems. See the [MCP Server Reference](/ruby-gem/reference/mcp-server/) and [AI Agent Workflows Guide](/ruby-gem/guides/ai-agent-workflows/) for full configuration and tool schemas.
183
+
HTTP transport requires the `rack`, `rackup`, and `webrick` gems. stdio keeps JSON-RPC on stdout; the daemon logs to stderr and defaults to `LOG_LEVEL=info` unless you set `LOG_LEVEL`. See the [MCP Server Reference](/ruby-gem/reference/mcp-server/) and [AI Agent Workflows Guide](/ruby-gem/guides/ai-agent-workflows/) for full configuration and tool schemas.
Copy file name to clipboardExpand all lines: src/content/docs/ruby-gem/reference/mcp-server.mdx
+20-4Lines changed: 20 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,7 @@ The MCP server supports two transport mechanisms:
34
34
35
35
-**Loopback binding:** The HTTP transport only binds to `127.0.0.1`. Never expose it to public interfaces without authentication and reverse proxy origin controls.
36
36
-**Dependencies:** The HTTP transport requires the `rack`, `rackup`, and `webrick` gems. If they are not present, starting the server raises a descriptive `LoadError`.
37
+
-**Logging:** stdio JSON-RPC uses stdout. The daemon logs to stderr and defaults to `LOG_LEVEL=info` unless `LOG_LEVEL` is set (`debug` for more, `warn` to quiet).
37
38
38
39
## Strategy Resolution in MCP
39
40
@@ -47,14 +48,24 @@ Read `html2rss://runtime` for `botasaurus_configured` (boolean only). Set `BOTAS
47
48
48
49
## Result envelope
49
50
50
-
Every tool returns the same JSON object in both the text content and `structuredContent` (there is no `_meta` quality channel):
51
+
Every tool returns the same JSON object in both the text content and `structuredContent`:
`faraday` is the standard static HTTP transport. When no custom `User-Agent` header is supplied in `headers`, `html2rss` sends `html2rss/<VERSION>` by default.
32
32
33
+
HTML is accepted when `Content-Type` includes `text/html`, or when the body sniffs as HTML (`<!DOCTYPE html` / `<html`) and the response is not JSON. Gzip, deflate, and brotli bodies are decoded even when `Content-Encoding` is missing; unlabeled brotli is tried for `octet-stream`.
34
+
33
35
## `botasaurus`
34
36
35
37
`botasaurus` delegates page fetching to a Botasaurus scrape API endpoint. It runs as the second tier of `auto`, or when you pin `strategy: botasaurus`.
@@ -43,6 +45,8 @@ html2rss enforces local request policy preflight and timeout budget. When a tota
43
45
44
46
During the **browser** execution tier, the Botasaurus scrape API always captures JSON XHR/fetch response bodies (`xhr_responses`). html2rss forwards them as `Response#captured_responses` so AutoSource `xhr_articles` can extract articles without extra requests. The HTTP-request tier returns an empty capture list. Caps and filtering live in the scrape API (see its README); article-likeness filtering is a client concern.
45
47
48
+
The client speaks OpenAPI 2.0 `ScrapeSuccess` / `ScrapeError` envelopes. Success requires an `html` string. Extra `request.botasaurus` keys fail YAML validation.
49
+
46
50
### Configuration
47
51
48
52
<Code
@@ -54,29 +58,28 @@ During the **browser** execution tier, the Botasaurus scrape API always captures
54
58
request:
55
59
botasaurus:
56
60
navigation_mode: auto
57
-
max_retries: 1
61
+
max_retries: 2
58
62
headless: false
59
63
`}
60
64
lang="yml"
61
65
/>
62
66
63
-
Supported `request.botasaurus` options:
67
+
Supported `request.botasaurus` options (unknown keys are rejected):
0 commit comments