Skip to content

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

FlagDefaultDescription
--allow-domain DOMAIN(none)Restrict requests to this hostname. Repeatable. If unset, any host is allowed.
--max-bytes N5242880 (5 MiB)Cap the response body at N bytes. Larger responses are truncated and flagged.
--timeout DUR30sTotal request timeout (Go duration: 30s, 1m, 2h).
--user-agent UAnative-mcp/fetchUser-Agent header.

Tools

fetch_url

FieldTypeRequiredDescription
urlstringyesAbsolute http:// or https:// URL.
methodstringnoHTTP method (default GET).
headersobject<string,string>noExtra 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

Released under the MIT License.