
一个灵活的HTTP获取模型上下文协议服务器。
概览
一个MCP服务器,用于获取多种格式的网页内容——HTML、JSON、纯文本、Markdown、可读文章内容和YouTube文字记录。 所有工具都接受以下常见参数: - — 获取网站并返回其原始HTML内容。 - — 获取一个网站并将其内容转换为Markdown后返回。 - — 获取网站并返回去除HTML标签、脚本和样式的纯文本。 - — 获取一个URL,返回JSON响应。 - — 获取网站并使用 Mozilla 可读性提取主条目内容,返回为 Markdown。去除导航、广告和模板。非常适合文章和博客文章。 - — 获取 YouTube 视频的字幕/文字稿。如有 yt-dlp 格式,否则直接从页面提取。接受额外的 lang 参数(默认为“en”)以选择字幕语言。
概述(AI 翻译)
一个MCP服务器,用于获取多种格式的网页内容——HTML、JSON、纯文本、Markdown、可读文章内容和YouTube文字记录。
工具
所有工具都接受以下常见参数:
| 参数 | 类型 | 必需 | 描述 |
|---|---|---|---|
url |
字符串 | 是的 | 获取URL |
headers |
对象 | 无 | 请求中包含的自定义头部 |
max_length |
数字 | 无 | 返回的最大字符数(默认:5000) |
start_index |
数字 | 否 | 从这个字符索引开始(默认:0) |
proxy |
字符串 | 无 | 代理URL(例如http://proxy:8080) |
-
fetch_html — 获取网站并返回其原始HTML内容。
-
fetch_markdown — 获取网站并将其内容转换为Markdown后返回。
-
fetch_txt — 获取网站并返回去除HTML标签、脚本和样式的纯文本。
-
fetch_json — 获取一个URL,返回JSON响应。
-
fetch_readable — 获取网站并使用Mozilla可读性提取主条目内容,返回为Markdown。带导航、广告和模板。非常适合文章和博客文章。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Fetch MCP Server
An MCP server for fetching web content in multiple formats — HTML, JSON, plain text, Markdown, readable article content, and YouTube transcripts.
Tools
All tools accept the following common parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
url |
string | Yes | URL to fetch |
headers |
object | No | Custom headers to include in the request |
max_length |
number | No | Maximum characters to return (default: 5000) |
start_index |
number | No | Start from this character index (default: 0) |
proxy |
string | No | Proxy URL (e.g. http://proxy:8080) |
-
fetch_html — Fetch a website and return its raw HTML content.
-
fetch_markdown — Fetch a website and return its content converted to Markdown.
-
fetch_txt — Fetch a website and return plain text with HTML tags, scripts, and styles removed.
-
fetch_json — Fetch a URL and return the JSON response.
-
fetch_readable — Fetch a website and extract the main article content using Mozilla Readability, returned as Markdown. Strips navigation, ads, and boilerplate. Ideal for articles and blog posts.
-
fetch_youtube_transcript — Fetch a YouTube video’s captions/transcript. Uses
yt-dlpif available, otherwise extracts directly from the page. Accepts an additionallangparameter (default:"en") to select the caption language.
Installation
As an MCP server
Add to your MCP client configuration:
{
"mcpServers": {
"fetch": {
"command": "npx",
"args": ["mcp-fetch-server"]
}
}
}
As a CLI
npx mcp-fetch [flags]
Or install globally:
npm install -g mcp-fetch-server
mcp-fetch [flags]
CLI Usage
mcp-fetch [flags]
Commands
| Command | Description |
|---|---|
html |
Fetch a URL and return raw HTML |
markdown |
Fetch a URL and return Markdown |
readable |
Fetch a URL and return article content as Markdown (via Readability) |
txt |
Fetch a URL and return plain text |
json |
Fetch a URL and return JSON |
youtube |
Fetch a YouTube video transcript |
Flags
| Flag | Description |
|---|---|
--max-length |
Maximum characters to return |
--start-index |
Start from this character index |
--proxy |
Proxy URL |
--lang |
Language code for YouTube transcripts (default: en) |
--help |
Show help message |
--version |
Show version |
Examples
# Fetch a page as markdown
安装
npx mcp-fetch-server配置
{
"mcpServers": {
"fetch": {
"command": "npx",
"args": ["mcp-fetch-server"]
}
}
}