
One Shot Ui
io.github.TN0123由 GitHub 账号 TN0123 发布v0.7.0更新于 Oct 24, 2026
Deterministic UI extraction and screenshot diffing for AI coding agents.
概览
本地 MCP 服务器,从截图中提取 UI 结构、将实现与参考图做差异比对,并返回按影响排序的 CSS 修复建议。
- 可以做什么
- 从参考截图提取布局区域、颜色、字体与文字
- 对两张截图做像素与结构差异比对,生成热力图与 DOM 差异
- 给出排序后的 CSS 或 Tailwind 修复建议,并通过 converge 产出经像素验证的补丁
- 提取设计令牌与样式系统,并检查新界面是否符合参考图的设计语言
- 截取 URL 或本地 HTML 文件的截图,并生成实现方案或运行基准测试
- 适用场景
- 适合 AI 编码代理已把界面做到接近参考截图、但在间距、颜色、阴影或字体上仍有细微偏差时,用可重复的确定性测量和具体 CSS 修复替代反复“再看一眼截图”的猜测。也适合检查新页面是否符合既有设计系统。
- 运行要求
- 通过 npx 以 stdio 在本地运行 npm 包 one-shot-ui,需要 Node.js 与 npm。涉及浏览器截图的命令需另行安装 Playwright Chromium。未声明任何 API 密钥或环境变量。
安装
在 SourceWeft 中
- 打开 控制台中的 One Shot Ui,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
one-shot-ui
Catch what the eye can't.
Deterministic screenshot diffing for AI coding agents. Turn a reference screenshot into structured data, diff any build against it — pixel, layout, color, and type — then get the exact CSS to fix. Or copy a UI's design language onto a brand-new screen.
[npm version] [license] [node]
[one-shot-ui diffs an agent's build against the reference screenshot and flags the exact deltas]The problem
AI agents get UI ~90% of the way there — then stall. The layout looks right, but a card is 8px too tall, a panel is the wrong shade of gray, a shadow is flat, a gap is off by 24px. Asking the model to "look at the screenshot again and fix it" is slow, and you get a different answer every time.
one-shot-ui closes that last 10% deterministically. It extracts structured data from a reference screenshot — layout regions, colors, typography, spacing, design tokens — diffs your implementation against it, and returns specific, ranked fixes, not "make it look more like this."
Copy-paste CSS, ranked by visual impact — every example above is real output from the run below.
Watch it converge
The run command loops extract → capture → compare → fix until the heatmap goes quiet. In the run above, the agent's first build looked identical to the eye — one-shot-ui flagged 15 concrete deltas (position, size, color, shadow, spacing) and the loop drove the build to ~2.5% pixel mismatch, within ~0.5% of the tool's own estimated irreducible floor (≈2%, sub-pixel font rendering) for this design.
Why one-shot-ui
- Deterministic, not vibes. Stable pixel + structural diff scores — same input, same numbers — so you can gate CI on "is this pixel-close enough?"
- Exact fixes, not nudges. It returns concrete CSS (
width: 616px,#303040,gap: 176px), grouped by component and ranked by visual impact. - Structural, not just pixels. Detects missing/extra elements, position & size shifts, color, shadow, spacing, and typography — and labels which differences are irreducible (anti-aliasing, photographic content) so agents don't chase ghosts.
- Not gameable.
convergescores structural fidelity — is the reference's content present, placed, and legible? — not just pixel mismatch, and it refuses to win pixels by hiding, overlapping, or recoloring text into its background. It even flags reference text your build renders but clips out of view (a fixed-heightoverflow:hiddenbox) — the failure a pixel diff rewards, because cropped text lowers the mismatch. - Agent-native. Ships an
AGENTS.md(auto-discovered by Claude Code, Cursor, Codex, …) plus a Claude Code skill, so your agent drives it without hand-holding. - Local & private. Pixel diffing, OCR, and layout extraction all run on your machine. No images leave your box, no API keys.
Copy a UI's style, not just match it
Matching a screenshot pixel-for-pixel is one job. The other: building a different screen that feels like it belongs to the same design system. one-shot-ui extracts the design language from a reference and verifies a new UI conforms to it — deterministically, with no pixel oracle to lean on.
It reports measured facts and leaves the taste to the agent: it won't name your "primary" color or classify the mood — you decide those from the image (you're the vision model; the tool is your exact, hallucination-free eyes). Conformance is judged on what a screenshot grounds reliably — palette, spacing rhythm, type scale — while roundedness and elevation are flagged as advisories, since a raster can't pin them down.
Install
For commands that need a browser (capture, run):
Quick start
Every command supports --json for structured, agent-friendly output.
Use it with your coding agent
one-shot-ui ships an AGENTS.md (auto-discovered by Claude Code, Cursor, Codex, and other agent tools) plus a skill/SKILL.md for Claude Code.
Install the skill in one line:
Use it as an MCP server
one-shot-ui also runs as a local MCP server, so any
MCP-capable agent (Claude Code, Cursor, Cline, Windsurf, VS Code) can call compare,
converge, suggest_fixes, extract, tokens, plan, and style_check as tools — no shell
glue. It runs over stdio, makes no network calls, and needs no API keys.
Or add to any client's MCP config:
See docs/MCP.md for per-client setup and registry publishing.
Commands
How it works
- extract — segments the reference into layout regions, samples colors/tokens, and OCRs text.
- capture — screenshots your implementation (URL or local HTML) at a matched viewport.
- compare — aligns the two, computes a pixel heatmap and a structural diff, and classifies each issue (layout / color / typography / spacing) plus whether it's actionable.
- suggest-fixes — turns issues into concrete, ranked CSS edits.
run chains all four in a loop until the diff drops below --threshold.
Development
Requires Bun.
Dev scripts run directly from source:
Build for npm:
License
MIT
来源:README.md,提交 b3f90a7
工具
0版本历史
1- v0.7.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分