Skip to main content
Glama

Figma Restoration MCP Vue Tools

npm version License: MIT Node.js Version

πŸ› οΈ Professional Figma Component Restoration Kit - A comprehensive MCP (Model Context Protocol) server for Vue component development and Figma design restoration. Features snapDOM-powered high-quality screenshots, intelligent visual comparison, and automated SVG optimization.

πŸš€ Features

  • 🎯 High-Quality Screenshots: snapDOM technology with 3x scaling, font embedding, and intelligent shadow detection

  • πŸ” Advanced Visual Comparison: Pixel-perfect analysis with smart difference detection and quality assessment

  • 🎨 SVG Optimization: Built-in SVGO integration with customizable configuration

  • πŸ€– MCP Integration: Seamless integration with AI coding assistants (Cursor, Claude, etc.)

Related MCP server: forgekit-storybook-mcp

πŸ“¦ Quick Start

Use the published npm package for easy setup and automatic updates:

Step 1: Add the MCP server to your Cursor configuration (~/.cursor/mcp.json):

{
  "mcpServers": {
    "figma-restoration-tools": {
      "command": "npx",
      "args": [
        "-y",
        "figma-restoration-tools",
        "start"
      ],
      "env": {
        "PUPPETEER_EXECUTABLE_PATH": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
        "NODE_ENV": "production"
      }
    }
  }
}

Step 2: Restart Cursor after adding the configuration.

Step 3: Use the MCP tools in Cursor:

  • figma_compare - Compare components with Figma designs

  • snapdom_screenshot - Take high-quality component screenshots

  • optimize_svg - Optimize SVG assets

πŸ”§ Local Development Version

For contributors or advanced users who need to modify the source code:

Step 1: Clone and setup the repository:

git clone https://github.com/tianmuji/figma-restoration-tools.git
cd figma-restoration-tools
npm install

Step 2: Add the local MCP server to your Cursor configuration:

{
  "mcpServers": {
    "figma-restoration-tools": {
      "command": "node",
      "args": [
        "/absolute/path/to/figma-restoration-tools/src/server.js"
      ],
      "cwd": "/absolute/path/to/figma-restoration-tools",
      "env": {
        "PUPPETEER_EXECUTABLE_PATH": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
        "NODE_ENV": "development"
      }
    }
  }
}

πŸ› οΈ MCP Tools

figma_compare

Advanced component comparison tool that analyzes differences between expected and actual screenshots.

Parameters:

{
  "tool": "figma_compare",
  "arguments": {
    "componentName": "MyComponent",
    "projectPath": "/path/to/your/vue/project",
    "threshold": 0.1,
    "outputPath": "/custom/output/directory"
  }
}

Features:

  • Pixel-perfect difference detection

  • Quality assessment scoring

  • Detailed analysis reports (JSON & Markdown)

  • Customizable comparison threshold

snapdom_screenshot

High-quality DOM screenshot tool using snapDOM technology for precise component capture.

Parameters:

{
  "tool": "snapdom_screenshot", 
  "arguments": {
    "componentName": "MyComponent",
    "projectPath": "/path/to/your/vue/project",
    "port": 3000,
    "viewport": {
      "width": 1440,
      "height": 800
    },
    "snapDOMOptions": {
      "scale": 3,
      "compress": true,
      "embedFonts": true,
      "backgroundColor": "transparent",
      "padding": 0
    },
    "outputPath": "/custom/output/path.png"
  }
}

Features:

  • 3x scaling for high-resolution output

  • Intelligent shadow and effect capture

  • Font embedding support

  • Transparent background support

  • Custom viewport and output settings

optimize_svg

SVG optimization tool powered by SVGO with customizable configuration.

Parameters:

{
  "tool": "optimize_svg",
  "arguments": {
    "inputPath": "/path/to/input.svg",
    "outputPath": "/path/to/optimized.svg",
    "svgoConfig": {
      "plugins": ["preset-default"],
      "multipass": true,
      "floatPrecision": 2
    }
  }
}

Features:

  • Advanced SVG optimization

  • Customizable SVGO configuration

  • Batch processing support

  • Size reduction reports

βš™οΈ Configuration

Environment Variables

  • PUPPETEER_EXECUTABLE_PATH: Path to Chrome/Chromium executable

  • NODE_ENV: Environment mode (development/production)

Shadow Detection

For components with shadows, the tool automatically calculates optimal padding based on effect data:

{
  "snapDOMOptions": {
    "scale": 3,
    "padding": 0,
    "figmaEffects": [
      {
        "type": "DROP_SHADOW", 
        "offset": {"x": 0, "y": 5}, 
        "radius": 30, 
        "spread": 0
      }
    ]
  }
}

Comparison Thresholds

Threshold

Sensitivity

Use Case

0.0-0.05

Very Strict

Pixel-perfect matching

0.05-0.1

Strict

High-quality components

0.1-0.2

Moderate

General comparison

0.2+

Loose

Rough similarity check

🎯 Typical Workflow

  1. Setup: Configure MCP server in Cursor

  2. Screenshot: Use snapdom_screenshot to capture component

  3. Compare: Use figma_compare to analyze differences

  4. Optimize: Use optimize_svg for asset optimization

  5. Iterate: Refine component based on analysis results

πŸ“‹ Requirements

  • Node.js: β‰₯ 18.0.0

  • Chrome/Chromium: For screenshot generation

  • Vue.js project: For component restoration

  • MCP-compatible client: Cursor IDE, Claude Desktop, etc.

🀝 Contributing

  1. Fork the repository

  2. Create a feature branch (git checkout -b feature/new-feature)

  3. Commit your changes (git commit -m 'Add new feature')

  4. Push to the branch (git push origin feature/new-feature)

  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

πŸ™ Acknowledgments


🎨 Built for developers who demand pixel-perfect component restoration 🎨

Available Tools

3 tools
figma_compareB

Simple Figma component comparison tool: compare existing screenshots and generate diff.png for visual analysis

ParametersJSON Schema
NameRequiredDescriptionDefault
thresholdNoComparison threshold (0-1, lower is more strict)
outputPathNoCustom output directory for results (optional). If not provided, defaults to src/components/{componentName}/results
projectPathNoPath to the Vue project/Users/yujie_wu/Documents/work/camscanner-cloud-vue3
componentNameYesName of the component to compare

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full responsibility for behavioral disclosure. It does reveal that the tool 'generate[s] diff.png', which indicates a file-writing side effect, but it does not state whether files are overwritten, how screenshots are located, what happens if screenshots are missing, or whether the tool modifies any existing files. This is insufficient for an agent to predict side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that efficiently conveys the tool's core function and output. There is no filler or redundant phrasing, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is too brief for the full context. It does not explain how the tool relates to snapdom_screenshot (likely the capture counterpart), what the expected directory structure is, how threshold affects comparison, or what the tool returns. The schema covers parameter semantics but not the workflow or prerequisites, leaving an agent without enough context to invoke the tool confidently.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

All parameters have descriptive schema entries (100% coverage), so the baseline is 3. The description adds minimal meaning beyond the schema; it mentions comparing and generating diff.png but does not elaborate on the threshold, output paths, or project path. Since the schema already documents these adequately, the description does not need to compensate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('compare'), a resource ('existing screenshots' of Figma components), and a concrete output ('generate diff.png'). It clearly differentiates from siblings: optimize_svg is for SVG optimization, snapdom_screenshot is for screen capture, while figma_compare is for visual comparison.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given about when to use this tool vs alternatives. It does not mention prerequisites (e.g., that screenshots must already exist), nor does it reference sibling tools or exclusion conditions. The description only implies usage through the tool name and phrase 'compare existing screenshots'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

optimize_svgC

Optimize SVG files using SVGO (SVG Optimizer) with customizable configuration

ParametersJSON Schema
NameRequiredDescriptionDefault
inputPathYesPath to the input SVG file (required)
outputPathNoPath to the output SVG file (optional - if not provided, overwrites the original file)
svgoConfigNoCustom SVGO configuration (optional - uses default if not provided)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of disclosing behavioral traits, but it only says 'Optimize' and does not mention that the original file may be overwritten when outputPath is omitted, whether the operation is destructive/irreversible, or what the tool returns. The SVGO reference gives some expected behavior but leaves important side effects unstated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single front-loaded sentence with no filler; 'SVG Optimizer' is slightly redundant but not harmful. It is concise and scannable, though its compactness does omit behavioral context that is scored in other dimensions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The input schema fully documents all three parameters, including the overwrite behavior of outputPath and defaults for svgoConfig. However, with no annotations and no output schema, the definition lacks explicit guidance about side effects, safe usage, and what a successful call returns, making it adequate but not complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with meaningful descriptions for inputPath, outputPath, and svgoConfig, so the description does not need to repeat parameter details. The phrase 'customizable configuration' lightly reinforces svgoConfig but adds little beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('Optimize') and resource ('SVG files'), and further identifies the implementation via SVGO. It is clear what the tool operates on, though it does not explicitly differentiate from siblings; the sibling names are unrelated enough that this is not a major gap.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance about when to use optimize_svg versus figma_compare or snapdom_screenshot, nor any mention of prerequisites, exclusions, or common scenarios. The only implied usage is the general 'optimize' verb, which is not sufficient for an agent to make a confident selection decision.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

snapdom_screenshotB

Take high-quality screenshots using snapDOM technology for precise DOM-to-image capture

ParametersJSON Schema
NameRequiredDescriptionDefault
portNoPort where Vue dev server is running
selectorNoCustom CSS selector to screenshot (optional)
viewportNoViewport size for screenshot
outputPathNoCustom output path for screenshot (optional)
projectPathNoPath to the Vue project/Users/yujie_wu/Documents/work/camscanner-cloud-vue3
figmaEffectsNoFigma effects data for smart shadow padding calculation (optional)
componentNameYesName of the component to screenshot
snapDOMOptionsNosnapDOM capture options for high-quality screenshots with box-shadow support

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the full burden of behavioral disclosure. It only claims 'high-quality' and 'precise' capture but does not explain that this requires a running Vue dev server, that it writes screenshot files to an output path, or that componentName is required. These operational behaviors are essential for an agent to invoke the tool correctly and are entirely absent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that communicates the core function without redundancy. It is concise and easy to scan. However, it leans on vague marketing terms like 'high-quality' and 'precise' rather than concrete operational detail, so it is not maximally informative for its brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

This is a complex tool with 8 parameters, nested objects, no annotations, and no output schema. The description does not mention the Vue development server requirement, the required componentName, or what happens after the screenshot is taken. An agent would need to inspect the full schema and likely make assumptions about runtime requirements, which is a substantial gap for a tool of this complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage across all 8 parameters, including nested snapDOMOptions and viewport properties. The description itself adds no parameter-specific meaning, but with high schema coverage, baseline 3 is appropriate. The schema already documents defaults and purposes adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: taking high-quality screenshots of DOM elements using snapDOM technology. This distinguishes it from its siblings (figma_compare and optimize_svg) which are clearly not screenshot tools. The verb 'take' and resource 'DOM-to-image capture' make the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies this tool is used for capturing screenshots of Vue components, but it does not explicitly state when to use it versus alternatives like figma_compare. There are no exclusion criteria or context around when screenshot capture is appropriate. However, the siblings are functionally distinct, so the intended usage is reasonably inferred.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv1.0.0
    • First observedfigma_compare
    • First observedoptimize_svg
    • First observedsnapdom_screenshot

TDQS

B3.1/5.0

Scored across 3 tools

Disambiguation4/5

The three tools have distinct purposes: comparing screenshots, optimizing SVGs, and taking screenshots. There is slight conceptual overlap between figma_compare and snapdom_screenshot, but their roles are clear: one captures, one compares. No two tools appear to do the same thing.

Naming Consistency3/5

Names use consistent snake_case, but the pattern is mixed: optimize_svg and snapdom_screenshot are verb-first, while figma_compare is object-first. This is readable but not perfectly predictable.

Tool Count4/5

With only 3 tools, the server is on the lighter side, but each tool serves a distinct function in a focused restoration workflow. The count is reasonable for a specialized utility server, though slightly thin.

Completeness3/5

The tools cover capture, comparison, and optimization, but the server name suggests a broader restoration workflow. Missing operations like image conversion, batch processing, or asset export create notable gaps that agents may need to work around.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers