MCP内容抓取服务器
一种用于获取和转换网络内容为各种格式的MCP服务器。
可用工具 (4 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
get-raw-text 1 个参数 需填 1 项
Extracts raw text content directly from URLs without browser rendering. Ideal for structured data formats like JSON, XML, CSV, TSV, or plain text files. Best used when fast, direct access to the source content is needed without processing dynamic elements.
必填参数:url
get-rendered-html 1 个参数 需填 1 项
Fetches fully rendered HTML content using a headless browser, including JavaScript-generated content. Essential for modern web applications, single-page applications (SPAs), or any content that requires client-side rendering to be complete.
必填参数:url
get-markdown 1 个参数 需填 1 项
Converts web page content to well-formatted Markdown, preserving structural elements like tables and definition lists. Recommended as the default tool for web content extraction when a clean, readable text format is needed while maintaining document structure.
必填参数:url
get-markdown-from-media 1 个参数 需填 1 项
Performs AI-powered content extraction from media files (images and videos) and converts the results to Markdown format. Specialized tool for visual content analysis that utilizes computer vision and OCR capabilities to generate descriptive text from media sources.
必填参数:url
服务介绍
mcp-server-fetch-python
一个用于抓取和转换网页内容为各种格式的MCP服务器。该服务器提供了从网页中提取内容的全面工具,包括对JavaScript渲染内容和媒体文件的支持。
功能
工具
服务器提供了四个专门的工具:
-
get-raw-text: 直接从URL提取原始文本内容,无需浏览器渲染
- 参数:
url: 目标网页的URL(文本、JSON、XML、csv、tsv等)(必需)
- 最适用于结构化数据格式或需要快速直接访问的情况
- 参数:
-
get-rendered-html: 使用无头浏览器获取完全渲染后的HTML内容
- 参数:
url: 目标网页的URL (必需)
- 对于需要JavaScript渲染的现代Web应用程序和单页应用至关重要
- 参数:
-
get-markdown: 将网页内容转换为格式良好的Markdown
- 参数:
url: 目标网页的URL (必需)
- 在提供清晰易读的文本输出的同时保留了结构元素
- 参数:
-
get-markdown-from-media: 利用AI技术从媒体文件中提取内容
- 参数:
url: 目标媒体文件(图片、视频)的URL (必需)
- 利用计算机视觉和OCR进行视觉内容分析
- 需要在环境变量中设置有效的OPENAI_API_KEY
- 如果未设置API密钥或处理媒体文件时出现问题,将返回错误消息
- 参数:
使用方法
Claude Desktop
要与Claude Desktop一起使用,请添加服务器配置:
在MacOS上: ~/Library/Application\ Support/Claude/claude_desktop_config.json
在Windows上: %APPDATA%/Claude/claude_desktop_config.json
"mcpServers": {
"mcp-server-fetch-python": {
"command": "uvx",
"args": [
"mcp-server-fetch-python"
]
}
}
环境变量
可以配置以下环境变量:
- OPENAI_API_KEY: 使用
get-markdown-from-media工具时必需。此密钥用于基于AI的图像分析和内容提取。 - PYTHONIOENCODING: 如果遇到输出字符编码问题,请设置为"utf-8"。
- MODEL_NAME: 指定要使用的模型名称。默认值为"gpt-4o"。
"mcpServers": {
"mcp-server-fetch-python": {
"command": "uvx",
"args": [
"mcp-server-fetch-python"
],
"env": {
"OPENAI_API_KEY": "sk-****",
"PYTHONIOENCODING": "utf-8",
"MODEL_NAME": "gpt-4o",
}
}
}
本地安装
或者,您可以本地安装并运行服务器:
git clone https://github.com/tatn/mcp-server-fetch-python.git
cd mcp-server-fetch-python
uv sync
uv build
然后向Claude Desktop配置文件中添加如下配置:
"mcpServers": {
"mcp-server-fetch-python": {
"command": "uv",
"args": [
"--directory",
"path\\to\\mcp-server-fetch-python", # Replace with actual path to the cloned repository
"run",
"mcp-server-fetch-python"
]
}
}
开发
调试
您可以使用npx通过以下命令启动MCP Inspector:
npx @modelcontextprotocol/inspector uvx mcp-server-fetch-python
npx @modelcontextprotocol/inspector uv --directory path\\to\\mcp-server-fetch-python run mcp-server-fetch-python