Fetch MCP Server
This MCP server fetches public web content and returns it in agent-friendly formats with optional headers and pagination.
fetch_html: fetch a URL and return unmodified HTML.fetch_markdown: fetch a page and convert it to Markdown.fetch_txt: fetch a page and return plain text (the README's current tool name isfetch_text).fetch_json: fetch a JSON resource from a URL.Common options include custom
headers, amax_lengthcharacter limit, andstart_indexpagination.The README also documents Readability article extraction (
fetch_readable), YouTube transcript fetching (fetch_transcript), operator-configured proxies, SSRF protection, CLI usage, and stdio/Streamable HTTP MCP transports, though those two extra tools are not present in the supplied schema.
Allows converting web content to Markdown format using the fetch_markdown tool, using TurndownService for HTML to Markdown conversion
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Fetch MCP Server fetch the latest blog post from techcrunch.com as markdown"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Fetch MCP

Fetch the public web in agent-ready formats. A lightweight, agent-friendly MCP server (mcp-fetch-server, supporting stdio and 2025-11-25 Streamable HTTP) and local CLI (mcp-fetch) for HTML, Markdown, Mozilla Readability articles, plain text, JSON, and YouTube transcripts—with custom headers, HTTP/SOCKS proxies, pagination, and built-in SSRF protection. Supports Node.js >= 22 LTS and Bun.
Docs: fetch.zach.dev · LLM-friendly docs: fetch.zach.dev/llms.txt
What's New & Breaking Changes in v2.0.0
Highlights
MCP
2025-11-25Streamable HTTP transport: runmcp-fetch-server --http [--host 127.0.0.1] [--port 3000]to serve stateless MCP onPOST /mcpwithHost/OriginDNS-rebinding guards.Cross-vendor MCP conformance: all tool schemas include MCP
2025-11-25read-only annotations,additionalProperties: false, and typedheadersfor clean compatibility across Claude, Gemini, and OpenAI MCP clients.Expanded proxy support: zero-dependency
http,https,socks4,socks4a,socks5,socks5h, and barehost:portproxies withNO_PROXYsupport (including:portand[ipv6]:port) and mandatory credential redaction.
Breaking Changes
Aligned MCP tool names:
fetch_txt→fetch_text,fetch_youtube_transcript→fetch_transcript.Aligned CLI subcommands:
txt→text,youtube→transcript, plus repeatable--header <Key:Value>.--langis now accepted only ontranscriptand rejected on web subcommands.Strict MCP argument validation: unexpected tool parameters (including any caller-supplied
proxykey) are now rejected withisError: trueinstead of being silently ignored.Fail-fast configuration: invalid
DEFAULT_LIMIT,MAX_RESPONSE_BYTES, or proxy URLs now fail explicitly instead of silently falling back to defaults or direct connections.Explicit missing caption language: requesting an unavailable YouTube transcript language now fails explicitly and lists the available language codes.
Runtime floor: requires Node.js
>= 22LTS or Bun.
Related MCP server: Fetch MCP Server
MCP Tools
All six tools conform to MCP 2025-11-25, carry read-only annotations (readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true), enforce strict additionalProperties: false, and accept the following common parameters (proxy routing for MCP is strictly Operator-configured via environment variables and can never be supplied by an Agent):
Parameter | Type | Required | Description |
| string | Yes | Public |
|
| No | Optional custom request headers |
| number | No | Maximum characters to return (default: |
| number | No | Start content from this character index (default: |
fetch_html— Fetch a URL and return its unmodified HTML content.fetch_markdown— Fetch a URL, strip<script>and<style>, and convert to Markdown.fetch_readable— Extract the main article content using Mozilla Readability, convert to Markdown, and prepend# <title>when present.fetch_text— Fetch a URL, strip<script>and<style>, and return normalized plain text.fetch_json— Fetch a JSON resource, validate viaJSON.parse, and return compact JSON.fetch_transcript— Fetch a YouTube video's captions (tries localyt-dlpfirst with manual and auto-generated subtitles enabled, falling back to direct watch-page + caption XML extraction). Returns a[Transcript language: ...]header followed by[m:ss]timestamped lines. Accepts an optionallangparameter (default:"en"), and lists available language codes if the requested language is unavailable.
Installation
As an MCP server (stdio)
Add to your MCP client configuration (Claude Code, Claude Desktop, Gemini CLI, etc.):
{
"mcpServers": {
"fetch": {
"command": "npx",
"args": ["mcp-fetch-server"]
}
}
}As a Streamable HTTP MCP server
Start the server on localhost (defaults to 127.0.0.1:3000):
npx mcp-fetch-server --http --host 127.0.0.1 --port 3000Flag | Default | Description |
| (off — uses | Enable stateless MCP |
|
| Bind address (requires |
|
| Listen port |
Requests to /mcp validate Host and Origin headers against the bound address (403 on mismatch to block localhost DNS rebinding). Unknown paths (including legacy /sse) return 404, and non-POST methods return 405.
Connect any Streamable HTTP MCP client to http://127.0.0.1:3000/mcp — for example, with MCP Inspector:
npx @modelcontextprotocol/inspector --url http://127.0.0.1:3000/mcpAs a CLI
npx -p mcp-fetch-server mcp-fetch <command> <url> [flags]Or install globally:
npm install -g mcp-fetch-server
mcp-fetch <command> <url> [flags]CLI Usage
mcp-fetch <command> <url> [flags]Commands
Command | Description |
| Fetch a URL and return raw HTML |
| Fetch a URL and return Markdown |
| Fetch a URL and return article content as Markdown (via Readability) |
| Fetch a URL and return plain text |
| Fetch a URL and return JSON |
| Fetch a YouTube video transcript |
Flags
Flag | Description |
| Custom request header (repeatable) |
| Maximum characters to return ( |
| Start from this character index |
| Proxy URL ( |
| Language code for YouTube transcripts (only valid with |
| Show help message |
| Show version |
Examples
# Fetch a page as markdown
mcp-fetch markdown https://example.com
# Extract article content without boilerplate
mcp-fetch readable https://example.com/blog/post
# Get a YouTube transcript in English (quote URLs containing '?' in zsh)
mcp-fetch transcript 'https://www.youtube.com/watch?v=jNQXAC9IVRw' --lang en
# Fetch with custom headers and a length limit
mcp-fetch html https://example.com --header "Accept-Language: en-US" --max-length 10000
# Fetch through an HTTP or SOCKS5 proxy
mcp-fetch json https://api.example.com/data --proxy socks5://127.0.0.1:1080Environment Variables
mcp-fetch-server validates DEFAULT_LIMIT and MAX_RESPONSE_BYTES fail-fast at startup (writing the error to stderr and exiting 1 if invalid).
Variable | Description |
| Default character limit for responses (default: |
| Maximum raw and decompressed response body size in bytes (default: |
| Proxy URL for |
| Proxy URL for |
| Fallback proxy URL for HTTP/HTTPS requests |
| Comma-separated hostnames, |
Example with custom limits and an Operator proxy:
{
"mcpServers": {
"fetch": {
"command": "npx",
"args": ["mcp-fetch-server"],
"env": {
"DEFAULT_LIMIT": "50000",
"HTTPS_PROXY": "socks5://127.0.0.1:1080"
}
}
}
}Security & Reliability
SSRF Protection: Restricts all requests and redirect hops to
http:/https:, blockslocalhost/*.localhostand all IANA-reserved IPv4/IPv6 ranges (including IPv4-mapped IPv6 and multicast), fails closed on malformed IPs or DNS failures, pins validated DNS records directly to sockets on direct connections to prevent DNS rebinding, and delegates public hostname DNS to the proxy when proxied.MCP Transport & Trust Boundary: An Agent calling an MCP tool can never supply or override proxy routing (
additionalProperties: falserejects unexpected parameters such as a smuggledproxykey before any network I/O); Streamable HTTP defaults to127.0.0.1and validatesHostandOriginheaders to block localhost DNS rebinding.Header & Redirect Hygiene: Strips
Authorization,Cookie, andProxy-Authorizationacross cross-origin redirects and cross-origin YouTube caption URLs, caps redirects at 10 hops, rejects CR/LF and invalid header characters, and redacts proxy credentials from all error and diagnostic output.Resource Safety: Enforces
MAX_RESPONSE_BYTESacross declaredContent-Length, streaming wire bytes, decompressedgzip/deflate/brstreams, andyt-dlpsubtitle files; rejects clearly binaryContent-Typeresponses; enforces a30ssingle-attempt timeout.YouTube Isolation: Restricts
fetch_transcript/mcp-fetch transcriptto allowlisted YouTube hosts, validateslangcodes strictly, passes--end-of-options sentinel toyt-dlp, and never swallows validation or SSRF errors into fallback.
Development
bun install
bun run lint # Biome lint & formatting check
bun run typecheck # TypeScript typecheck
bun run build # Build dist/index.js and dist/cli.js
bun test # Unit, integration, scenario, and offline replay matrix tests
bun run harness # Interactive DD harness (type help)
bun run harness run scenarios # Replay all DD harness scenarios
bun run verify:replay # Run 3-form-factor offline cassette replay (CLI, stdio, Streamable HTTP)
bun run verify:live # On-demand live-internet verification across all 3 form factors (add -- --record to refresh cassettes)More MCP & CLI Projects
markdownify-mcp — Convert PDFs, Office docs, images, audio, web pages, and Git repositories into clean Markdown over MCP.
gtasks-mcp — Google Tasks MCP server for managing task lists and to-dos from AI agents.
spotify-cli — Control Spotify playback, search tracks, and manage playlists from your AI agent or terminal.
builtwith-mcp — Query website technology stacks via BuiltWith over MCP or the CLI.
License
This project is licensed under the MIT License.
Available Tools
4 toolsfetch_htmlC
Fetch a website and return its unmodified contents as HTML
Inputs: url (required), headers, max_length, start_index.
fetch_jsonC
Fetch a JSON file from a URL
Inputs: url (required), headers, max_length, start_index.
fetch_markdownC
Fetch a website and return its contents converted content to Markdown
Inputs: url (required), headers, max_length, start_index.
fetch_txtA
Fetch a website, convert the content to plain text (no HTML)
Inputs: url (required), headers, max_length, start_index.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: fetch_html returns raw HTML, fetch_json retrieves JSON files, fetch_markdown converts to Markdown, and fetch_txt extracts plain text. There is no ambiguity or overlap in functionality, making it easy for an agent to select the correct tool based on the desired output format.
All tool names follow a consistent verb_noun pattern with 'fetch_' prefix and descriptive suffixes (html, json, markdown, txt). This predictable naming scheme enhances readability and usability, allowing agents to intuitively understand each tool's function without confusion.
With 4 tools, the server is well-scoped for its purpose of fetching and converting web content. Each tool earns its place by covering distinct output formats (HTML, JSON, Markdown, plain text), avoiding bloat while providing comprehensive coverage for common web data retrieval needs.
The tool set provides complete coverage for the domain of fetching web content in various formats. It includes raw HTML, structured JSON, and converted formats (Markdown and plain text), leaving no obvious gaps. Agents can handle a wide range of web data retrieval scenarios without dead ends.
Maintenance
Related MCP Connectors
Fetch public web pages as Markdown or raw content, with optional browser rendering.
Fetch any URL as clean markdown, HTML, or a screenshot for AI agents.
Fetch public web pages live and get clean Markdown, text or HTML.
Fetch public web pages live and get clean Markdown, text or HTML.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides functionality to fetch web content in various formats, including HTML, JSON, plain text, and Markdown.42MIT
- AlicenseBqualityDmaintenanceProvides functionality to fetch web content in various formats, including HTML, JSON, plain text, and Markdown with support for custom headers.43MIT
- AlicenseNot gradedqualityCmaintenanceProvides functionality to fetch and transform web content in various formats (HTML, JSON, plain text, and Markdown) through simple API calls.117,041 npm1MIT
- AlicenseNot gradedqualityDmaintenanceEnables fetching and converting web content into various formats including HTML, JSON, plain text, and Markdown. It supports custom request headers and provides specialized tools for on-demand web data retrieval and transformation.MIT