fetch
HTTP(S) URL fetcher with optional domain allowlist, configurable size and timeout limits.
Usage
bash
native-mcp fetch [--allow-domain DOMAIN]... [--max-bytes N] [--timeout DUR] [--user-agent UA]Flags
| Flag | Default | Description |
|---|---|---|
--allow-domain DOMAIN | (none) | Restrict requests to this hostname. Repeatable. If unset, any host is allowed. |
--max-bytes N | 5242880 (5 MiB) | Cap the response body at N bytes. Larger responses are truncated and flagged. |
--timeout DUR | 30s | Total request timeout (Go duration: 30s, 1m, 2h). |
--user-agent UA | native-mcp/fetch | User-Agent header. |
Tools
fetch_url
| Field | Type | Required | Description |
|---|---|---|---|
url | string | yes | Absolute http:// or https:// URL. |
method | string | no | HTTP method (default GET). |
headers | object<string,string> | no | Extra request headers. |
Returns a text block:
text
HTTP 200 OK
URL: https://example.com/
Content-Type: text/html; charset=UTF-8
Truncated: yes (max-bytes=5242880)
<!DOCTYPE html>
...The Truncated: line only appears when the response body exceeded --max-bytes.
list_allowed_domains
Returns the configured --allow-domain list, or any if no restriction is in effect.
Register in Claude Code
bash
# Open mode (any host)
claude mcp add native-fetch native-mcp fetch
# Locked-down: only two hosts, 1 MiB cap, 10s timeout
claude mcp add native-fetch-locked native-mcp fetch \
--allow-domain api.github.com --allow-domain raw.githubusercontent.com \
--max-bytes 1048576 --timeout 10s