Skip to main content
Glama
@trishchuk/mcp-fetch-server

@trishchuk/mcp-fetch-server

@trishchuk/mcp-fetch-server

npm version License: MIT MCP Compatible Node.js

一个高性能的模型上下文协议(MCP)服务器,为AI智能体(Claude Code、Claude Desktop、Cursor、Windsurf、Cline、Antigravity等)提供具备反机器人防护能力的fetch工具。

由@trishchuk/fetch驱动——这是一个原生curl-impersonate风格的HTTP客户端,能够精确模拟真实浏览器的TLS(JA3/JA4、ClientHello)和HTTP/2指纹。


🚀 为什么选择此服务器?

标准的Node.js/Undici HTTP客户端会立即被现代机器人防护系统(Cloudflare Turnstile / 攻击模式、DataDome、PerimeterX / HUMAN、Akamai、Kasada、AWS WAF)识别并拦截。

此外,标准MCP抓取工具在处理大型负载时经常失败,或导致LLM令牌上下文爆炸。

@trishchuk/mcp-fetch-server解决了这两个问题:

  1. 真实的浏览器模拟:复制现代浏览器(Chrome、Safari、Firefox)的精确密码套件、TLS扩展、ALPN顺序和HTTP/2设置帧。

  2. LLM上下文安全的截断:将响应体流式传输并限制在2MB(maxResponseBytes)。超大的页面会被干净地截断,并以"truncated": true标记,而不是抛出错误崩溃。

  3. 有状态会话:通过session参数,在多个智能体工具调用之间维护Cookie、登录状态和连接池。

  4. 智能编码:自动检测MIME类型,对HTML/JSON/XML返回干净的UTF-8文本,对二进制文件(图片、PDF、文档)返回Base64编码。


Related MCP server: SteadyFetch

✅ 要求

  • Node.js >= 24 — 由@trishchuk/fetch要求。

  • 预构建的原生二进制文件支持macOS(arm64、x64)、Linux(x64/arm64、glibc和musl)以及Windows(x64)。底层客户端不支持其他平台。


📦 安装与设置

选项1:使用npx运行(无需安装)

您可以直接通过npx运行服务器:

npx -y @trishchuk/mcp-fetch-server

选项2:全局或本地安装

# Global
npm install -g @trishchuk/mcp-fetch-server

# Or clone & install locally
git clone https://github.com/x51xxx/mcp-fetch-server.git
cd mcp-fetch-server
npm install

⚙️ MCP客户端配置

Claude Code

直接通过CLI添加:

# Using npx (recommended)
claude mcp add fetch -- npx -y @trishchuk/mcp-fetch-server

# Or using local path
claude mcp add fetch -- node /path/to/mcp-fetch-server/src/index.js

Claude Desktop

添加至您的claude_desktop_config.json:

  • macOS:~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows:%APPDATA%\Claude\claude_desktop_config.json

  • Linux:~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "fetch": {
      "command": "npx",
      "args": ["-y", "@trishchuk/mcp-fetch-server"]
    }
  }
}

Cursor / Windsurf / Antigravity(.mcp.json)

在工作区创建或更新.mcp.json:

{
  "mcpServers": {
    "fetch": {
      "command": "npx",
      "args": ["-y", "@trishchuk/mcp-fetch-server"]
    }
  }
}

🛠️ 工具参考:fetch

输入参数

参数

类型

默认值

说明

url

string

必需

目标绝对URL(例如https://example.com/api)。

method

string

"GET"

HTTP方法(GET、POST、PUT、DELETE、PATCH、HEAD等)。

headers

object

undefined

请求头,键值对形式({"Authorization": "Bearer ..."})。

body

string

undefined

请求体,以UTF-8字符串发送(JSON、表单编码、纯文本)。

impersonate

string

"chrome_147"

浏览器指纹预设(例如"chrome_147"、"safari_26"、"random")。

platform

string

undefined

声明的操作系统:"windows"、"macos"、"linux"、"android"或"ios"。

proxy

string

undefined

代理URL:http://、https://或socks5://(支持user:pass@host:port格式)。

session

string

undefined

会话ID,用于在多次调用之间共享客户端连接和Cookie存储。

resolve

object

undefined

自定义DNS固定(例如{"example.com": "1.2.3.4"})。用于SSRF安全测试。

redirect

string

"follow"

重定向模式:"follow"、"manual"或"error"。

httpVersion

string

undefined

强制协议版本:"http1"或"http2"。

tlsMinVersion

string

undefined

最小TLS版本:"1.0"、"1.1"、"1.2"、"1.3"。

tlsMaxVersion

string

undefined

最大TLS版本:"1.0"、"1.1"、"1.2"、"1.3"。

timeoutMs

number

undefined

请求超时时间,单位毫秒。

maxResponseBytes

number

2097152

响应体大小限制(字节,最大2MB)。超过此限制的响应会被安全截断。

encoding

string

"auto"

响应体返回格式:"auto"(文本型MIME类型返回文本,二进制类型返回base64)、"text"或"base64"。


响应模式

1. 成功的HTTP交换

任何完成的HTTP传输都会返回标准的JSON结果(包括404、500或redirect: "manual"下的3xx状态码):

{
  "status": 200,
  "statusText": "OK",
  "ok": true,
  "url": "https://example.com/data",
  "redirected": false,
  "headers": {
    "content-type": "application/json; charset=utf-8",
    "cache-control": "max-age=3600"
  },
  "bodyEncoding": "text",
  "body": "{\"message\": \"Hello world\"}",
  "truncated": false
}

2. 网络/传输故障

如果网络连接失败、超时或URL无效,工具将返回isError: true:

{
  "error": true,
  "code": "TIMEOUT",
  "message": "failed to read response body: request or response body error: operation timed out"
}

💡 智能体使用示例

1. 绕过受保护目标上的机器人检测

{
  "url": "https://protected-site.com/products",
  "impersonate": "chrome_147",
  "platform": "macos",
  "headers": {
    "Accept-Language": "en-US,en;q=0.9"
  }
}
// Step 1: Login / Obtain Session Cookie
{
  "url": "https://example.com/api/login",
  "method": "POST",
  "session": "agent-crawler-01",
  "headers": { "Content-Type": "application/json" },
  "body": "{\"user\":\"admin\",\"password\":\"secret\"}"
}

// Step 2: Access protected resource (session cookies automatically preserved)
{
  "url": "https://example.com/api/dashboard",
  "session": "agent-crawler-01"
}

3. 通过SOCKS5代理路由

{
  "url": "https://geo-restricted.example.com",
  "proxy": "socks5://user:pass@proxy.example.com:1080",
  "impersonate": "safari_26"
}

4. 获取二进制资源(图片、PDF)

{
  "url": "https://example.com/report.pdf",
  "encoding": "base64"
}

5. 用于SSRF安全抓取的DNS固定

{
  "url": "https://internal-origin.example.com/feed",
  "resolve": {
    "internal-origin.example.com": "192.0.2.42"
  },
  "redirect": "manual"
}

🔬 模拟预设与指纹

@trishchuk/mcp-fetch-server支持多种浏览器指纹:

  • Chrome:"chrome_100" … "chrome_149"(例如"chrome_147"、"chrome_131"、"chrome_116")

  • Edge:"edge_101" … "edge_148"

  • Opera:"opera_116" … "opera_131"

  • Firefox:"firefox_109"、"firefox_133"、"firefox_147"…,以及"firefox_private_136"和"firefox_android_135"

  • Safari:"safari_15.3" … "safari_26.4",以及iOS/iPad变体("safari_ios_26"、"safari_ipad_26")

  • OkHttp(Android应用):"okhttp_3.9" … "okhttp_5"

  • 动态:"random"、"weighted_random"(自动轮换指纹,按session固定)

版本号使用下划线(chrome_147,而不是chrome147)。未知名称将快速失败,并返回InvalidArg错误,列出所有可接受的变体。


🧪 开发

npm install
npm start          # run the server over stdio
npm test           # end-to-end smoke tests, no network required
npm run format     # format with Biome
npm run lint       # lint with Biome
npm run check      # format + lint check, also run before publish

测试通过stdio启动真实服务器,并使用MCP客户端针对本地HTTP服务器进行驱动,涵盖了上限截断、重定向模式、HEAD、base64响应体、超时和传输错误。


📄 许可证

MIT © Taras Trishchuk

Available Tools

1 tool
fetchFetchA

HTTP fetch backed by @trishchuk/fetch: a curl-impersonate-style client that emulates a real browser TLS/HTTP2 fingerprint (JA3/JA4, ClientHello, ALPN) so requests are not flagged by fingerprint-based bot detection (Cloudflare, DataDome, PerimeterX, etc.) the way Node's default HTTP client is. Use it for GET/POST/etc. against sites that block or challenge plain scrapers.

Inputs: url (required), body, proxy, method, +12 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 1 tool

    Disambiguation5/5

    With only a single tool, there is no possibility of confusion with other tools. The tool's purpose is clearly described and distinct by default.

    Naming Consistency3/5

    With only one tool, there is no pattern to judge. The name 'fetch' is simple and conventional, matching common HTTP client terminology, but the lack of a verb_noun convention is neutral.

    Tool Count2/5

    A single tool for an HTTP fetch server is too minimal. Most similar servers would include additional tools for managing headers, cookies, or caching, making this feel under-scoped for its stated purpose of scraping.

    Completeness2/5

    The server only provides a basic fetch tool with no support for managing sessions, handling redirects, managing cookies, or performing other common HTTP operations. This leaves significant gaps for any realistic scraping workflow.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to perform undetectable browser automation that bypasses Cloudflare, antibots, and social media blocks. Provides 105 tools for element extraction, network debugging, and real-world web scraping with a 98.7% success rate on protected sites.
      187 PyPI
      3,387
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides AI agents with reliable web fetching capabilities, handling retries, caching, and anti-bot bypass automatically.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to perform stealth browser automation and anti-detection web interaction, including session management, humanized interactions, and bypassing anti-bot/WAF protections.
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables AI agents to fetch web pages, convert them into token-efficient semantic Markdown, and extract hyperlinks and page metadata while rotating realistic browser fingerprints to reduce anti-bot blocks.
      3
      MIT