MCP server, by Model Context Protocol
Fetch MCP Server
Python MCP server that fetches a URL and returns readable content as markdown, in chunks for long pages.
Quick facts
What it does
The fetch server retrieves a URL and returns its readable content as markdown. It is a Python package run with uvx, pip, or the mcp/fetch Docker image over stdio. It exposes one tool, fetch, and one prompt of the same name. The tool is annotated read-only, non-destructive, and idempotent, and it is also marked open-world, because it reaches arbitrary hosts on the internet.
A page is returned in slices. The tool's max_length argument caps the number of characters returned (default 5000), and start_index sets the character offset to continue from (default 0). The README describes this as the way a model reads a long page in chunks until it finds what it needs. A raw option returns the content without markdown conversion.
HTML is converted with readabilipy. When Node.js is on the PATH, readabilipy runs Mozilla Readability.js in a Node.js subprocess, and otherwise a pure-Python extractor keeps headings and text but drops link targets. The README warns that the Node.js subprocess runs with no timeout, so a Node.js that hangs can stall a tool call until the client gives up. The --no-readability-js argument forces the Python extractor and keeps the server from ever starting Node.js. For pages that hide their real content until scripts run, the server unhides a hidden container that holds more text than Readability extracted and keeps that result only if it has more text.
robots.txt handling depends on who asked. By default the server obeys robots.txt when the request came from the model through the tool, and does not when the request was user initiated through the prompt. Every redirect hop of a tool fetch is checked against the robots.txt of the host it leads to. If the robots.txt request fails to connect, or is answered with 401, 403 or a 5xx, the tool refuses the fetch; any other 4xx is treated as no rules. The --ignore-robots-txt argument disables the check.
Network scope is the main security topic. The README opens with a caution that the server can reach local and internal addresses, and then documents a default guard: it refuses private, loopback, link-local and other non-public addresses, including cloud metadata endpoints such as 169.254.169.254, and checks every redirect hop the same way. The --allow-private-ips argument turns the guard off. The README says the guard checks the addresses a hostname resolves to before each request, so it does not protect against DNS rebinding between that check and the connection, and a hostname only a proxy can resolve is not checked.
The README also covers identity and routing. The default user agent is ModelContextProtocol/1.0 with an Autonomous or User-Specified label, and --user-agent replaces it. The --proxy-url argument sets a proxy; without it the server uses HTTP_PROXY, HTTPS_PROXY and ALL_PROXY (honoring NO_PROXY), and supports http(s) and SOCKS5 proxies. The server requires MCP Python SDK 2.x (mcp>=2.3,<3), serves both the 2026-07-28 and 2025-11-25 protocol eras over stdio, and is MIT licensed.
Configuration
Run with uvx mcp-server-fetch, install with pip install mcp-server-fetch, or use the mcp/fetch Docker image.
{
"mcpServers": {
"fetch": {
"command": "uvx",
"args": ["mcp-server-fetch"]
}
}
}Source: https://github.com/modelcontextprotocol/servers/tree/main/src/fetch. Placeholders only. Replace them in your own environment, and never commit real keys to a repository.
| Environment variable | Required | Purpose |
|---|---|---|
PYTHONIOENCODING | Optional | Set to utf-8 in the Windows examples to avoid character-encoding timeouts. |
Tools and features on record
fetch (tool) Config checked
Fetches a URL and returns extracted markdown. Arguments: url (string, required), max_length (integer, default 5000), start_index (integer, default 0), raw (boolean, default false). Annotated readOnlyHint, idempotentHint and openWorldHint true, destructiveHint false.
Chunked reading Config checked
Set start_index to the end of the previous slice to continue a long page, so the model can page through content until it finds the answer instead of loading the whole document.
fetch prompt Config checked
Prompt form of the same capability. Takes a required url argument. If the fetch fails, the prompt still returns, and its message holds the reason.
robots.txt handling Config checked
Obeyed for model-initiated tool calls and not for user-initiated prompt calls. Redirect hops are checked too. A failed connection, 401, 403 or 5xx on robots.txt makes the tool refuse. Pass --ignore-robots-txt to disable.
Private address guard Config checked
By default refuses loopback, private, link-local (including 169.254.169.254), shared-address and other non-public ranges, on the request, every redirect hop and the robots.txt fetch. Pass --allow-private-ips to fetch from a development server or intranet host.
HTML extraction options Config checked
Uses readabilipy. Node.js on the PATH selects Readability.js, otherwise a pure-Python extractor that drops link targets. --no-readability-js forces the Python path and never starts Node.js.
Proxy and user agent Config checked
--proxy-url sets a proxy, otherwise HTTP_PROXY, HTTPS_PROXY, ALL_PROXY and NO_PROXY apply, with http(s) and SOCKS5 support. --user-agent replaces the default Autonomous or User-Specified agent string.
Error results Config checked
A robots.txt refusal, unreachable page, HTTP error status, refused private address or unusable proxy setting returns isError with text beginning Error executing tool fetch. An unknown tool is a JSON-RPC -32602 error.
Security notes
- Network scope is any URL the model or user asks for. The README caution says the server can access local and internal addresses and may expose sensitive data if used carelessly, so treat it as a tool that sends HTTP requests from your machine.
- The README documents a default guard that refuses private, loopback, link-local and cloud metadata addresses, and that checks redirect hops and the robots.txt fetch the same way. Leave --allow-private-ips off unless you deliberately need local or intranet pages.
- The guard is not complete. The README states it does not protect against DNS rebinding between the address check and the connection, and that a hostname only a proxy can resolve is not checked. Do not rely on it as the only control where internal services must stay unreachable.
- Fetched page text goes into the model context as returned. A page can contain instructions aimed at the model, so treat fetched content as untrusted input and keep high-impact tools out of the same session when you fetch pages you do not control.
- Model-initiated fetches obey robots.txt by default, and user-initiated prompt fetches do not. The --ignore-robots-txt argument disables it entirely, so avoid it unless you have a reason and permission.
- The Node.js subprocess used for extraction runs with no timeout, according to the README. If a call hangs, use --no-readability-js to keep the server from starting Node.js.
- No API keys are required. On Windows, the README says to set PYTHONIOENCODING to utf-8 if tool calls time out because of character encoding problems.
An MCP server runs with the permissions of the process you start it from. Scope credentials to the narrowest access the job needs, and review what the client will send before connecting anything sensitive.
Sources and freshness
- Official source: https://github.com/modelcontextprotocol/servers/tree/main/src/fetch
- Repository: https://github.com/modelcontextprotocol/servers
Checked 2026-11-03. Config-checked means the configuration and feature list trace to the official source above; it does not mean AgentsUse ran the server. Send corrections through the contact page. Back to the MCP server index.