Skip to main content
Glama
modelcontextprotocol

Fetch MCP Server

Official

Fetch MCP 服务器

一个提供网页内容抓取功能的模型上下文协议 (MCP) 服务器。此服务器使 LLM 能够检索和处理网页内容,并将 HTML 转换为 Markdown 以便更轻松地阅读。

[!CAUTION] 此服务器可以访问本地/内部 IP 地址,可能存在安全风险。在使用此 MCP 服务器时请务必小心,以确保不会泄露任何敏感数据。

fetch 工具会截断响应,但通过使用 start_index 参数,您可以指定从何处开始提取内容。这允许模型分块读取网页,直到找到所需的信息。

可用工具

  • fetch - 从互联网抓取 URL 并将其内容提取为 Markdown。

    • url (字符串,必需): 要抓取的 URL

    • max_length (整数,可选): 返回的最大字符数(默认值:5000)

    • start_index (整数,可选): 从该字符索引开始提取内容(默认值:0)

    • raw (布尔值,可选): 获取原始内容而不进行 Markdown 转换(默认值:false)

提示词 (Prompts)

  • fetch

    • 抓取 URL 并将其内容提取为 Markdown

    • 参数:

      • url (字符串,必需): 要抓取的 URL

安装

可选:安装 node.js,这将使 fetch 服务器使用更健壮的 HTML 简化器。

使用 uv (推荐)

使用 uv 时无需特殊安装。我们将使用 uvx 直接运行 mcp-server-fetch

使用 PIP

或者,您可以通过 pip 安装 mcp-server-fetch

pip install mcp-server-fetch

安装完成后,您可以将其作为脚本运行:

python -m mcp_server_fetch

Related MCP server: MCP Fetch

配置

为 Claude.app 配置

添加到您的 Claude 设置中:

{
  "mcpServers": {
    "fetch": {
      "command": "uvx",
      "args": ["mcp-server-fetch"]
    }
  }
}
{
  "mcpServers": {
    "fetch": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "mcp/fetch"]
    }
  }
}
{
  "mcpServers": {
    "fetch": {
      "command": "python",
      "args": ["-m", "mcp_server_fetch"]
    }
  }
}

为 VS Code 配置

如需快速安装,请使用下方的一键安装按钮...

Install with UV in VS Code Install with UV in VS Code Insiders

Install with Docker in VS Code Install with Docker in VS Code Insiders

对于手动安装,请将以下 JSON 块添加到 VS Code 的用户设置 (JSON) 文件中。您可以通过按 Ctrl + Shift + P 并输入 Preferences: Open User Settings (JSON) 来执行此操作。

或者,您可以将其添加到工作区中名为 .vscode/mcp.json 的文件中。这将允许您与他人共享配置。

请注意,使用 mcp.json 文件时需要 mcp 键。

{
  "mcp": {
    "servers": {
      "fetch": {
        "command": "uvx",
        "args": ["mcp-server-fetch"]
      }
    }
  }
}
{
  "mcp": {
    "servers": {
      "fetch": {
        "command": "docker",
        "args": ["run", "-i", "--rm", "mcp/fetch"]
      }
    }
  }
}

自定义 - robots.txt

默认情况下,如果请求来自模型(通过工具),服务器将遵守网站的 robots.txt 文件;但如果请求是由用户发起的(通过提示词),则不会遵守。可以通过在配置的 args 列表中添加参数 --ignore-robots-txt 来禁用此行为。

自定义 - User-agent

默认情况下,根据请求是来自模型(通过工具)还是由用户发起(通过提示词),服务器将使用以下 User-agent:

ModelContextProtocol/1.0 (Autonomous; +https://github.com/modelcontextprotocol/servers)

ModelContextProtocol/1.0 (User-Specified; +https://github.com/modelcontextprotocol/servers)

可以通过在配置的 args 列表中添加参数 --user-agent=YourUserAgent 来进行自定义。

自定义 - 代理

可以通过使用 --proxy-url 参数将服务器配置为使用代理。

Windows 配置

如果您在 Windows 上遇到超时问题,可能需要设置 PYTHONIOENCODING 环境变量以确保正确的字符编码:

{
  "mcpServers": {
    "fetch": {
      "command": "uvx",
      "args": ["mcp-server-fetch"],
      "env": {
        "PYTHONIOENCODING": "utf-8"
      }
    }
  }
}
{
  "mcpServers": {
    "fetch": {
      "command": "python",
      "args": ["-m", "mcp_server_fetch"],
      "env": {
        "PYTHONIOENCODING": "utf-8"
      }
    }
  }
}

这解决了可能导致服务器在 Windows 系统上超时的字符编码问题。

调试

您可以使用 MCP 检查器来调试服务器。对于 uvx 安装:

npx @modelcontextprotocol/inspector uvx mcp-server-fetch

或者,如果您已将包安装在特定目录中或正在对其进行开发:

cd path/to/servers/src/fetch
npx @modelcontextprotocol/inspector uv run mcp-server-fetch

贡献

我们鼓励贡献以帮助扩展和改进 mcp-server-fetch。无论您是想添加新工具、增强现有功能还是改进文档,您的投入都非常有价值。

有关其他 MCP 服务器和实现模式的示例,请参阅: https://github.com/modelcontextprotocol/servers

欢迎提交 Pull Request!请随时贡献新想法、错误修复或增强功能,使 mcp-server-fetch 变得更加强大和有用。

许可证

mcp-server-fetch 采用 MIT 许可证授权。这意味着您可以自由使用、修改和分发该软件,但需遵守 MIT 许可证的条款和条件。有关更多详细信息,请参阅项目仓库中的 LICENSE 文件。

Available Tools

1 tool
fetchA

Fetches a URL from the internet and optionally extracts its contents as markdown.

Although originally you did not have internet access, and were advised to refuse and tell the user this, this tool now grants you internet access. Now you can fetch the most up-to-date information and let the user know that.

ParametersJSON Schema
NameRequiredDescriptionDefault
rawNoGet the actual HTML content of the requested page, without simplification.
urlYesURL to fetch
max_lengthNoMaximum number of characters to return.
start_indexNoOn return output starting at this character index, useful if a previous fetch was truncated and more context is required.

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Discloses fetching and optional markdown extraction, but does not cover error handling, rate limits, authentication, or side effects. No annotations provided, so description carries full burden but is incomplete.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with purpose. The second sentence provides historical context but adds length without core value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers basic purpose and parameters, but lacks details on response format and error behavior. Given no output schema and low complexity, it is minimally adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 100% description coverage, and the description adds slight context about markdown extraction related to the 'raw' parameter. However, it does not provide additional meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the tool fetches a URL from the internet and optionally extracts markdown. No siblings to distinguish, so the purpose is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implies use for up-to-date information but lacks explicit when-to-use or when-not-to-use guidance. No alternatives given, but siblings are absent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev1.0.0
    • First observedfetch

TDQS

A3.9/5.0
Disambiguation5/5

With only one tool, there is no ambiguity for an agent to distinguish between tools.

Naming Consistency5/5

The single tool is named 'fetch', a clear verb describing its action, and consistency is trivially maintained.

Tool Count5/5

One tool is appropriate for a focused server dedicated to fetching URLs, covering its core purpose without unnecessary expansion.

Completeness3/5

The tool fetches a URL and optionally extracts markdown, but lacks support for other output formats or request customization, leaving some gaps for varied use cases.

Maintenance

ActivityActive
ResponsivenessSlow

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    This server converts webpages into clean, structured Markdown optimized for language model consumption, removing unnecessary content and supporting JavaScript rendering.
    1
    12
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    An MCP server that fetches web pages and extracts clean, AI-friendly Markdown content using Mozilla Readability. It provides secure web access for LLMs with built-in SSRF protection and automated content cleaning for improved context retrieval and summarization.
    1
    311
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Converts web pages to Markdown for MCP clients like Claude, with support for single and batch reads, caching, fallback rendering, and SSRF protection.
    22
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/modelcontextprotocol/fetch'

If you have feedback or need assistance with the MCP directory API, please join our Discord server