MCP Server Fetch Python

MCP Server Fetch Python

一个用于获取网页内容并将其转换为各种格式的 MCP 服务器。

内容获取
访问服务器

Tools

get-raw-text

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.

get-rendered-html

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.

get-markdown

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.

get-markdown-from-media

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.

README

mcp-server-fetch-python

一个用于获取和转换网络内容为各种格式的 MCP 服务器。此服务器提供全面的工具,用于从网页中提取内容,包括对 JavaScript 渲染的内容和媒体文件的支持。

<a href="https://glama.ai/mcp/servers/8d0zm2o56d"><img width="380" height="200" src="https://glama.ai/mcp/servers/8d0zm2o56d/badge" alt="Server Fetch Python MCP server" /></a>

功能

工具

该服务器提供四个专用工具:

  • get-raw-text: 直接从 URL 提取原始文本内容,无需浏览器渲染

    • 参数:
      • url: 目标网页的 URL(文本、JSON、XML、csv、tsv 等)(必需)
    • 最适合用于结构化数据格式或需要快速直接访问时
  • get-rendered-html: 使用无头浏览器获取完全渲染的 HTML 内容

    • 参数:
      • url: 目标网页的 URL(必需)
    • 对于需要 JavaScript 渲染的现代 Web 应用程序和 SPA 至关重要
  • 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",  // 替换为克隆仓库的实际路径
      "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

推荐服务器

mult-fetch-mcp-server

mult-fetch-mcp-server

A versatile MCP-compliant web content fetching tool that supports multiple modes (browser/node), formats (HTML/JSON/Markdown/Text), and intelligent proxy detection, with bilingual interface (English/Chinese).

精选
本地
Knowledge Graph Memory Server

Knowledge Graph Memory Server

为 Claude 实现持久性记忆,使用本地知识图谱,允许 AI 记住用户的信息,并可在自定义位置存储,跨对话保持记忆。

精选
本地
Hyperbrowser

Hyperbrowser

欢迎来到 Hyperbrowser,人工智能的互联网。Hyperbrowser 是下一代平台,旨在增强人工智能代理的能力,并实现轻松、可扩展的浏览器自动化。它专为人工智能开发者打造,消除了本地基础设施和性能瓶颈带来的麻烦,让您能够:

精选
本地
Exa MCP Server

Exa MCP Server

一个模型上下文协议服务器,它使像 Claude 这样的人工智能助手能够以安全和受控的方式,使用 Exa AI 搜索 API 执行实时网络搜索。

精选
mcp-perplexity

mcp-perplexity

Perplexity API 的 MCP 服务器。

精选
MCP Web Research Server

MCP Web Research Server

一个模型上下文协议服务器,使 Claude 能够通过集成 Google 搜索、提取网页内容和捕获屏幕截图来进行网络研究。

精选
PubMedSearch MCP Server

PubMedSearch MCP Server

A Model Content Protocol server that provides tools to search and retrieve academic papers from PubMed database.

精选
YouTube Translate MCP

YouTube Translate MCP

一个模型上下文协议服务器,可以通过文字稿、翻译、摘要和各种语言的字幕生成来访问 YouTube 视频内容。

精选
mcp-codex-keeper

mcp-codex-keeper

作为开发知识的守护者,为 AI 助手提供精心策划的最新文档和最佳实践访问权限。

精选
Perplexity Deep Research MCP

Perplexity Deep Research MCP

一个服务器,它允许 AI 助手使用 Perplexity 的 sonar-deep-research 模型进行网络搜索,并提供引用支持。

精选