Local-first visual regression for AI agents: verdicts, diff images, explain_snapshot. No API key.
ai.testiv/mcp MCP Server
The ai.testiv/mcp Model Context Protocol (MCP) server provides local-first visual regression support for AI agents. It focuses on producing verdicts, generating diff images, and offering an explain_snapshot capability. The server is described as requiring no API key.
๐ ๏ธ Key Features
Local-first visual regression for AI agents
Verdicts output
Diff images generation
explain_snapshot capability
No API key required
๐ Use Cases
Visual regression testing workflows for AI agents
Verifying changes via verdicts and diff images
Explaining snapshot results with explain_snapshot
โก Developer Benefits
Works without an API key
Integrates visual regression artifacts: verdicts, diffs, and snapshot explanations
โ ๏ธ Limitations
Details beyond verdicts, diff images, and explain_snapshot are not provided in the available server data
Local-first visual regression testing SDKs for modern web applications.
This is the home of TestivAI. It contains everything you need to capture, diff, and report visual regressions fully locally โ MIT-licensed, no account, no server.
๐ See a live report โ โ a real TestivAI OSS report rendered in your browser, straight from CI. No install, no signup.
Pixel-only visual testing drowns you in false positives โ a font re-hint or an anti-aliasing shift across machines lights up as a "change," and you spend your time re-approving noise.
TestivAI pairs every screenshot with a snapshot of the page DOM. When pixels differ but the DOM is structurally identical, the report flags the diff as likely render noise instead of crying wolf. When the DOM actually changed, you see exactly what (2 added, 1 removed). That single signal is the difference between a flaky test wall and a report you trust.
๐ Fully local, no account โ captures, diffs, and a self-contained HTML report all stay on your machine.
๐ง DOM + style-aware noise hint โ separates real changes from render jitter, and catches the stylesheet-only case: identical DOM with changed computed styles reads as "Styles changed on button.cta", never as noise.
๐ญ Auditable masks & region-level diffs โ exclude dynamic areas (selectors or coordinates) with the masked region hatched in the diff, and get "3 changed regions" with bounding boxes instead of a raw pixel percentage.
๐ Element attribution & exact shift detection โ the report names which element changed ("div.card:nth-of-type(2) shifted +8px vertically โ content unchanged") and spots the injected-banner case ("everything below y=80 moved +24px"), derived from layout, not pixel guesswork. No local-first tool does this.
๐ First-class adapters โ Playwright (TS/JS and Python, Java experimental) and WebdriverIO, using each framework's native APIs; every language shares one set of baselines and one report.
๐ค PR-native workflow โ a GitHub Action posts the diff and approves baselines from a /testivai approve comment.
๐ No lock-in โ MIT license, baselines live in your git, and results.json is a semver-governed public contract.
Eyes for your coding agent
If an AI agent (Claude Code, Cursor, Copilot, โฆ) writes your UI code, someone still has to check what the UI looks like โ and it shouldn't be you, one screenshot at a time. TestivAI is built to be that check:
No account, no API key, no network โ an agent can run it inside any sandbox without you provisioning secrets.
Machine-readable output โ every run writes visual-report/results.json (a semver-governed schema) with per-snapshot diff percentages and DOM change summaries, so an agent can read the result and self-correct.
Noise-aware verdicts โ the DOM hint tells the agent whether a pixel diff is likely render noise or a real structural change (2 added, 1 removed), so it doesn't chase anti-aliasing ghosts.
Explanations, bring-your-own-model โ the MCP explain_snapshot tool hands your agent layered evidence (which selectors shifted vs changed, whole-page shift detection, style-only changes) and your model writes the narrative: "card #2 shifted +24px โ likely the banner injected above it." No hosted AI service in the loop.
Human approval stays in the PR โ the agent iterates locally; you approve baselines with one /testivai approve comment.
Paste this into your project's AGENTS.md / CLAUDE.md to wire it up (full guide with MCP setup, a real agent transcript, and the approval rule: docs/guides/ai-agents.md):
markdown
## Visual verification
After changing any UI code, run `npx playwright test` (TestivAI captures
screenshots automatically), then read `visual-report/results.json`.
-`status: "changed"` with `dom.changed: true` โ describe the DOM summary and
ask whether the change is intended before approving.
-`status: "changed"` with `dom.noiseHint: true` โ likely render noise; mention
it but don't block.
- Never run `testivai approve` yourself โ baseline approval is a human decision.
Packages
Live versions are shown by the badges at the top of this README.
AI-built and vibe-coded apps (Lovable, Bolt, v0, ...) usually ship with zero
tests. You still get the full safety net:
bash
npx testivai witness http://localhost:3000
TestivAI launches a headless Chrome, discovers your pages (or takes
--pages "/,/pricing"), and captures each one โ baselines, diffs, noise
hints, HTML report, and PR approvals all work exactly as below, no test
framework required. See the vibe-coded apps guide.
// 2. (OPTIONAL) Customize tolerances and report settings.// Local mode is the default when no TESTIVAI_API_KEY is set โ no config needed.// Only create this file if you want to tune threshold, reportDir, etc.// File: .testivai/config.json{"mode":"local","threshold":0.1,// per-pixel color sensitivity (0-1)"maxDiffPercent":0,// pass diffs at or below this % (your tolerance dial)"noiseAutoPass":false,// true: DOM-identical diffs within noiseMaxDiffPercent pass"stabilize":true,// freeze animations, hide caret, wait for fonts"ignoreSelectors":[],// e.g. [".live-chat", "[data-testid=clock]"]"reportDir":"visual-report","autoOpen":false}
First run: baselines are written to .testivai/baselines/.
Later runs: screenshots are diffed and a self-contained HTML report is written to ./visual-report/.
What you get out of the box (free, no account)
โ Full-page screenshot capture via Playwright
โ Stabilized captures by default โ animations/transitions frozen, caret hidden, web fonts awaited (the top causes of flaky visual tests, neutralized before every screenshot)
โ Local pixel diff with configurable threshold
โ Tunable pass criteria โ maxDiffPercent / maxDiffPixels tolerances, plus opt-in noiseAutoPass so DOM-identical render noise stops demanding review
โ ignoreSelectors for dynamic content (both adapters, global or per-snapshot)
โ Self-contained HTML report (visual-report/index.html)
โ Committed baselines under .testivai/baselines/ (just git add them)
CI Integration (GitHub Actions)
Copy this single workflow file into your repository. It handles both running the visual regression tests and processing /testivai approve commands from PR comments โ no extra secrets, no external services required.
yaml
# .github/workflows/testivai-oss.ymlname:TestivAIOSSon:pull_request:branches: [main]
issue_comment:types: [created] # listens for /testivai approve commandspermissions:contents:write# approve action commits updated baselines to the branchpull-requests:write# post PR diff commentstatuses:write# set pass/fail indicator on the PRjobs:# Runs on every PR โ captures screenshots, diffs against baselines, posts reportvisual-regression:name:VisualRegression(OSS)if:github.event_name=='pull_request'runs-on:ubuntu-latesttimeout-minutes:15steps:-uses:actions/checkout@v4-uses:actions/setup-node@v4with: { node-version:'20', cache:'npm' }
-run:npmci-run:npxplaywrightinstallchromium--with-deps-run:npmrunbuild-run:npmruntest:oss# runs playwright.oss.config.ts-name:Postresults+uploadreportuses:mcbuddy/testivai-oss@v1if:always()with:github-token:${{secrets.GITHUB_TOKEN}}report-dir:visual-report# where @testivai/witness writes results.json# Runs when a collaborator comments /testivai approve on the PRapprove-baselines:name:ApproveBaselinesif:|
github.event_name == 'issue_comment' &&
github.event.issue.pull_request != null &&
startsWith(github.event.comment.body, '/testivai')
runs-on:ubuntu-latesttimeout-minutes:10steps:-uses:mcbuddy/testivai-oss/approve@v1with:github-token:${{secrets.GITHUB_TOKEN}}workflow:testivai-oss.yml# this file's name โ used to find the report artifact
Approve changed baselines
After CI posts the diff report on your PR, review the testivai-visual-report artifact, then comment:
Comment
Effect
/testivai approve homepage
Approves one named snapshot
/testivai approve --all
Approves every changed snapshot at once
What happens:
Action verifies you have write access to the repository (others get a polite rejection)
Downloads the testivai-visual-report artifact from the latest CI run on your branch
Copies approved screenshots into .testivai/baselines/ and commits them to your PR branch
Posts a confirmation comment listing what was approved
CI re-runs automatically โ approved snapshots now pass โ
What the PR comment looks like
code
๐ TestivAI Visual Report
โ ๏ธ 2 changed ยท ๐ 1 new ยท โ 4 passed Total snapshots: 7
Changed Snapshots
โผ homepage โ 12.34% different
๐ก DOM unchanged โ pixel diff is likely render noise (font hinting, anti-aliasing).
โผ dashboard โ 8.91% different
๐งฑ DOM changed โ 2 added, 1 removed.
Real-World Example
A complete, minimal consumer project lives at testivai-example: a static page, three witness() calls, the PR /testivai approve flow, and a live report on Pages โ all against the published packages.
This repository was extracted from the private TestivAI monorepo with a clean initial git history. Original development history is preserved internally; this public repository is the new source of truth for the SDKs going forward.