Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
Your own AI agent, running 24/7 with QwikClaw logoYour own AI agent, running 24/7 with QwikClaw

QwikClaw sets up and runs an always-on OpenClaw agent for you. One click, no config files, no server setup.

Deploy now
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 47,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

Enables Claude Code users with third-party APIs to fetch web pages locally, extracting main content without relying on the official Anthropic API.

README.md

Claude Custom Fetch MCP

为使用第三方 API 的 Claude Code 用户提供网页抓取能力的 MCP 服务器。

解决什么问题

Claude Code 内置的 WebFetch 工具依赖 Anthropic 官方 API 的服务端能力。当你使用第三方 API 提供商(SiliconFlow、自建网关等)时,WebFetch 无法正常工作。

本 MCP 服务器在本地发起 HTTP 请求抓取网页,不依赖任何 API 提供商,只要你的电脑能上网就能工作。

功能

  • 网页抓取:抓取网页并提取正文内容(去除广告、导航等干扰元素)
  • 智能缓存:基于 SQLite 的本地缓存,避免重复请求(默认 1 小时过期)
  • API 检测:自动检测当前 Claude Code 的 API 配置
  • 网络测试:测试到各网站的连通性

限制

  • 无法抓取需要 JavaScript 渲染的页面(如 SPA 应用、聊天界面等)
  • 无法抓取需要登录的页面

安装

1. 克隆仓库并安装依赖

git clone https://github.com/lyshrines/claude-custom-fetch-mcp
cd claude-custom-fetch-mcp
pip install -r requirements.txt
pip install truststore

2. 配置 Claude Code

在你的项目根目录(或 home 目录)创建 .mcp.json

{
  "mcpServers": {
    "custom-fetch": {
      "command": "python",
      "args": ["-m", "mcp_fetch.server"],
      "env": {
        "PYTHONPATH": "/path/to/claude-custom-fetch-mcp",
        "USERPROFILE": "C:\\Users\\YourName",
        "CACHE_TTL": "3600",
        "MAX_CACHE_SIZE_MB": "100",
        "LOG_LEVEL": "INFO"
      }
    }
  }
}

Windows 用户注意env 中需要显式设置 USERPROFILE,否则日志路径解析可能失败。

3. 启用 MCP 服务器

~/.claude/settings.json 中添加:

{
  "enabledMcpjsonServers": ["custom-fetch"]
}

重启 Claude Code,在 /mcp 中应能看到 custom-fetch 已启用。

4. 推荐:在 CLAUDE.md 中添加指令

# 联网抓取
当需要抓取网页内容时,优先使用 custom-fetch MCP 的 `fetch_url` 工具,而非内置 WebFetch(内置 WebFetch 在非官方 API 下不可用)。

提供的工具

fetch_url

抓取网页并提取内容。

| 参数 | 类型 | 必填 | 默认值 | 说明 | |------|------|------|--------|------| | url | string | 是 | - | 要抓取的 URL | | use_cache | boolean | 否 | true | 是否使用缓存 | | extract_main | boolean | 否 | true | 是否只提取正文 | | timeout | number | 否 | 15 | 超时时间(秒) |

detect_api_provider

检测当前 Claude Code 的 API 配置,判断是否使用官方 API。

cache_stats

查看缓存统计信息。

clear_cache

清理缓存。older_than 参数指定清理多少秒前的条目,0 表示全部清理。

network_test

测试到指定网站的连通性。sites 参数传入 URL 列表。

依赖

  • Python 3.10+
  • mcp - MCP SDK
  • requests - HTTP 客户端
  • truststore - 使用系统 SSL 证书
  • readability-lxml - 正文提取
  • beautifulsoup4 - HTML 解析
  • lxml - XML/HTML 处理

许可证

MIT License

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Browser & Scraping servers.