weblens-mcp
Enables AI agents to fetch and render web pages (including JavaScript-heavy SPAs) with headless Chromium, extract readable content with Mozilla Readability, capture navigation links, download images, and return a clean markdown file path.
README
WebLens MCP
Web scraping and content extraction MCP server for AI agents. Renders any URL — including JavaScript-heavy SPAs — with headless Chromium via Playwright, extracts readable content with Mozilla Readability, captures the page's navigation links, downloads images locally, and returns a clean markdown file. Works with Claude, Claude Code, Cursor, Copilot, VS Code, Codex, and any MCP-compatible client.
npx -y weblens-mcp— runs as a local stdio MCP server. Playwright downloads its own Chromium on install, so there's nothing else to set up.
Key Features
- Single tool — one
fetch_pagecall does everything: render, extract, download, return - Bundled browser — Chromium is auto-installed by Playwright; no system Chrome required
- Markdown output — returns a local
.mdfile path with images embedded as local paths - Article extraction — uses Mozilla Readability for clean content
- Navigation links — captures the site's menu/sidebar/header links (same-host, deduped)
- Asset download — page images are downloaded to a local tmp directory automatically
- Auto cleanup — downloaded files are purged after 6 hours
Requirements
- Node.js 20 or newer
That's it. On install, Playwright downloads a matching Chromium build automatically (~90 MB, cached globally and reused across projects). No system Chrome needed.
Browser
You normally don't need to do anything — Chromium is downloaded on npm install / first npx. If the automatic download was skipped (offline, firewall, or --ignore-scripts), you have two options:
# 1. Install the bundled browser manually with the Playwright CLI
npx playwright install chromium
# 2. Or point WebLens at a Chrome/Chromium you already have
CHROMIUM_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
If CHROMIUM_PATH is unset and the bundled browser is missing, WebLens also falls back to any Chrome/Chromium/Edge found in standard OS install locations.
Getting started
Standard config works in most MCP clients (no environment variables needed — Chromium is bundled):
{
"mcpServers": {
"weblens": {
"command": "npx",
"args": ["-y", "weblens-mcp"]
}
}
}
Add an
"env": { "CHROMIUM_PATH": "..." }block only to use a specific browser instead of the bundled Chromium.
<details> <summary>Claude Code</summary>
claude mcp add weblens -- npx -y weblens-mcp
Or add to your project's .mcp.json:
{
"mcpServers": {
"weblens": {
"command": "npx",
"args": ["-y", "weblens-mcp"]
}
}
}
</details>
<details> <summary>Claude Desktop</summary>
Follow the MCP install guide, use the standard config above.
</details>
<details> <summary>Codex</summary>
Create or edit ~/.codex/config.toml:
[mcp_servers.weblens]
command = "npx"
args = ["-y", "weblens-mcp"]
# Optional — only to override the bundled Chromium:
# [mcp_servers.weblens.env]
# CHROMIUM_PATH = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
</details>
<details> <summary>Cursor</summary>
Go to Cursor Settings → MCP → Add new MCP Server. Use command type with the command npx -y weblens-mcp.
</details>
<details> <summary>VS Code</summary>
code --add-mcp '{"name":"weblens","command":"npx","args":["-y","weblens-mcp"]}'
</details>
Configuration
| Environment Variable | Description | Default |
|---|---|---|
CHROMIUM_PATH |
Override the browser. By default WebLens uses Playwright's bundled Chromium; set this to use a specific Chrome/Chromium/Edge executable. | Bundled Chromium |
INSECURE_TLS |
Set to 1 to accept self-signed certificates. |
0 (disabled) |
Browser resolution order: CHROMIUM_PATH (if set) → Playwright's bundled Chromium → a system Chrome/Chromium/Edge found in standard OS install locations (/Applications/... on macOS, C:\Program Files\... on Windows, /usr/bin/... on Linux).
Tool
fetch_page
Fetch and render a web page. Returns the absolute path to a local markdown file containing the page content with downloaded images embedded as local file paths.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
url |
string | yes | Target page URL |
Returns: Absolute path to a .md file in the system temp directory.
Example response:
/var/folders/lp/.../T/weblens-mcp/327c3fda87ce286848a574982ddd0b7c7487f816.md
Generated markdown format:
# Page Title
Source: https://example.com/article
> Article excerpt or description
Article body text content...
## Navigation
- [Docs](https://example.com/docs)
- [Pricing](https://example.com/pricing)
- [Blog](https://example.com/blog)
## Images


Behavior:
- Renders the page with Playwright (headless Chromium)
- Blocks media and font requests for faster loading
- Extracts article content using Mozilla Readability when possible
- Captures navigation links from
nav/header/aside/menu regions (same-host, deduped, up to 50) - Downloads page images (skips icons smaller than 50x50px)
- Writes markdown with local image paths to the system temp dir (
<os-tmp>/weblens-mcp/) - Files older than 6 hours are automatically cleaned up
Local development
npm install
npm run build
node dist/index.js
How it works
URL
└→ Playwright renders page (headless Chromium)
└→ Extract title, text, HTML, images, navigation links from DOM
└→ Mozilla Readability extracts clean article content
└→ Download images to <os-tmp>/weblens-mcp/
└→ Compose markdown with local image paths
└→ Write .md file, return path
Tmp directory
Downloaded assets and markdown files are stored in your system temp directory under weblens-mcp/ (e.g. /tmp/weblens-mcp/ on Linux, /var/folders/.../T/weblens-mcp/ on macOS). Cleanup runs automatically:
- On every
fetch_pagecall (throttled to every 5 minutes) - Files older than 6 hours (by mtime) are deleted
- No external cron or scheduler needed
Docker
{
"mcpServers": {
"weblens": {
"command": "docker",
"args": [
"run", "-i", "--rm", "--init",
"-v", "/tmp/weblens-mcp:/tmp/weblens-mcp",
"weblens-mcp"
]
}
}
}
License
ISC
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。