Figma to React MCP

Figma to React MCP

Automates the conversion of Figma designs into TypeScript React components and integrates with GitHub to create pull requests for the generated code. It includes visual regression testing with Playwright and accessibility validation to ensure implementations match the original designs.

Category
Visit Server

README

Figma to React MCP

A powerful MCP (Model Context Protocol) server that converts Figma designs into React components automatically. Combines GitHub, Figma, and Playwright integrations for a seamless design-to-React workflow.

Latest Updates: Enhanced performance optimizations, browser pooling, request caching, and improved error handling for production-ready workflows.

✨ Features

  • šŸŽØ Figma Integration: Extract designs, components, and design tokens from Figma files
  • šŸ™ GitHub Integration: Create branches, generate pull requests, and manage repository operations
  • šŸŽ­ Playwright Integration: Automated visual testing and browser automation
  • āš›ļø React-Focused: Generates TypeScript React functional components with proper typing
  • šŸ”„ Automated Workflow: Figma design → React component → GitHub PR in one step
  • šŸ“¦ NPX Distribution: Easy installation and setup via npx

šŸš€ Quick Start

Easy Installation with npx

# Interactive setup (recommended for first-time users)
npx figma-to-react-mcp --setup

# Or run directly if you have tokens configured
GITHUB_TOKEN=xxx FIGMA_ACCESS_TOKEN=yyy npx figma-to-react-mcp

The --setup command will:

  • Prompt for your GitHub and Figma tokens
  • Configure environment variables
  • Set up Cursor MCP integration automatically
  • Create all necessary configuration files

Manual Setup

  1. Get your API tokens:

    • GitHub: Go to Settings → Developer settings → Personal access tokens → Generate new token with repo permissions
    • Figma: Go to Figma Settings → Account → Personal access tokens → Generate new token
  2. Run with environment variables:

    GITHUB_TOKEN=your_github_token FIGMA_ACCESS_TOKEN=your_figma_token npx figma-to-react-mcp
    

šŸ› ļø Available Tools

1. design_to_code

Converts Figma designs to React TypeScript components and creates GitHub PRs.

What you get:

  • React functional component with TypeScript
  • Responsive CSS styles
  • Proper component structure and props
  • Automatic GitHub branch and PR creation

Example usage in Cursor:

  • Paste a Figma URL: https://www.figma.com/file/abc123/Design?node-id=1%3A2
  • Specify component name: HeroButton
  • Get a complete React component with GitHub PR

2. test_design_implementation

Tests generated React components against Figma designs using visual regression testing and accessibility validation.

3. analyze_figma_design

Analyzes Figma designs and extracts design tokens, components, and structure.

4. create_design_pr

Creates GitHub PRs with generated React components and comprehensive test results.

5. setup_project_branch

Creates new GitHub branches for feature development.

šŸ“‹ CLI Commands

npx figma-to-react-mcp --setup    # Interactive setup
npx figma-to-react-mcp --help     # Show help
npx figma-to-react-mcp --version  # Show version
npx figma-to-react-mcp            # Start MCP server

āš™ļø Cursor Integration

After running npx figma-to-react-mcp --setup, the MCP server will be automatically configured in Cursor.

Manual Cursor Setup (if needed): Add this to your Cursor MCP settings:

{
  "mcpServers": {
    "figma-to-react-mcp": {
      "command": "npx",
      "args": ["figma-to-react-mcp"],
      "env": {
        "GITHUB_TOKEN": "your_github_token_here",
        "FIGMA_ACCESS_TOKEN": "your_figma_token_here"
      }
    }
  }
}

šŸ”§ Configuration

Environment Variables

Required:

  • GITHUB_TOKEN: GitHub Personal Access Token with repo permissions
  • FIGMA_ACCESS_TOKEN: Figma Access Token from your account settings

Optional:

  • LOG_LEVEL: Logging level (debug, info, warn, error) - default: info
  • PLAYWRIGHT_BROWSER: Browser to use (chromium, firefox, webkit) - default: chromium

šŸ“š Usage Examples

Basic Workflow

  1. Setup once:

    npx figma-to-react-mcp --setup
    
  2. In Cursor, use the MCP tools:

    • Open a Figma design
    • Copy the URL (with node selection)
    • Use the design_to_code tool
    • Get a React component + GitHub PR automatically

Design to Code Flow

Figma Design URL → Extract Design Tokens → Generate React Component → Run Tests → GitHub PR
                                          ↓
                              TypeScript + CSS + Tests

šŸš€ Release Management

This package includes multiple approaches for version management:

Interactive Release (Recommended)

# Guided release with prompts
npm run release

Quick Analysis

# Analyze commits to suggest version bump
npm run release:analyze

Commit Helper

# Interactive commit message creation with conventional commits
npm run commit

Direct Release

npm run release:patch   # Bug fixes
npm run release:minor   # New features
npm run release:major   # Breaking changes

GitHub Actions

Use the "Manual Release" workflow in GitHub Actions for team releases.

šŸ“– Complete Release Guide

šŸ—ļø Development

Local Development

git clone <your-repo>
cd figma-to-react-mcp
npm install
npm run build
npm run dev

Testing

npm test
npm run test:watch
npm run test:coverage

šŸ“¦ Publishing

To publish your own version:

  1. Update package.json with your package name
  2. Build the project: npm run build
  3. Publish: npm publish

šŸ› ļø Architecture

  • MCP SDK: Model Context Protocol implementation
  • TypeScript: Type-safe development
  • Playwright: Browser automation and testing
  • Octokit: GitHub API integration
  • Axios: HTTP client for Figma API
  • Zod: Runtime type validation

šŸ¤ Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

šŸ“„ License

MIT License - see LICENSE file for details.

šŸ†˜ Support

For issues and questions:

  • Create an issue in the GitHub repository
  • Run npx figma-to-react-mcp --help for CLI help
  • Check the interactive setup: npx figma-to-react-mcp --setup

Happy coding! šŸŽØāž”ļøšŸ’»

Made with ā¤ļø for frontend developers who want to automate their design-to-code workflow.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured