Skip to main content
Glama
Web Fetch MCP Server

Web Fetch MCP Server

by CormickKneey

Web Fetch MCP Server (Python)

基于 zcaceres/fetch-mcp 的 Python 实现,使用 FastMCP 框架。

功能

提供 4 个网页内容获取工具:

工具

描述

fetch_html

获取网页原始 HTML

fetch_json

获取并解析 JSON 数据

fetch_txt

获取纯文本(去除 HTML 标签)

fetch_markdown

获取网页并转换为 Markdown

所有工具支持以下参数:

  • url - 目标 URL(必填)

  • headers - 自定义请求头(可选)

  • max_length - 最大返回字符数,默认 50000(可选)

  • start_index - 起始字符位置,默认 0(可选)

Related MCP server: Fetch MCP Server

使用方式

本地运行

# 安装依赖
uv venv && source .venv/bin/activate
uv pip install -e .

# Stdio 模式
uv run python fetch_mcp_server.py

# SSE 模式(HTTP 服务)
uv run fastmcp run fetch_mcp_server.py:mcp --transport sse --port 8000

Docker 运行

# 构建镜像
docker build -t web-fetch-mcp .

# 运行容器
docker run -d -p 8000:8000 --name web-fetch-mcp web-fetch-mcp

# 或使用 docker-compose
docker-compose up -d

MCP 客户端配置

Streamable HTTP 模式(Docker 默认)

{
  "mcpServers": {
    "fetch": {
      "url": "http://localhost:8000/mcp"
    }
  }
}

SSE 模式

{
  "mcpServers": {
    "fetch": {
      "url": "http://localhost:8000/sse"
    }
  }
}

Stdio 模式

{
  "mcpServers": {
    "fetch": {
      "command": "python",
      "args": ["/path/to/fetch_mcp_server.py"]
    }
  }
}

环境变量

  • DEFAULT_LIMIT - 默认最大返回字符数(默认: 50000)

License

MIT

Available Tools

4 tools
fetch_htmlA

Fetch a website and return its unmodified contents as HTML.

Args: url: URL of the website to fetch headers: Optional headers to include in the request max_length: Maximum number of characters to return (default: 50000) start_index: Start content from this character index (default: 0)

Returns: The raw HTML content of the webpage

Inputs: url (required), headers, max_length, start_index. Returns: result

fetch_jsonA

Fetch a JSON file from a URL.

Args: url: URL of the JSON to fetch headers: Optional headers to include in the request max_length: Maximum number of characters to return (default: 50000) start_index: Start content from this character index (default: 0)

Returns: The JSON content as a string

Inputs: url (required), headers, max_length, start_index. Returns: result

fetch_markdownA

Fetch a website and return the content as Markdown.

Args: url: URL of the website to fetch headers: Optional headers to include in the request max_length: Maximum number of characters to return (default: 50000) start_index: Start content from this character index (default: 0)

Returns: The content of the webpage converted to Markdown format

Inputs: url (required), headers, max_length, start_index. Returns: result

fetch_txtA

Fetch a website and return the content as plain text (no HTML).

Args: url: URL of the website to fetch headers: Optional headers to include in the request max_length: Maximum number of characters to return (default: 50000) start_index: Start content from this character index (default: 0)

Returns: The text content of the webpage with HTML tags, scripts, and styles removed

Inputs: url (required), headers, max_length, start_index. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool is clearly distinguished by its output format: HTML, JSON, plain text, and Markdown. There is no overlap in purpose since the format determines the correct tool to use.

    Naming Consistency5/5

    All tool names follow the exact same verb_noun pattern: fetch_html, fetch_json, fetch_txt, fetch_markdown. This makes the tool set highly predictable and easy to navigate.

    Tool Count5/5

    Four tools is well-scoped for a web fetching server, covering the most common output formats without unnecessary bloat. Each tool earns its place and there is no redundancy.

    Completeness5/5

    The tool surface fully covers the stated purpose of fetching web content, including raw HTML, structured JSON, readable text, and Markdown. There are no obvious dead ends or missing core operations for a fetch-only server.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers