Logo imugi

imugi

Cộng đồng
M00N7682

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

Nhà phát hànhM00N7682
Kho mãimugi
Ngôn ngữTypeScript
Bản fork
0
Sao
10
Công cụ có sẵn
6
Phương thức truyền tảistdio
Danh mục
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    imugi cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 6 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    10 sao và 0 bản fork từ kho mã được liên kết.

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

Cài đặt

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

Công cụ có sẵn

  • 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.

Dùng MCP imugi với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối imugi, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm imugi làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của imugi.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "imugi": {
      "command": "npx",
      "args": [
        "-y",
        "imugi-ai"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của imugi, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của imugi.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng imugi giúp tôi làm việc này không?
imugi
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng imugi.

Câu hỏi thường gặp

Máy chủ MCP imugi dùng để làm gì?

imugi là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP imugi với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng imugi với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP imugi với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối imugi, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP imugi với TypingMind?

imugi hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP imugi cung cấp những công cụ nào trong TypingMind?

imugi cung cấp 6 công cụ MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP imugi không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu imugi yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇