Figma to Code MCP server

Bridges Figma design files to code generation, enabling direct conversion of designs into HTML, CSS, and other assets with customizable output paths and file organization.
Back to servers
Setup instructions
Provider
F2C
Release date
Apr 25, 2025
Language
TypeScript
Package
Stats
9.1K downloads
270 stars

The F2C MCP server enables you to convert Figma designs into code (HTML/CSS, React, Tailwind) with pixel-perfect accuracy while maintaining design context for AI tools. It simplifies the workflow of transforming designs into implementation-ready code.

Installation

Prerequisites

  • Node.js
  • A Figma account with access to your design files

Setting Up the F2C MCP Server

Install the package using npm:

npm install @f2c/mcp

Configuration

The F2C MCP server needs to be configured in an MCP-supported IDE like Cursor, Trae, or Comate AI IDE.

Setting Up in Your IDE

Follow these steps to configure the server:

  1. Open your MCP-supported IDE (Comate AI IDE is recommended)
  2. Configure the MCP server connection in your IDE settings
  3. Set the server URL to connect to your local or hosted F2C MCP instance

Authentication Setup

You'll need to configure authentication with your Figma account:

// Example configuration
const config = {
  figmaToken: "your-figma-personal-access-token",
  outputDir: "./output"
}

Usage

Basic Workflow

  1. Configure the server in your MCP-supported IDE
  2. Open the chat interface in your IDE
  3. Copy a Figma node URL (right-click any node in Figma's Layer panel and select "Copy Link")
  4. Paste the URL in your IDE's chat
  5. Specify your requirements in the chat

Example Commands

Here are some examples of what you can ask the F2C MCP server to do:

// Fetch design information
Fetch the details for this Figma component: https://www.figma.com/file/xxxxx/Design?node-id=123

// Generate code
Convert this Figma button to React with Tailwind CSS: https://www.figma.com/file/xxxxx/Design?node-id=456

// Download assets
Download all images from this Figma frame and convert to HTML/CSS: https://www.figma.com/file/xxxxx/Design?node-id=789

Working with Generated Code

After the server processes your request, it will:

  1. Generate code based on your specifications
  2. Download any necessary assets
  3. Provide the code output in your IDE

Advanced Features

Multi-Framework Support

F2C MCP server supports multiple output frameworks:

  • HTML/CSS
  • React
  • CSS Modules
  • Tailwind CSS

Specify your preferred framework when requesting code generation:

Generate React code with CSS Modules for this Figma component: [Figma URL]

Remote Image Handling

The server can automatically download and localize images from your Figma designs:

Download all images from this design and create a React component: [Figma URL]

Design Context Integration

F2C preserves design context information, which is especially useful when working with AI coding tools:

Analyze the design system used in this Figma file: [Figma URL]

Troubleshooting

If you encounter issues:

  1. Verify your Figma token has proper permissions
  2. Ensure the Figma URL is correctly formatted
  3. Check that your IDE is properly configured to connect to the MCP server
  4. Confirm you have the necessary permissions to access the Figma file

For more detailed troubleshooting, refer to the official documentation at f2c.yy.com.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "f2c-mcp" '{"command":"npx","args":["-y","@f2c/mcp"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "f2c-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@f2c/mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "f2c-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@f2c/mcp"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later