imugi 标志

imugi

社区
M00N7682

Give AI eyes to see your frontend. Design → pixel-perfect code with visual verification. MCP server for Claude Code & Cursor.

发布者M00N7682
代码仓库imugi
语言TypeScript
复刻数
0
星标数
10
可用工具
6
传输类型stdio
分类
许可协议MIT
链接
  • 将工具接入 AI 工作流

    imugi 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 6 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 10 个 Star 和 0 个 Fork。

imugi

npm version GitHub stars License: MIT Node.js Tests

Give AI eyes to see your frontend.

Figma design → pixel-perfect code, with zero manual CSS tweaking.

imugi is an MCP tool that captures your running UI, compares it against the original design using image similarity, and keeps pushing AI to fix the code until it's a perfect match.

Get Started · Docs · MCP Tools · Examples · Contributing


The Problem

You give AI a Figma design and ask it to build the frontend. The result looks... close. But then you spend the next 2 hours manually tweaking padding, font sizes, colors, and alignment — because AI has no way to verify what it actually produced.

imugi fixes this. It gives AI the ability to screenshot its own output, compare it pixel-by-pixel against the design, see exactly where the differences are, and fix them — automatically, in a loop, until the implementation matches the design.

No more eyeballing. No more manual CSS tweaking. The AI does it all.


How it works

Design Image → Code Generation → Screenshot → Compare → Analyze → Patch
                                                                     ↓
                                                              Score ≥ 95%? → Done!
                                                                     ↓ No
                                                                   Repeat

imugi uses SSIM (Structural Similarity) + pixelmatch + Claude Vision to compare design images against live rendered output, then automatically patches the code to close the gap. This is the Boulder Loop — it keeps rolling until your code matches the design.


Why imugi?

Without imugiWith imugi
Design fidelity"Looks close enough" — eyeball and prayPixel-level verification with composite score (SSIM + pixel diff + AI vision)
CSS tweaking2+ hours of manual padding/color/font fixesAI fixes its own mistakes automatically
Feedback loopYou are the feedback loopimugi is the feedback loop — screenshots, compares, patches, repeats
Framework supportConfigure each project manuallyAuto-detects React, Vue, Svelte, Next.js, Tailwind, CSS Modules, and more
AI integrationCopy-paste screenshots between toolsDrop-in MCP server for Claude Code / Cursor — zero setup
CostExtra API keys, extra subscriptionsNo API key needed in MCP mode — uses your existing AI editor

Quick Start

Step 1: Install & Setup

bash
npm install -g imugi-ai

# One-click setup: installs Playwright browser, detects project, creates config
imugi init

Step 2: Add to your AI tool

Add imugi as an MCP server in your Claude Code or Cursor config (no API key required):

json
{
  "mcpServers": {
    "imugi": {
      "command": "npx",
      "args": ["-y", "imugi-ai", "mcp"]
    }
  }
}

Step 3: Build something

Ask your AI to implement a design — imugi handles the visual verification loop.

Implement this login page design. Here's the reference: ./login-design.png

That's it. imugi captures, compares, and patches until the output matches your design.


Examples

Design → Code (zero manual CSS)

A terminal-inspired hero section — designed in Figma/Pencil, implemented entirely by AI + imugi. No manual CSS tweaking involved.

Left: original design. Right: AI-generated code verified by imugi. The AI iterated autonomously until it achieved a pixel-perfect match — nav bar, hero CTA, flow diagram, MCP tools grid, footer, all matching the design down to the pixel.

See the full example at examples/hero-section/.

More Examples

ExampleDescription
hero-section/Terminal-inspired landing hero with flow diagram
login-page/Split-panel login with social auth buttons
pricing-page/3-tier pricing cards (Starter / Pro / Enterprise)
dashboard/Analytics dashboard with sidebar, stats, and chart

Features

  • Visual Comparison Engine — SSIM + pixel diff scoring with red heatmap showing exact diff locations
  • Region Crop Pairs — Side-by-side crop images of each diff region (design vs your code) so AI can visually compare specific areas
  • DOM Style Extraction — Extracts computed CSS from your running page (font-size, color, padding, etc.) and maps them to diff regions — AI knows exactly what CSS values to change
  • Figma Spec Diff — When FIGMA_TOKEN is set, fetches exact design specs from Figma API and diffs them against your DOM: fontSize: design=42px → your code=48px. No guessing from pixels
  • Boulder Loop — Automated iterative improvement: capture → compare → patch → repeat until 95%+ match
  • MCP Server — Drop-in for Claude Code / Cursor / any MCP-compatible AI tool. No API key needed
  • Figma Integration — Export Figma frames directly via URL (imugi figma <URL>), no manual export
  • Project Auto-Detection — Detects React/Vue/Svelte/Next.js, Tailwind/CSS Modules/styled-components, TypeScript/JavaScript
  • Smart Patching — Full rewrite for low scores (< 0.7), surgical CSS fixes for high scores (>= 0.7)
  • Interactive Agent — Terminal UI with real-time iteration progress (powered by Ink)
  • CI/CD Ready — GitHub Action for visual regression testing in your pipeline

Usage Modes

As MCP Server (Recommended)

bash
imugi mcp

Works with Claude Code, Cursor, and any MCP-compatible tool. The AI calls imugi tools to verify and fix its own frontend output.

No API key needed for MCP mode. imugi provides the eyes (capture, compare, heatmap). Your AI editor provides the brain (code generation, patching). You provide nothing extra — zero additional cost.

As Interactive Agent

bash
export ANTHROPIC_API_KEY=sk-ant-...
imugi

Then describe what you want:

> implement this design ./login-design.png

One-shot Generation

bash
imugi generate ./design.png --output src/app/page.tsx

Compare Only

bash
# Compare against a local screenshot file
imugi compare ./design.png --screenshot ./current.png

# Compare against a running dev server URL
imugi compare ./design.png --screenshot http://localhost:3000

Figma Export

bash
# Export a Figma frame as PNG
imugi figma "https://www.figma.com/design/FILE_KEY/name?node-id=42-1234"

# Export at 3x scale with custom output path
imugi figma "https://www.figma.com/design/FILE_KEY/name?node-id=42-1234" -s 3 -o design.png

# Export and immediately compare against dev server
imugi figma "https://www.figma.com/design/FILE_KEY/name?node-id=42-1234" --compare

Requires a Figma personal access token via FIGMA_TOKEN environment variable or figma.token in config.


MCP Tools

ToolDescription
imugi_iterateThe main loop tool. Captures screenshot → compares against design → analyzes diffs → returns score + heatmap + region crop pairs + DOM computed styles + Figma spec diff (if FIGMA_TOKEN set). Returns ACTION_REQUIRED or DONE. Call repeatedly after each code fix.
imugi_captureScreenshot a URL via headless Chromium
imugi_compareCompare design vs screenshot — returns SSIM score, pixel diff, heatmap, and region crop pairs
imugi_analyzeAnalyze visual differences with actionable fix suggestions
imugi_figma_exportExport a Figma frame as PNG via URL or file key + node ID
imugi_detectDetect project tech stack (framework, CSS, language)
imugi_serveStart a dev server for the target project

Comparison Algorithm

The composite score combines multiple signals:

SignalWhat it measures
SSIMStructural similarity — luminance, contrast, structure
Pixel diffRaw pixel-level comparison via pixelmatch
Claude VisionAI-powered visual assessment (CLI agent mode, activated for scores < 0.98)

Beyond the score, imugi_iterate returns three layers of actionable feedback:

LayerWhat it providesRequires
Heatmap + crop pairsRed overlay showing diff locations + zoomed-in design vs code crops for each regionNothing (free)
DOM computed stylesActual CSS values (font-size, color, padding...) of elements in each diff regionNothing (free)
Figma spec diffExact design-vs-code CSS comparison: fontSize: design=42px → code=48pxFIGMA_TOKEN

Strategy selection based on score:

ScoreStrategyDescription
< 0.7Full regenerationRewrite the code from scratch
>= 0.7Surgical patchTargeted fixes only

Configuration

Create imugi.config.json in your project root:

json
{
  "comparison": {
    "threshold": 0.95,
    "maxIterations": 10
  },
  "rendering": {
    "port": 3000,
    "viewport": { "width": 1440, "height": 900 }
  }
}

Environment Variables

VariableDescription
ANTHROPIC_API_KEYAnthropic API key
IMUGI_API_KEYAlternative API key
IMUGI_THRESHOLDSimilarity threshold (0.8–0.99)
IMUGI_MAX_ITERATIONSMax iterations (1–50)
IMUGI_PORTDev server port
FIGMA_TOKENFigma personal access token — enables Figma export, and exact CSS spec diff in imugi_iterate (design values vs your code)

Architecture

src/
├── cli.ts              # CLI entry point (Commander.js)
├── mcp/server.ts       # MCP server (stdio transport)
├── agent/
│   ├── auth.ts         # OAuth PKCE + API key auth
│   ├── loop.ts         # Boulder Loop — iterative improvement
│   ├── session.ts      # State management
│   └── ui.tsx          # Terminal UI (Ink/React)
├── core/
│   ├── comparator.ts   # SSIM + pixelmatch + heatmap
│   ├── analyzer.ts     # Diff classification + strategy
│   ├── renderer.ts     # Playwright screenshot engine
│   ├── patcher.ts      # Code generation + patching
│   ├── context.ts      # Project tech stack detection
│   └── figma.ts        # Figma URL parsing + API export + design spec extraction
├── llm/
│   ├── client.ts       # Anthropic SDK wrapper
│   └── prompts.ts      # Prompt engineering
├── config/
│   ├── schema.ts       # Zod validation
│   ├── loader.ts       # Config loading (file + env + CLI)
│   └── defaults.ts     # Default configuration
└── types.ts            # Shared type definitions

Alternatives & Comparison

How does imugi compare to other design-to-code tools?

FeatureimugiAnimaLocofyScreenshot-to-CodeVercel v0
Visual verificationSSIM + pixel diff + heatmap + crop pairs + DOM stylesNoneNoneNoneNone
Design spec diffFigma API → exact CSS comparison (design=42px vs code=48px)NoneNoneNoneNone
Automated iterationBoulder Loop (capture → compare → patch → repeat)Single passSingle passSingle passSingle pass
MCP serverNative MCP for Claude Code / CursorNoNoNoNo
Open sourceMITNoNoYesNo
Additional API keyNot needed in MCP modeRequiredRequiredRequiredRequired
Figma integrationDirect URL exportPluginPluginNoNo
Framework detectionAuto (React, Vue, Svelte, Next.js)ManualManualLimitedAuto
PricingFreePaidPaidFree (self-host)Freemium

imugi is the only tool that measures design-to-code fidelity with an objective score and automatically iterates until the code matches the design. Other tools generate code in a single pass with no verification step.


Star History

If imugi helped you skip the manual CSS grind, consider giving it a star.

Star History Chart


Development

bash
git clone https://github.com/M00N7682/imugi.git
cd imugi
npm install
npm run build
npm test

See CONTRIBUTING.md for guidelines.


License

MIT

安装

TypingMind
{
  "mcpServers": {
    "imugi": {
      "command": "npx",
      "args": [
        "-y",
        "imugi-ai",
        "mcp"
      ]
    }
  }
}

可用工具

  • imugi_capture

    Capture a screenshot of a web page at a given URL

  • imugi_compare

    Compare a design image against a rendered screenshot. Returns SSIM score, pixel diff, and heatmap.

  • imugi_analyze

    Analyze differences between a design and screenshot, returning actionable fix suggestions

  • imugi_figma_export

    Export a Figma frame as a PNG image. Pass a Figma URL or file key + node ID. Requires FIGMA_TOKEN env var.

  • imugi_detect

    Detect the tech stack of a project (framework, CSS, language, dev server)

  • imugi_serve

    Start a dev server and return the URL (for use with imugi_capture). The server process is tracked and will be cleaned up when the MCP session ends.

将 imugi MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 imugi 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请保持终端窗口及其中的进程运行。
3

将 imugi 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 imugi MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "imugi": {
      "command": "npx",
      "args": [
        "-y",
        "imugi-ai"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 imugi MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 imugi MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 imugi 帮我完成这项任务吗?
imugi
当然。我已阅读。
以下是我使用 imugi 得到的结果。

常见问题

imugi MCP 服务器有什么用途?

imugi 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 imugi MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 imugi,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 imugi MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 imugi 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 imugi MCP 连接到 TypingMind?

imugi 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

imugi MCP 在 TypingMind 中提供哪些工具?

imugi 提供 6 个 MCP 工具,您可以在 TypingMind 的插件页面启用这些工具,然后在聊天中使用,或将其分配给 AI 智能体。

使用 imugi MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 imugi 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇