plugin_fetch is a clean-room, zero-dependency pure C99 rewrite of the
tool surface of
`modelcontextprotocol/servers` → `src/fetch`
plus the readability-shaped HTML→Markdown subset of
`openclaw/openclaw` → `extensions/web-readability`,
reshaped as a SCORPIOX BOT connector plugin: one binary, four modes, no
shared-library requirements, and a security model you can actually read.
Give it a URL, get clean Markdown back — with the boilerplate gone and long
documents chunked so an agent can page through a page instead of flooding its
context window.
| Slug | fetch |
| Binary | plugin_fetch (plugin_fetch.exe on Windows) |
--meta | {"name":"fetch","desc":"URL to Markdown","kind":"mcp","mcp":true,"daemon":false,"menus":false,"verified":"live"} |
| Category | network |
| Kind | MCP connector (--mcp, stdio JSON-RPC 2.0) |
| License | MIT (vendored yyjson MIT, mbedTLS 3.6.7 Apache-2.0) |
| Mode | Trigger | Who calls it |
|---|---|---|
| Discovery | --meta / SX_PLUGIN_META=1 | scorpiox-bot-api /plugins, scorpiox-cli-botplugin, sx-connector-mcp |
| MCP tool | --mcp | sx-connector-mcp (the single MCP router) or any MCP client over stdio |
| Control API | ?action=… / ?format=json | the plugin page (behind require_node_auth()) |
| Setup / tester page | GET | the browser, via the hub or the node directly |
./plugin_fetch --meta
printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | ./plugin_fetch --mcp
make && make test && make e2e
One tool, fetch, with the same parameter shape as upstream so prompts and
agent code written against the Python reference work unchanged:
| Argument | Type | Default | Meaning |
|---|---|---|---|
url | string | required | must be http:// or https:// |
max_length | integer | 5000 | characters to return, hard cap 100000 |
start_index | integer | 0 | continue a truncated document here |
raw | boolean | false | return the original HTML instead of converting |
printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"fetch","arguments":{"url":"https://example.com","max_length":2000}}}' \
| ./plugin_fetch --mcp
Behaviour that matters when an agent is driving it:
`<error>Content truncated. Call the fetch tool with a start_index of 5000 to
get more content.</error>, and an out-of-range start_index` answers
<error>No more content available.</error> — exactly the upstream strings,
so the agent's second call is never guesswork.
cannot be simplified (JSON, XML, plain text) is prefixed with
Content type … cannot be simplified to markdown, but here is the raw content:.
Redirecting from … to … — and each ofup to five hops is re-validated before it is connected to.
Content-Length over5 MB is refused without pulling a byte, so a hostile server cannot make the
node allocate.
What the converter does, in one pass over the bytes (no DOM, no regex):
| Input | Output |
|---|---|
<h1>…<h6> | #…###### |
<a href> | [text](href) — href absolutised against the page URL |
<ul> / <ol> (one nesting level) | - item / 1. item |
<pre><code> | fenced block; <code> inline → ` code ` |
<strong>/<b>, <em>/<i> | **…**, *…* |
<blockquote> | > … |
<hr> | --- |
<img alt src> |  |
<table> | pipe-separated rows |
& — — ✓ | decoded (named + decimal + hex) |
<script> <style> <noscript> <svg> <head> <nav> <aside> <footer> <form> <template> + comments | dropped, subtrees and all |
The document title (og:title if present, else <title>) is prepended as an
# h1 when the body does not already open with it — the same rule as the
upstream title.py.
It is a forgiving tokenizer over raw bytes, not a validator: UTF-8 passes
through untouched, and a page that forgets to close a tag still converts.
This plugin fetches arbitrary URLs on your node, so the guardrails are the
product, not a footnote.
ftp, file, gopher, data) is refused before a socket exists.
every returned record is tested against the denylist, and the socket
then connects to that validated numeric address. A server whose DNS
alternates between a public and a private record — the classic rebinding
trick — is refused outright, and there is no window between the check and
the connect() for the answer to change under us.
_NON_PUBLIC_NETWORKS and then some: 0/8, 10/8, 100.64/10 (CGNAT), 127/8, 169.254/16 (link-local,
which is where the cloud metadata endpoints live), 172.16/12,
192/24 IANA special (with upstream's two anycast exceptions),
192.0.2/24, 192.88.99/24, 192.168/16, 198.18/15, 198.51.100/24,
203.0.113/24, 224/4 (our own addition, upstream omits multicast),
240/4; and on IPv6 ::/96, ::ffff:0:0/96 (v4-mapped, applied through
the v4 list), 64:ff9b::/96 and 64:ff9b:1::/48 (NAT64), 100::/64,
2001::/23 with the documented TEREDO/AMP/ORCHID exceptions,
2001:db8::/32, 2002::/16 (6to4), 3fff::/20, fc00::/7 (ULA),
fe80::/10, fec0::/10.
Non-canonical address text (0177.0.0.1, 0x7f.0.0.1, 1.2.3) is
refused, never reinterpreted — inet_aton would happily turn those
into loopback.
toggle on the page (which writes config.json in the plugin's connector
directory) or FETCH_ALLOW_PRIVATE=1 in the environment. It is off by
default. The offline test suite is the main reason it exists.
MBEDTLS_SSL_VERIFY_REQUIRED with a minimum of TLS 1.2, verifying the peer
certificate and the hostname against a CA bundle (FETCH_TLS_CA_FILE, or
the first system bundle found). There is deliberately no
INSECURE_SKIP_VERIFY option to add. Windows builds hand the whole HTTP
and TLS leg to WinHTTP with the system root store, TLS 1.2+ pinned and
WinHTTP's own redirect handling switched off so every hop comes back
through our validator.
X-Bot-Password, Authorization: Bearer, or ?pwd=), same as every other plugin.
--meta and the page itself stay unauthenticated so discovery works.
Full write-up, including the exact prefix lists and how to verify any of it
yourself, is in `docs/SECURITY.md`.
Dark and light, following the bot's theme tokens and the sx-theme handoff,
fluid down to 390 px and inside the Chat floating window, with zero
<script src=> and no CDN:
max_length / start_index / raw controlssee is what the agent sees
--mcp tool schema, straight from ?action=infoOpen it through the hub (/plugins?plugin=fetch) or the node directly
(/plugin_fetch); `?embed=1