Safe Fetch logo

Safe Fetch

Fetches public web pages for agents while blocking SSRF, DNS rebinding, unsafe redirects, and internal destinations.

Install Safe Fetch

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "safe-fetch": {
      "command": "npx",
      "args": [
        "-y",
        "safe-fetch-mcp-server"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Claude Code command
claude mcp add --transport stdio safe-fetch -- npx -y safe-fetch-mcp-server

Run in your terminal. Add --scope project to share it with your team through .mcp.json.

Automated check passed— started and listed 1 tools correctly ().

Overview

safe-fetch MCP server retrieves HTTP and HTTPS web content for agents while blocking private networks, loopback addresses, cloud metadata endpoints, and unsafe redirect targets. Its main `fetch_url` tool converts pages to Markdown or returns raw text, with options for article-focused extraction and image alt text. The server validates resolved IPs, pins connections, and rechecks redirects to reduce SSRF and DNS-rebinding risks. Use it when an agent needs controlled access to external documentation or websites without direct access to internal network resources.

Use cases

  • Fetch public documentation for an agent
  • Extract article content from external web pages
  • Inspect URLs without exposing internal network services
  • Replace an unprotected fetch server with SSRF checks
  • Retrieve paginated page text through the compatibility tool

Key features

  • SSRF and DNS-rebinding defenses
  • Redirect destination revalidation
  • Markdown or raw text output
  • Main-content or full-page extraction
  • Untrusted-content framing
  • Stdio and Streamable HTTP modes

Tools1

What Safe Fetch lets your agent do. Expand a tool for its parameters.

Verified live~924 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

18/18 checks healthy over the last 98d

What it can do

From the 1 tool this server returned when we ran it; 1 declare their own safety hints.

Makes network requests · 1Read-only tools · 1
Network at startup3 connections
Files written at startupNone
Install scriptsNone
npm provenanceSigned build
Package age112 days
Maintainers1

Observed 2026-12-02 in an isolated sandbox. A description of reach, not a security audit.

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 13d ago via OSV.dev · safe-fetch-mcp-server (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars1Stargazers on the source repository.
npm downloads1.2kPackage downloads in the last 30 days.
Last commit5d agoMost recent push to the default branch.
Availability100%Our rolling endpoint + install checks that succeeded.
Install checkPassedOur sandbox started it and listed its tools.
Tools exposed1Callable tools this server registers over MCP.
Directory activity3 viewsConfig copies, upvotes, and views on AllMCPs.

How Safe Fetch works

What safe-fetch does

safe-fetch provides MCP tools for retrieving web content without allowing the calling agent to reach protected network destinations. It accepts absolute http and https URLs and rejects unsupported schemes such as file:. Requests to loopback, private, link-local, reserved, cloud-metadata, and other blocked address ranges are refused, including IPv4-mapped IPv6 bypass forms.

Fetched page content is returned as untrusted external data, separated with markers so the agent can treat page text as information rather than instructions. HTML can be converted to Markdown, and the server can focus extraction on the main article instead of menus, banners, and footers.

How it works

The server resolves a hostname, checks the resolved address against explicit blocked ranges, and connects to the validated address. Redirects are checked again rather than inheriting approval from the original URL. This design addresses SSRF, DNS rebinding, and redirect-to-internal attacks.

A request for a public page can return cleaned Markdown along with structured metadata such as the HTTP status, final URL, paging offsets, and error codes. Policy failures use POLICY_REJECTED and are not retryable. The server runs locally over stdio by default and can also expose an MCP endpoint in Streamable HTTP mode at http://127.0.0.1:3000/mcp.

Setup and configuration

Node.js 22 or newer is required. Run the package with npx; no build step or mandatory configuration is needed:

Terminal
npx -y safe-fetch-mcp-server

For clients that require a URL, start HTTP mode with:

Terminal
npx -y safe-fetch-mcp-server --http

The server can be configured with environment variables, including SAFE_FETCH_ALLOWLIST for permitted hostnames. SAFE_FETCH_COMPAT_TOOL=true enables the compatibility tool for clients using the reference mcp-server-fetch interface. The equivalent command-line option is --compat. Additional supported options include --ignore-robots-txt and --user-agent.

Claude Desktop, Claude Code, Codex, VS Code, Cursor, and Windsurf can launch the stdio command directly. Other MCP clients can use the same command if they support stdio, or the HTTP endpoint when they require a URL.

Tools and capabilities

  • fetch_url accepts an absolute HTTP or HTTPS URL.
  • format selects Markdown conversion or raw text output.
  • extract supports main-content extraction or full-page conversion.
  • images can replace images with their alt text.
  • --compat adds a fetch tool with url, max_length, start_index, and raw arguments.
  • Compatibility mode also provides the matching fetch prompt while applying safe-fetch's request guards.

Limitations and notes

The --proxy-url option is not supported. Robots.txt applies to tool calls but not to the user-started fetch prompt in compatibility mode. SAFE_FETCH_ALLOW_LOCAL does not permit cloud-metadata, link-local, or reserved destinations. Invalid configuration values stop the server and identify the affected variable.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Safe Fetch

safe-fetch is an MCP server that connects AI agents to public HTTP and HTTPS web pages through controlled fetches. Its main tools are `fetch_url` for guarded URL retrieval and the optional compatibility `fetch` tool. It blocks private, loopback, link-local, reserved, and cloud-metadata destinations.

Install it by running `npx -y safe-fetch-mcp-server` with Node.js 22 or newer. The server needs no build step or required configuration. Add that command to an MCP client's stdio configuration, or append `--http` for Streamable HTTP mode.

Yes, safe-fetch works with Cursor through its stdio MCP configuration. Add an `mcpServers` entry that runs `npx` with `-y safe-fetch-mcp-server` in the global or project-level Cursor configuration.

safe-fetch prevents SSRF by resolving hostnames, checking the resolved IP against blocked ranges, pinning the connection to that address, and validating every redirect again. It rejects private, loopback, link-local, reserved, and cloud-metadata destinations, including IPv4-mapped IPv6 bypass forms.

Yes, run safe-fetch with `--compat` or set `SAFE_FETCH_COMPAT_TOOL=true` to add a compatible `fetch` tool. It accepts the reference tool's `url`, `max_length`, `start_index`, and `raw` arguments while routing requests through safe-fetch's protections.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewSafe Fetch AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/safe-fetch?style=directory)](https://allmcps.com/mcp/safe-fetch)
HTML Embed
<a href="https://allmcps.com/mcp/safe-fetch"><img src="https://allmcps.com/api/badge/safe-fetch?style=directory" alt="Safe Fetch on AllMCPs" /></a>