loading…
Search for a command to run...
loading…
Enables pixel-perfect image comparison and visual regression testing via tools to compare local images, screenshots, and URLs with detailed diff statistics.
Enables pixel-perfect image comparison and visual regression testing via tools to compare local images, screenshots, and URLs with detailed diff statistics.
npm version License: MIT Node.js Version
Tiếng Việt | English
A Model Context Protocol (MCP) server for pixel-perfect image comparison using Pixelmatch from Mapbox. Compare images, capture and compare screenshots, detect visual differences with precision.
# Install globally
npm install -g mcp-image-compare-server
# Install Chromium for screenshots
npx playwright install chromium
Add to your Claude Desktop config file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"image-compare": {
"command": "npx",
"args": ["-y", "mcp-image-compare-server"]
}
}
}
Restart Claude Desktop after configuration.
Add to your Cursor MCP settings file:
Windows: %APPDATA%\Cursor\User\globalStorage\mcp.json
macOS: ~/Library/Application Support/Cursor/User/globalStorage/mcp.json
Linux: ~/.config/Cursor/User/globalStorage/mcp.json
{
"mcpServers": {
"image-compare": {
"command": "npx",
"args": ["-y", "mcp-image-compare-server"]
}
}
}
Or through Cursor settings:
Ctrl+, or Cmd+,)Restart Cursor after configuration.
Ask in Claude Desktop or Cursor:
Compare image1.png and image2.png
That's it! 🎉
Compare two local image files.
Parameters:
image1_path (string, required) - Path to first imageimage2_path (string, required) - Path to second imagediff_output_path (string, optional) - Where to save diff imagethreshold (number, optional) - Comparison threshold (0-1), default 0.1includeAA (boolean, optional) - Include anti-aliased pixels, default falseExample:
{
"image1_path": "./screenshots/before.png",
"image2_path": "./screenshots/after.png",
"diff_output_path": "./diff-result.png",
"threshold": 0.1
}
Compare a local image with a screenshot from a URL.
Parameters:
image_path (string, required) - Path to local imageurl (string, required) - URL to capture and comparediff_output_path (string, optional) - Where to save diff imagethreshold (number, optional) - Comparison threshold (0-1), default 0.1includeAA (boolean, optional) - Include anti-aliased pixels, default falseExample:
{
"image_path": "./design-mockup.png",
"url": "https://example.com",
"threshold": 0.15
}
Compare screenshots from two different URLs.
Parameters:
url1 (string, required) - First URL to captureurl2 (string, required) - Second URL to capturediff_output_path (string, optional) - Where to save diff imagethreshold (number, optional) - Comparison threshold (0-1), default 0.1includeAA (boolean, optional) - Include anti-aliased pixels, default falseExample:
{
"url1": "https://staging.example.com",
"url2": "https://production.example.com"
}
All tools return JSON with detailed statistics:
{
"success": true,
"diffPixels": 1234,
"totalPixels": 921600,
"percentDiff": 0.13,
"width": 1280,
"height": 720,
"diffImagePath": "/path/to/diff.png",
"message": "Comparison completed: 1234 pixels differ (0.13%)"
}
Fields:
success - Operation status (true/false)diffPixels - Number of different pixelstotalPixels - Total pixels in imagepercentDiff - Percentage differencewidth - Image width in pixelsheight - Image height in pixelsdiffImagePath - Path to generated diff imagemessage - Human-readable result messageerror - Error message (if failed)Compare UI before and after updates to catch unintended changes.
I have two screenshots:
- before-update.png
- after-update.png
Compare them and tell me what changed.
Compare rendering across different browsers to ensure consistency.
Compare design mockups with actual implementation.
Compare design-mockup.png with https://myapp.com/landing
Compare different versions of the same page.
Compare:
- https://myapp.com/variant-a
- https://myapp.com/variant-b
Compare responsive layouts across different viewports.
The threshold parameter (0-1) controls comparison sensitivity:
When includeAA = false (default), the server automatically detects and ignores anti-aliased pixels, reducing false positives from different rendering engines.
npm install -g mcp-image-compare-server
npx playwright install chromium
Configure Claude Desktop:
{
"command": "npx",
"args": ["-y", "mcp-image-compare-server"]
}
Configure Claude Desktop:
{
"command": "npx",
"args": ["-y", "mcp-image-compare-server"]
}
First run will download the package automatically.
git clone https://github.com/leky90/mcp-image-compare-server.git
cd mcp-image-compare-server
npm install
npx playwright install chromium
npm run build
Configure Claude Desktop or Cursor:
{
"command": "node",
"args": ["/absolute/path/to/mcp-image-compare-server/dist/index.js"]
}
Replace /absolute/path/to/mcp-image-compare-server with your actual path.
npm run buildnpx playwright install chromium
For slow websites, the default 30-second timeout will handle most cases. If issues persist, please report.
For very large images:
node --max-old-space-size=4096 dist/index.jsnpm install
npm run build
npm start
# or
npm run dev
See CONTRIBUTING.md for development guidelines.
Contributions are welcome! Please read CONTRIBUTING.md for guidelines.
See CHANGELOG.md for version history.
MIT License - see LICENSE file for details.
Built with:
Made with ❤️ using TypeScript and MCP
Run in your terminal:
claude mcp add mcp-image-compare-server -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.