MCP Web Fetch Server

MCP Web Fetch Server

A Python MCP server for web research that enables fetching web pages, searching, batch-fetching, extracting links, and summarizing content via client-side sampling, with optional local file access.

Category
访问服务器

README

MCP Web Fetch Server

An all-in-one Python MCP server for web research: fetch pages, search the web, batch-fetch, extract links, summarize via client-side sampling, and (optionally) read/write local files — all for LLM agents like Cursor. Supports local stdio and Streamable HTTP for remote access, and exercises essentially every MCP protocol capability (Tools, Resources, Prompts, Completions, Sampling, Elicitation, Roots, Progress, Logging).

Documentation:

Document What's inside
User Manual Full end-user guide: install (Docker/Linux/Windows), Cursor setup, all tools, admin GUI, config, troubleshooting
Project Documentation Full technical reference: architecture, modules, MCP APIs, admin API, security, Docker stack, testing

Features

Tools

  • fetch_url — page content as markdown, with chunked reading (start_index, max_length)
  • fetch_metadata_tool — HEAD request metadata
  • batch_fetch — fetch multiple URLs concurrently, with per-URL error isolation and progress
  • web_search — DuckDuckGo web search (no API key), with automatic fallback to a local SearXNG instance if DuckDuckGo's scrape fails
  • extract_links — structured link/image extraction from a page
  • summarize_url — asks the connected client's LLM to summarize a page (MCP sampling)
  • read_file / write_file / list_dir — sandboxed local file access (opt-in, disabled by default)

Other MCP capabilities

  • Resources: config://settings, history://recent, fetch-cache://{encoded_url}
  • Prompts: fetch, research_topic, summarize_page, extract_key_facts, compare_sources
  • Completions: URL/depth autocomplete for prompt and resource arguments
  • Elicitation: write_file confirms before overwriting an existing file
  • Roots: local file tools honor client-exposed directories in addition to FETCH_LOCAL_FILES_ROOT
  • Progress notifications: batch_fetch and summarize_url report progress as they run
  • Management GUI: web dashboard at /admin for status, config, history, cache, and tools

Security

  • SSRF protection with resolve-then-check and redirect re-validation
  • robots.txt compliance (override with ignore_robots_txt=true)
  • Optional domain allowlist
  • Local file tools sandboxed to one configured directory, path-traversal safe
  • Bearer token auth + rate limiting for HTTP mode
  • /health endpoint
  • Windows .exe build (no Python required for end users)

Quick Start

Option A: Docker — full stack (recommended for server deployment)

Runs the MCP server, admin GUI, and SearXNG together.

Linux / macOS:

cd mcp-fetch-server
cp .env.docker.example .env          # edit MCP_AUTH_TOKEN
chmod +x scripts/docker-up.sh
./scripts/docker-up.sh
# or: docker compose up -d --build

Windows (PowerShell):

cd "E:\my python projects\MCP\mcp-fetch-server"
copy .env.docker.example .env
.\scripts\docker-up.ps1
Service URL
MCP protocol http://127.0.0.1:8000/mcp
Admin GUI http://127.0.0.1:8000/admin
Health http://127.0.0.1:8000/health
SearXNG (search fallback) http://127.0.0.1:8080

Connect Cursor over HTTP (Bearer token required):

{
  "mcpServers": {
    "web-fetch": {
      "url": "http://127.0.0.1:8000/mcp",
      "headers": { "Authorization": "Bearer your-token-from-env" }
    }
  }
}

Local files for read_file/write_file map to the ./workspace folder on your host.

Option B: Windows executable (local / Cursor stdio)

cd "E:\my python projects\MCP\mcp-fetch-server"
.\dist\mcp-fetch-server.exe --transport stdio

Build the exe yourself: .\scripts\build_exe.ps1 → outputs dist\mcp-fetch-server.exe

Option C: Python + uv (development)

cd "E:\my python projects\MCP\mcp-fetch-server"
uv sync --dev
copy .env.example .env
uv run mcp-fetch-server --transport stdio

Connect to Cursor

See the User Manual — Connect to Cursor for step-by-step instructions.

Minimal .cursor/mcp.json using the executable:

{
  "mcpServers": {
    "web-fetch": {
      "command": "E:/my python projects/MCP/mcp-fetch-server/dist/mcp-fetch-server.exe",
      "args": ["--transport", "stdio"],
      "env": { "PYTHONIOENCODING": "utf-8" }
    }
  }
}

Management GUI

A built-in web dashboard lets you monitor and manage the server without using Cursor:

Mode URL
stdio (Cursor default) http://127.0.0.1:8001/admin
streamable-http http://127.0.0.1:8000/admin (same port as MCP)

The dashboard shows uptime, registered tools, redacted configuration, recent fetch history, cached page previews, and a button to clear history/cache. It auto-refreshes every 30 seconds.

If MCP_AUTH_TOKEN is set, enter it in the dashboard's auth bar (stored in your browser session only). Disable the GUI with FETCH_ADMIN_ENABLED=false.

Optional: SearXNG search fallback

web_search uses DuckDuckGo by default and falls back to SearXNG when that scrape fails. When you use Docker (docker compose up), SearXNG is started automatically and the MCP container is preconfigured to reach it at http://searxng:8080.

For local (non-Docker) use, you can still run only SearXNG:

docker compose up -d searxng

Set FETCH_SEARXNG_URL=http://localhost:8080 in .env. See searxng/settings.yml.

Remote HTTP Mode (without full Docker stack)

$env:MCP_AUTH_TOKEN = "your-long-random-token"
.\dist\mcp-fetch-server.exe --transport streamable-http --host 127.0.0.1 --port 8000
  • MCP endpoint: http://127.0.0.1:8000/mcp
  • Health check: http://127.0.0.1:8000/health

Project Structure

mcp-fetch-server/
├── dist/mcp-fetch-server.exe   # Windows executable
├── src/mcp_fetch_server/       # Source code (tools, resources, prompts, security, ...)
├── tests/                      # 84 pytest tests
├── docs/                       # User manual + technical docs
├── scripts/docker-up.sh        # Linux/macOS stack startup
├── scripts/docker-up.ps1       # Windows stack startup
├── docker-compose.yml          # Full stack: MCP server + SearXNG
├── .env.docker.example         # Environment template for Docker Compose
├── Dockerfile                  # MCP server image
├── workspace/                  # Host folder mounted for local file tools (Docker)
├── searxng/settings.yml        # SearXNG config (JSON API enabled)
├── src/mcp_fetch_server/admin.py  # Management web GUI
└── .cursor/mcp.json            # Cursor config

Development

uv run pytest
uv run ruff check .
./scripts/docker-up.sh          # Linux / macOS
docker compose down

Windows only:

.\scripts\build_exe.ps1
.\scripts\docker-up.ps1

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选