Skip to main content
Glama

VisualWebScraper

基于 MCP(Model Context Protocol) 的网页抓取服务,使用 Playwright 无头 Chromium 渲染动态网页, 并可调用本地 LM Studio 大模型生成文章简报。

安装

pip install -r requirements.txt
playwright install chromium

Related MCP server: MCP Playwright Server

启动

python screenshot_scraper_mcp.py
# 或
python -m webscraper.server

本地可视化操作台(Web UI)

除 MCP stdio 外,另提供基于标准库 http.server 的网页界面,无需额外依赖, 复用同一套工具层与浏览器池,供非开发者在浏览器中可视化操作。

python run_webui.py                 # 默认 http://127.0.0.1:8765
python run_webui.py --port 9000     # 自定义端口

打开页面后,可在「网页截图 / 文章检索 / 简报生成」三个标签页填写参数并运行; 截图工具会直接渲染返回的长图,检索与简报以文本形式展示(简报生成依赖 LM Studio)。

该 Web UI 与 MCP stdio 入口相互独立,互不影响;退出时浏览器实例同样会被释放。

MCP 客户端配置

{
  "mcpServers": {
    "VisualWebScraper": {
      "command": "python",
      "args": ["d:/BaiduSyncdisk/desktop/WebSearchMCP/screenshot_scraper_mcp.py"],
      "env": {
        "LMSTUDIO_BASE_URL": "http://localhost:1234/v1"
      }
    }
  }
}

提供的工具

fetch_webpage_with_screenshot

抓取网页纯文本 + 整页长截图(PNG base64),供多模态模型做视觉分析。

参数

类型

必填

说明

url

string

目标网页链接

search_webpage_articles

从栏目/列表页提取文章条目,按标题关键词筛选,按日期倒序输出。

参数

类型

必填

说明

url

string

栏目/列表页链接

keyword

string

标题筛选关键词

count

integer

输出条数,<=0 表示全部

generate_webpage_brief

提取文章 → 抓取详情页正文 → 调用本地大模型逐篇生成摘要 → 输出简报。

参数

类型

必填

说明

url

string

栏目/列表页链接

count

integer

生成条数

keyword

string

标题筛选关键词,留空为全部

summary_len

integer

每条摘要目标字数,默认 60

model

string

LM Studio 模型名,缺省用当前加载的模型

三级降级链(保证任何环境下都有输出):

层级

触发条件

行为

L1

首次摘要为空

换更直接的指令重试

L2

仍为空

取正文首段作为摘要

L3

全部条目模型调用均失败

判定 LM Studio 不可用,落盘 Markdown 到 briefs/

项目结构

webscraper/
├── config.py          # 集中配置:超时、限额、环境变量
├── browser.py         # Playwright 浏览器池(复用实例)
├── extractors.py      # 文章提取、正文抓取、文本清洗
├── llm.py             # LM Studio 调用(OpenAI 兼容接口)
├── reporter.py        # 简报 Markdown 落盘与文本渲染
├── server.py          # MCP 入口:handler 注册与生命周期
└── tools/
    ├── base.py        # 工具注册表、参数校验、结果构造
    ├── screenshot.py  # fetch_webpage_with_screenshot
    ├── search.py      # search_webpage_articles
    └── brief.py       # generate_webpage_brief

站点适配

文章链接识别规则集中在 extractors.py 顶部,换站点时只需调整:

ARTICLE_PATH_MARK = "/article/"                      # 文章链接特征
ARTICLE_DATE_RE = re.compile(r"/article/(\d{4})/(\d{1,2})/")  # URL 日期格式

环境变量

变量

默认值

说明

LMSTUDIO_BASE_URL

http://localhost:1234/v1

LM Studio OpenAI 兼容接口地址

F
license - not found
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Screenshot and HTML render MCP server for AI agents

  • MCP server exposing the Backtest360 engine API as tools for AI agents.

  • Firecrawl MCP — wraps the Firecrawl API (firecrawl.dev) for web

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/czhh006564/WebSearchContentToMD_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server