canvas-audit-mcp
v1.2.0Opinionated Canvas, WebGL & Display Quality Auditor MCP Server
Unlike general browser automation tools that merely provide mechanical "hands" (click, type, navigate), canvas-audit-mcp serves as an "opinionated eye" engineered specifically for web graphics, display fidelity, and real-world rendering audits: 1. audit_canvas_dpr Audits all elements across targeted device presets or custom DPRs: - Blurriness Detection (Under-sampled): Warns if canvas.width < clientWidth * DPR and computes the exact sharpness ratio. - Wasteful Oversampling: Warns if render targets are oversized, wasting precious GPU fillrate and VRAM.
Summary extracted from the README.
canvas-audit-mcp
Opinionated Canvas, WebGL & Display Quality Auditor for the Model Context Protocol (MCP)
Unlike general browser automation tools that merely provide mechanical "hands" (click, type, navigate), canvas-audit-mcp serves as an "opinionated eye" engineered specifically for web graphics, display fidelity, and real-world rendering audits:
- No Hardware Illusions: We don't pretend to emulate physical GPUs purely in software. Instead, we accurately audit high-DPI scaling (Device Pixel Ratio), verify layout & touch ergonomics, and validate WebGL resilience against GPU context crashes.
- Defeating the 3 Measurement Traps:
- Async Queue Deception: Standard JS loop benchmarks look fast on slow GPUs because draw commands are merely placed in an asynchronous pipeline.
- Chrome's
gl.finish()deception: In Chrome,gl.finish()does not synchronously block execution as classical OpenGL textbooks suggest. - V-Sync Hopping: Single-frame sampling causes 25x errors due to 16.6ms vs. 450ms V-Sync phase shifts. We profile frame distributions (Median, P95, and Jitter) over continuous multi-frame streams with synchronous GPU readback verification.
- Canvas & WebGL Sharpness Diagnosis: Automatically detects unscaled canvas buffers where developers forgot
canvas.width = clientWidth * window.devicePixelRatio, exposing blurry rendering on Retina, 4K, and modern mobile displays.
🛠 MCP Tools
1. audit_canvas_dpr
Audits all <canvas> elements across targeted device presets or custom DPRs:
- Blurriness Detection (Under-sampled): Warns if
canvas.width < clientWidth * DPRand computes the exact sharpness ratio. - Wasteful Oversampling: Warns if render targets are oversized, wasting precious GPU fillrate and VRAM.
- Aspect Ratio Distortion: Detects non-uniform stretching between CSS dimensions and internal drawing buffer aspect ratio.
- Context Resilience: Checks whether canvas instances have registered
webglcontextlostandwebglcontextrestoredevent handlers.
2. profile_frametime_sync
Measures true rendering performance using True Sync Profiling:
- Median Frametime (ms) & Effective FPS: Unbiased operational speed.
- P95 / P99 Frametime (ms): Quantifies the worst stutter frames.
- Jitter (ms): Measures frame-to-frame pacing variation to detect V-Sync phase hopping.
- CPU Throttling: Supports Chrome DevTools Protocol CPU throttling (1x to 6x) to inspect CPU-side marshalling bottlenecks.
3. inspect_responsive_ergonomics
Audits touch targets and layout integrity across viewport sizes:
- Touch Target Threshold: Flags buttons, links, and interactives smaller than 32px × 32px (or configurable threshold).
- Horizontal Overflow Leaks: Pinpoints the exact element causing
scrollWidth > innerWidth(rogue horizontal scrollbars). - Text Clipping: Identifies text containers with
overflow: hiddenwhere copy is silently truncated.
4. test_adaptive_recovery
- Simulates sudden GPU crashes using the
WEBGL_lose_contextextension. - Verifies that the application catches
webglcontextlostand successfully recovers rendering viawebglcontextrestoredrather than freezing permanently. - Optionally monitors adaptive degradation behavior under artificial load.
5. compare_device_matrix
- Runs a consolidated audit across 3 benchmark device tiers:
desktop_1080p(Standard Display, DPR 1x)macbook_retina(High-DPI Retina, DPR 2x)mobile_iphone(High-Density Mobile, DPR 3x)
- Returns an aggregated comparison matrix for side-by-side analysis.
🚀 Quick Start & Integration
Run via npx (No Installation Required)
Add directly to your MCP client configuration:
Google Antigravity (~/.gemini/config/mcp_config.json)
{
"mcpServers": {
"canvas-audit": {
"command": "npx",
"args": ["-y", "canvas-audit-mcp"]
}
}
}
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"canvas-audit": {
"command": "npx",
"args": ["-y", "canvas-audit-mcp"]
}
}
}
Cursor (.cursor/mcp.json)
{
"mcpServers": {
"canvas-audit": {
"command": "npx",
"args": ["-y", "canvas-audit-mcp"]
}
}
}
💻 Local Development & Testing
git clone https://github.com/tudadada/canvas-audit-mcp.git
cd canvas-audit-mcp
npm install
npx playwright install chromium
# Run internal integration tests against sample page
npm test
📄 License
MIT © tudadada