visual-regression-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@visual-regression-mcpCompare the current dashboard against its baseline for visual regressions"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Visual Regression MCP
AI 辅助的视觉回归测试 MCP Server。像素对比找出差异,AI 判断这个差异是真 bug 还是可接受的变化。
为什么做这个
视觉回归测试不是新技术,但传统方案有个致命问题:误报太多。
字体渲染差异、动画时序、随机数据、时间戳——这些都会导致像素差异,但都不是 bug。团队引入视觉回归测试后,往往因为每次 CI 都红、但 90% 是误报,最后干脆关掉。
这个项目的思路是:像素对比只负责"找出哪里不一样",判断"这是不是 bug"交给 AI。
工具返回的不只是差异百分比,而是差异图 + 当前截图 + 区域定位。AI 看到图之后可以判断:
差异集中在按钮区域,颜色从绿变红 → 可能是真 bug
差异散布全页、每处都是 1-2 像素 → 字体抗锯齿,可忽略
差异在时间戳区域 → 动态内容,应该 mask 掉
Related MCP server: UI Screenshot Comparison MCP
工具
工具 | 说明 |
| 截图并保存为基线。支持全页/元素截图、自定义视口、遮盖动态区域 |
| 对当前页面截图并与基线做像素对比,返回统计数据 + 差异图 + 当前截图 |
| 列出所有已保存的基线及其截图参数 |
| 删除过期基线(页面有意改版后) |
降低误报的几个设计
这是项目的核心,不是简单调 pixelmatch 就完事:
冻结动画 — 注入 CSS 把所有
animation-duration和transition-duration归零,同时隐藏光标。CSS 动画是误报的头号来源。遮盖动态区域 —
maskSelectors参数可以把时间戳、广告位、随机内容用纯色盖住,让这些区域的像素稳定。参数持久化 — 基线保存时把视口尺寸、选择器、等待时间一起存下来,对比时用完全相同的参数重截。参数不一致的对比是无意义的。
等待网络空闲 —
waitUntil: "networkidle"加可配置的额外等待,避免图片没加载完就截图。区域定位 — 把画面切成 3×3 网格统计差异分布。"差异集中在顶部导航"和"差异散布全页"含义完全不同,前者可能是布局 bug,后者多半是渲染差异。
尺寸不匹配单独处理 — 页面高度变了说明内容增删,
pixelmatch无法对比,此时直接报告尺寸变化而不是崩溃。
安装
git clone <repo-url>/visual-regression-mcp.git
cd visual-regression-mcp
npm install
npx playwright install chromium
npm run build配置
在 Claude Code 的 MCP 配置中添加:
{
"mcpServers": {
"visual-regression": {
"command": "node",
"args": ["/path/to/visual-regression-mcp/build/index.js"],
"env": {
"VISUAL_BASELINE_DIR": "/path/to/your/baselines"
}
}
}
}VISUAL_BASELINE_DIR 可选,默认存在 ~/.visual-regression-mcp/baselines/。
使用
配置后重启 Claude Code,直接用自然语言:
帮我给 http://localhost:3000/dashboard 建一个视觉基线,命名 dashboard
(改了代码之后)
对比一下 dashboard 有没有视觉回归
把时间戳区域 .timestamp 遮盖掉再建基线AI 会调用工具、看差异图、然后告诉你这个差异是不是问题。
输出示例
{
"status": "differences_found",
"name": "dashboard",
"diffPixels": 5107,
"totalPixels": 480000,
"diffPercent": 1.064,
"diffRegions": [
{ "region": "middle-left", "diffPixels": 5107, "percentOfRegion": 9.58 }
],
"note": "Pixel diff found. Inspect the diff image below..."
}外加两张图:差异图(品红高亮变化像素)和当前截图,供 AI 视觉判断。
技术栈
@modelcontextprotocol/sdk— MCP 协议playwright— 无头浏览器截图pixelmatch+pngjs— 像素级图像对比TypeScript + ESM
License
MIT
Maintenance
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
- Alicense-qualityCmaintenanceEnables automated end-to-end testing powered by Playwright where test cases are defined in natural language and executed by AI. Uses lightweight snapshot analysis with vision mode fallback for sophisticated testing scenarios.Last updated3Apache 2.0
- Flicense-qualityDmaintenanceEnables automated visual testing by comparing screenshots against baseline images using OpenAI to verify UI consistency. It generates detailed performance reports in both terminal and Excel formats based on provided user stories and acceptance criteria.Last updated33
- Flicense-qualityDmaintenanceEnables AI agents to automate and debug real Chromium browsers with capabilities like screenshots, video recording, performance analysis, visual regression testing, and OCR text extraction.Last updated13
- Alicense-qualityDmaintenanceEnables AI agents to see, analyze, and visually verify web page changes through pixel-perfect diffing, theme extraction, layout analysis, and interactive element detection.Last updated3MIT
Related MCP Connectors
Capture screenshots, detect visual regressions between page versions, and analyze with AI.
AI QA tester — real browsers scan sites for bugs, SEO, perf, and accessibility issues via chat.
Screenshot, diff, audit and sitemap-capture any web page — 5 MCP tools for AI agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/noGarne/visual-regression-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server