Fetch

Fetch

A server that flexibly fetches HTML, JSON, Markdown, or plaintext.

643
Stars
106
Forks
0
Releases

Overview

Fetch MCP Server is a stateless MCP server designed to fetch and transform web content on demand. It exposes tools to retrieve content in multiple formats: HTML, JSON, plain text, and Markdown from a given URL, with optional headers and content-length controls. Each fetch operation accepts a required url, optional headers, an optional max_length (default 5000; can be adjusted via an environment variable), and an optional start_index to retrieve content in pieces. Depending on the tool, the response is the raw HTML (fetch_html), parsed JSON (fetch_json), plain text with HTML tags, scripts, and styles removed (fetch_txt), or Markdown-converted content (fetch_markdown). The server uses the modern fetch API, employs JSDOM for HTML parsing and text extraction, and uses TurndownService to convert HTML to Markdown. It does not maintain persistent resources and is intended for on-demand content retrieval. Getting started and usage details are provided (npm install, npm run build, npm start), along with a desktop-app integration example showing how to configure an MCP server that runs via npx mcp-fetch-server with an optional DEFAULT_LIMIT.

Details

Owner
zcaceres
Language
TypeScript
License
MIT License
Updated
2025-12-07

Features

Fetch HTML content

Fetch a website and return the content as HTML. Inputs include url (required), headers (optional), max_length (default 5000), and start_index; returns the raw HTML content.

Fetch JSON content

Fetch a JSON file from a URL. Inputs include url (required), headers (optional), max_length (default 5000), and start_index; returns the parsed JSON content.

Fetch plain text content

Fetch a website and return the content as plain text with HTML, scripts, and styles removed. Inputs include url, headers, max_length, and start_index.

Fetch Markdown content

Fetch a website and return the content converted to Markdown. Inputs include url, headers, max_length, and start_index.

HTML parsing with JSDOM

Uses JSDOM for HTML parsing and text extraction to support accurate plain text rendering.

HTML to Markdown conversion

Uses TurndownService to convert HTML content to Markdown format.

Configurable fetch limits

DEFAULT_LIMIT environment variable sets the default maximum fetch size (0 means no limit).

No persistent resources

The server does not maintain persistent resources; content is fetched and transformed on demand.

Tags

MCPserverweb contentHTMLJSONPlain textMarkdownon-demandno persistent resourcesfetch APIJSDOMTurndownServiceenvironment variableDEFAULT_LIMITnpm