# fetch — URL fetch & HTML-to-Markdown MCP connector for SCORPIOX BOT `plugin_fetch` is a clean-room, zero-dependency **pure C99** rewrite of the tool surface of [`modelcontextprotocol/servers` → `src/fetch`](https://github.com/modelcontextprotocol/servers/tree/main/src/fetch) plus the readability-shaped HTML→Markdown subset of [`openclaw/openclaw` → `extensions/web-readability`](https://github.com/openclaw/openclaw), 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) | ## Modes | 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 | ```sh ./plugin_fetch --meta printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | ./plugin_fetch --mcp make && make test && make e2e ``` ## The tool 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 | ```sh 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: * **Truncation is self-describing.** A chunk that ran out ends with `Content truncated. Call the fetch tool with a start_index of 5000 to get more content.`, and an out-of-range `start_index` answers `No more content available.` — exactly the upstream strings, so the agent's second call is never guesswork. * **`text/markdown` is returned verbatim** with no notice. Anything else that cannot be simplified (JSON, XML, plain text) is prefixed with `Content type … cannot be simplified to markdown, but here is the raw content:`. * **A redirect reports both ends** — `Redirecting from … to …` — and each of up to five hops is re-validated before it is connected to. * **The body is capped before it is read.** A declared `Content-Length` over 5 MB is refused without pulling a byte, so a hostile server cannot make the node allocate. ## HTML → Markdown What the converter does, in one pass over the bytes (no DOM, no regex): | Input | Output | |---|---| | `

`…`

` | `#`…`######` | | `` | `[text](href)` — href absolutised against the page URL | | `