web-perception-mcp
A DOM-first, vision-second MCP server for webpage analysis, combining structural DOM extraction with MiniMax vision to provide accurate, context-rich page understanding for AI coding assistants.
README
web-perception MCP Server
A Model Context Protocol (MCP) server for DOM-first, vision-second webpage analysis. Built for AI coding assistants like Cline.
What it does
This server gives AI agents the ability to understand webpages by combining structural DOM data with visual analysis via MiniMax vision. Instead of sending a raw screenshot to the vision model, it extracts the page's heading hierarchy, interactive elements, landmarks, and layout first — then sends both the screenshot and the structural context to MiniMax for significantly better analysis.
Tools
| Tool | Description | Cost |
|---|---|---|
inspect_page |
Extract page structure, metadata, and content. Basic mode (HTTP fetch) or full mode (headless browser). | Free — no vision API call |
analyze_image |
Analyse local image files (screenshots, mockups, designs) using MiniMax vision. | Vision API call |
analyze_page_visual |
End-to-end: browser → DOM extraction → screenshot → enriched prompt → MiniMax vision → structured findings with element refs. | Vision API call |
extract_page_data |
Extract structured data from a page matching a provided schema. Progressive escalation: DOM → browser → vision. | Vision API call only if DOM insufficient |
Prerequisites
- Node.js 18+
- A nanoGPT account with an API key
- An MCP-compatible client like Cline, Cursor, or Claude Desktop
Installation
git clone https://github.com/JaviGala/web-perception-mcp.git
cd web-perception-mcp
npm install
cp .env.example .env # add your NANOGPT_API_KEY
Configuration
Set via .env file or environment variables:
| Variable | Default | Description |
|---|---|---|
NANOGPT_API_KEY |
(required) | Your nanoGPT API key |
NANOGPT_BASE_URL |
https://nano-gpt.com/api/subscription/v1 |
API endpoint. Use /api/v1 for pay-as-you-go. |
NANOGPT_MODEL |
minimax/minimax-m3 |
Vision model to use |
NANOGPT_TEMPERATURE |
0.3 |
Default temperature |
NANOGPT_MAX_TOKENS |
2000 |
Default max tokens |
REQUEST_TIMEOUT_MS |
30000 |
HTTP request timeout |
MAX_TEXT_LENGTH |
50000 |
Max characters in extracted text |
MCP Client Configuration
Cline (VS Code)
{
"mcpServers": {
"web-perception": {
"type": "stdio",
"command": "/usr/local/bin/node",
"timeout": 120,
"args": ["/path/to/web-perception-mcp/src/server.js"],
"env": {
"NANOGPT_API_KEY": "sk-your-key-here"
}
}
}
}
How analyze_page_visual works
This is the core differentiator — the "clever" analysis workflow:
- Launch headless browser (Playwright + Chromium, no visible window)
- Navigate to the target URL and wait for the page to load
- Extract DOM structure — heading hierarchy, interactive elements with bounding boxes, landmarks, visible text
- Take a screenshot (viewport or full page)
- Build enriched prompt — combines DOM structure with the user's question into a structured prompt
- Send to MiniMax — the vision model receives both the screenshot image AND the structural context
- Parse response — extracts structured JSON findings with element refs, severity, confidence scores
This produces significantly better analysis than a raw screenshot alone because MiniMax can correlate visual elements with their DOM positions, roles, and content.
Architecture
src/
server.js — MCP server, tool definitions, request routing
vision.js — MiniMax API client, prompt builder, result parser
browser.js — Playwright browser pool management
extraction.js — DOM extraction (static + browser-rendered)
security.js — URL validation, logging, timeout utilities
Evolution
This project was built as a replacement for nanogpt-vision-mcp, which only supported raw image analysis without DOM context. The MiniMax client code was carried forward with no functional changes. See the nanogpt-vision-mcp README for the full migration story.
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 模型以安全和受控的方式获取实时的网络信息。