web-tools-mcp-server
Drop-in replacement for Claude's native web_search and web_fetch tools, resolving IP blocks and user-agent detection by using your own API keys and proxy.
README
web-tools-mcp-server
Drop-in MCP replacement for Claude's native web_search and web_fetch tools. Solves the "failed to fetch" / "failed to crawl" errors caused by IP blocks and user-agent detection on Claude's default infrastructure.
Architecture
┌──────────────────────────────────────────────────────────────────┐
│ web-tools-mcp-server │
│ │
│ web_search ──────► Brave Search API ($5/1k queries) │
│ Your own API key = your own IP = no blocks │
│ │
│ web_fetch ──────► Strategy: AUTO (default) │
│ │ │
│ ├─ 1. Direct fetch │
│ │ • Rotating real-browser User-Agents │
│ │ • Full browser headers (Sec-Ch-Ua, etc.) │
│ │ • Optional proxy (Bright Data / any) │
│ │ │
│ └─ 2. Jina Reader fallback (on 403/429/503) │
│ • Server-side JS rendering │
│ • Returns clean LLM-ready markdown │
│ • Free tier (no key needed) │
└──────────────────────────────────────────────────────────────────┘
Why this beats native tools
| Problem with native tools | How this MCP fixes it |
|---|---|
| Claude's IP is known and blocked by many sites | Your proxy IP (Bright Data residential) or at minimum your own server's IP |
| Claude's user agent is detected as a bot | Rotates through 12+ real browser UAs with matching Sec-Ch-Ua headers |
| JS-heavy sites return empty content | Jina Reader renders JS server-side, returns clean markdown |
| "Failed to fetch" with no fallback | Auto strategy tries direct → falls back to Jina automatically |
| Search results may be limited | Brave's 35B+ page index, you control the API key |
Prerequisites
- Node.js 18+
- Brave Search API key — Get one here ($5 free credit/month)
- Optional: Jina API key for higher rate limits — Get one here (free tier works without key)
- Optional: Proxy URL (Bright Data, or any HTTP/SOCKS5 proxy)
Installation
# Clone or copy this directory
cd web-tools-mcp-server
# Install dependencies
npm install
# Build
npm run build
# Verify it compiled
ls dist/index.js
Environment Variables
| Variable | Required | Description |
|---|---|---|
BRAVE_API_KEY |
Yes | Brave Search API subscription token |
PROXY_URL |
No | Proxy URL for direct fetches. Format: http://user:pass@host:port or socks5://user:pass@host:port |
JINA_API_KEY |
No | Jina Reader API key for higher rate limits. Free tier works without it. |
HTTP_PROXY |
No | Alternative to PROXY_URL (standard env var) |
HTTPS_PROXY |
No | Alternative to PROXY_URL (standard env var) |
Bright Data proxy example
export PROXY_URL="http://brd-customer-XXXXX-zone-XXXXX:PASSWORD@brd.superproxy.io:22225"
Bright Data with residential IPs (best anti-detection)
export PROXY_URL="http://brd-customer-XXXXX-zone-residential:PASSWORD@brd.superproxy.io:22225"
Setup for Claude Code
Add to your Claude Code MCP configuration (~/.claude/claude_code_config.json or per-project .claude/config.json):
{
"mcpServers": {
"web-tools": {
"command": "node",
"args": ["/absolute/path/to/web-tools-mcp-server/dist/index.js"],
"env": {
"BRAVE_API_KEY": "your-brave-api-key-here",
"PROXY_URL": "http://user:pass@proxy:port",
"JINA_API_KEY": "optional-jina-key"
}
}
}
}
Or using the CLI:
claude mcp add web-tools \
-e BRAVE_API_KEY=your-key \
-e PROXY_URL=http://user:pass@proxy:port \
-- node /absolute/path/to/web-tools-mcp-server/dist/index.js
Setup for Claude AI (Desktop App)
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"web-tools": {
"command": "node",
"args": ["/absolute/path/to/web-tools-mcp-server/dist/index.js"],
"env": {
"BRAVE_API_KEY": "your-brave-api-key-here",
"PROXY_URL": "http://user:pass@proxy:port",
"JINA_API_KEY": "optional-jina-key"
}
}
}
}
Restart the Claude desktop app after saving.
Tools
web_search
Search the web via Brave Search API.
Parameters:
query(string, required): Search query. 1-6 words recommended.count(number, optional): Results count, 1-20. Default: 10.offset(number, optional): Pagination offset. Default: 0.country(string, optional): Two-letter country code (e.g., "us").search_lang(string, optional): Language code (e.g., "en").freshness(string, optional): Time filter — "pd", "pw", "pm", "py", or "YYYY-MM-DDtoYYYY-MM-DD".
web_fetch
Fetch a URL with anti-detection capabilities.
Parameters:
url(string, required): Full URL to fetch (must include https:// or http://).strategy(string, optional): Fetch strategy. Default: "auto"."auto": Direct fetch first, Jina Reader fallback on block."direct": Direct fetch only (UA rotation + proxy)."jina": Jina Reader only (JS rendering, clean markdown output).
Fetch Strategy Decision Guide
Is the site JS-heavy or known for aggressive anti-bot?
├── Yes ──► Use strategy="jina"
└── No
├── Do you have a proxy configured?
│ ├── Yes ──► Use strategy="auto" (default) — direct with proxy, Jina fallback
│ └── No ──► Use strategy="auto" — tries without proxy, Jina catches failures
└── Is it a raw API/JSON endpoint?
└── Yes ──► Use strategy="direct" — Jina would mangle the JSON
Updating User Agents
The user agent pool in src/constants.ts should be updated periodically to match current browser versions. Check whatismybrowser.com/guides/the-latest-user-agent for current strings.
Cost Estimate
| Component | Cost | Notes |
|---|---|---|
| Brave Search API | $5/1k queries | $5 free credit/month |
| Jina Reader | Free tier | 1M tokens free, no key needed |
| Bright Data (optional) | ~$8-15/GB residential | Pay-as-you-go available |
| Typical monthly for light use | ~$0-5 | Under 1k searches + Jina free tier |
Troubleshooting
"BRAVE_API_KEY environment variable is required"
→ Set the BRAVE_API_KEY env var in your MCP config.
Direct fetch always returns 403
→ Configure PROXY_URL with a residential proxy (Bright Data), or rely on Jina fallback (strategy="auto").
Jina returns empty/garbage → Some sites block Jina too. Configure a Bright Data residential proxy and use strategy="direct".
"undici ProxyAgent could not be loaded"
→ Your Node.js version doesn't bundle undici properly. Run: npm install undici in the project directory.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。