WebFetch MCP Server
Fetches webpages with JavaScript rendering, converts HTML to clean Markdown for LLM analysis, and uses stealth plugins to avoid bot detection.
README
WebFetch MCP Server
An MCP (Model Context Protocol) server that fetches webpages by URL, renders JavaScript using Puppeteer with stealth plugins to avoid bot detection, converts the HTML content to clean Markdown, and returns it for LLM analysis.
Features
- JavaScript Rendering: Uses Puppeteer with stealth plugin to render dynamic content
- Bot Evasion: Stealth plugins prevent detection as a bot
- Markdown Conversion: Converts HTML to clean, readable Markdown using Turndown
- Content Filtering: Removes ads, scripts, styles, and other non-essential elements
- Link Preservation: Maintains links with their URLs for context
- Image References: Preserves image alt text and sources as markdown references
Quick Start
Using Docker with Streamable Transport
Build the image (no server needed to be running):
make build
# or: docker build -t webfetch-mcp-server .
Configure your MCP client to use streamable transport with Docker. The container will be started on-demand by the MCP client.
Using Make
A Makefile is included for easy management:
make build # Build the Docker image
make clean # Remove container and image
make logs # Follow container logs (if running)
make debug # Run in foreground to see output
Running from GitHub (npx)
Run directly from your GitHub repository without cloning:
npx git+https://github.com/Sh1d0w/webfetch-mcp.git -- -i
Or with the package name:
npx webfetch-mcp-server@latest -- -i
Running Locally
Install dependencies:
npm install
Run in development mode:
npm run dev
Or build and run:
npm run build
npm start
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD |
Skip Chromium download (use system) | true |
PUPPETEER_EXECUTABLE_PATH |
Path to Chromium executable | /usr/bin/chromium-browser |
MCP Client Configuration
Docker Streamable Transport
Configure your MCP client to use streamable transport. The container starts on-demand when the MCP client connects.
Docker run command (for reference):
docker run --rm -i webfetch-mcp-server node dist/index.js
Cursor
Add to your .cursorrules or Cursor MCP settings:
{
"mcpServers": {
"webfetch": {
"command": "docker",
"args": ["run", "--rm", "-i", "webfetch-mcp-server", "node", "dist/index.js"]
}
}
}
Claude Desktop (macOS)
Edit ~/Library/Application Support/Claude/claude_config.json:
{
"mcpServers": {
"webfetch": {
"command": "docker",
"args": ["run", "--rm", "-i", "webfetch-mcp-server", "node", "dist/index.js"]
}
}
}
Claude Desktop (Linux)
Edit ~/.config/claude/claude_config.json:
{
"mcpServers": {
"webfetch": {
"command": "docker",
"args": ["run", "--rm", "-i", "webfetch-mcp-server", "node", "dist/index.js"]
}
}
}
LM Studio
In LM Studio MCP settings:
- Name: webfetch
- Type: stdio (streamable transport)
- Command:
docker - Arguments:
run --rm -i webfetch-mcp-server node dist/index.js
Why this works:
--rm: Automatically removes container after exit (clean state each time)-i: Keeps stdin open for MCP communication- Container starts on-demand when LM Studio connects
opencode
Add to your opencode configuration:
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
// In your config file
{
mcpServers: {
webfetch: {
command: 'docker',
args: ['run', '--rm', '-i', 'webfetch-mcp-server', 'node', 'dist/index.js']
}
}
}
Why Xvfb is Required
Even in "headless" mode, Chromium/Puppeteer requires an X server for rendering. The Dockerfile includes:
- Xvfb (X Virtual Framebuffer): Provides a virtual display
- DISPLAY=:99: Tells Chromium to use the virtual display
- Startup script: Starts Xvfb before running Node.js
Without Xvfb, Puppeteer will crash immediately after starting, causing the container to restart in a loop.
Available Tools
fetch_url
Fetches a webpage and converts it to Markdown.
Parameters:
url(string, required): The URL of the webpage to fetch
Returns:
- Clean Markdown content with title and URL header
- Error message if fetching fails
Example Usage:
User: Please analyze this article about MCP protocol
Assistant: [calls tool] fetch_url with url="https://modelcontextprotocol.io"
Output Format
The server returns content in the following format:
# Page Title
https://example.com
---
[Clean markdown content here...]
Content Processing
- Removes
<script>,<style>,nav,footer,header,asideelements - Strips advertisement containers (
.ad,.advertisement,#ads) - Removes cookie consent banners
- Converts links to include their URLs in parentheses
- Preserves images as markdown references with alt text
- Maintains code blocks formatting
- Normalizes whitespace and removes excessive line breaks
Building for Production
Build with Make (recommended):
make build
Or directly with Docker:
docker build -t webfetch-mcp-server .
Configure your MCP client to use the built image with streamable transport. No persistent server needed.
Troubleshooting
Container keeps restarting / "Container is not running"
Cause: Puppeteer needs a virtual display (Xvfb) even in headless mode. Chromium's headless mode still requires an X server for rendering.
Solution: The Dockerfile includes Xvfb automatically. If you're using a custom setup, ensure:
- Install Xvfb:
apk add xvfb(Alpine) orapt-get install xvfb(Debian/Ubuntu) - Start Xvfb before running Chromium:
Xvfb :99 -screen 0 1024x768x24 & - Set DISPLAY env var:
export DISPLAY=:99
"Connection closed" / MCP error -32000
Cause: Container crashed when the MCP client tried to connect.
Solution: Ensure you're using docker run --rm in your MCP configuration. This starts a fresh container for each connection, avoiding issues with stale containers.
Check container logs
make logs
# or: docker logs -f webfetch-mcp-server
Connection Timeout
The default timeout is 30 seconds. For slower websites, you may need to increase this in the source code.
Stealth Detection Bypassed
Some websites have advanced bot detection. The stealth plugin helps but cannot guarantee bypass for all sites.
Development
Run tests:
npm test
Lint and type-check:
npm run lint
npm run typecheck
License
MIT License - See LICENSE file for details.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。