Skip to main content

Figma MCP (Cursor Talk to Figma)

A Model Context Protocol (MCP) integration that bridges Cursor AI and Figma, enabling AI-powered design automation, bulk edits, and intelligent design manipulation directly from your code editor.

Overview

Figma MCP implements the Model Context Protocol to allow Cursor AI to communicate with Figma for reading designs and modifying them programmatically. It uses a WebSocket server to facilitate real-time communication between the MCP server and a Figma plugin.

MCP Server

TypeScript-based server implementing Model Context Protocol

Figma Plugin

Browser-based plugin for executing commands in Figma

WebSocket Bridge

Real-time bidirectional communication layer

Cursor Integration

Native integration with Cursor AI editor

Architecture

Three-Part System

1

MCP Server

Implements the Model Context Protocol and exposes tools to Cursor AI. Runs as a TypeScript process.
2

WebSocket Server

Bridges communication between the MCP server and Figma plugin. Runs on localhost:3000.
3

Figma Plugin

Executes design commands inside Figma’s browser environment. Available in Figma Community or locally.

Project Structure

Figma MCP/
├── talk-to-figma/
│   ├── src/
│   │   ├── talk_to_figma_mcp/   # MCP server implementation
│   │   │   └── server.ts
│   │   ├── cursor_mcp_plugin/   # Figma plugin code
│   │   │   ├── manifest.json
│   │   │   ├── ui.html
│   │   │   └── code.ts
│   │   └── socket.ts            # WebSocket server
│   ├── package.json
│   └── readme.md
└── package.json

Features

Design Reading

Read any property from Figma nodes:
  • Dimensions (width, height, x, y)
  • Styling (fills, strokes, effects)
  • Text content and formatting
  • Layer structure and hierarchy

Design Modification

Bulk Text Replacement

Replace text content across multiple text layers simultaneously

Style Updates

Modify fills, strokes, effects, and other style properties

Layout Adjustments

Change positions, sizes, and spacing programmatically

Instance Overrides

Propagate component instance changes to multiple targets

Automation Examples

Replace text in multiple text layers at once:Cursor Prompt:
Replace all text layers containing "Hello" with "Welcome"
in the current Figma selection
What happens:
  • MCP server sends command to Figma plugin
  • Plugin finds all text layers
  • Replaces matching content
  • Reports back number of changes
Demo Video
Copy overrides from one component instance to many:Cursor Prompt:
Copy all overrides from the selected instance
to all other instances of the same component on this page
Use case: You’ve customized one button instance and want to apply those same customizations to 50 other buttons.Demo Video
Update styles across multiple layers:Cursor Prompt:
Change all rectangles with blue fill to green
in the current frame

Installation

Prerequisites

  • Bun runtime installed
  • Cursor AI editor
  • Figma desktop app or browser access

Quick Setup

1

Install Bun

curl -fsSL https://bun.sh/install | bash
2

Clone and Setup

cd figma-mcp
bun setup
This installs dependencies and configures MCP in Cursor.
3

Start WebSocket Server

bun socket
Runs on localhost:3000
4

Install Figma Plugin

Option A: Figma Community (Recommended)Install from Figma CommunityOption B: Local Development
  1. In Figma: Plugins → Development → New Plugin
  2. Choose “Link existing plugin”
  3. Select src/cursor_mcp_plugin/manifest.json
5

Test Connection

Open Figma file, run the plugin, then in Cursor:
Get the dimensions of the selected layer in Figma

Manual MCP Configuration

Add to ~/.cursor/mcp.json:
{
  "mcpServers": {
    "TalkToFigma": {
      "command": "bunx",
      "args": ["cursor-talk-to-figma-mcp@latest"]
    }
  }
}
Or for local development:
{
  "mcpServers": {
    "TalkToFigma": {
      "command": "bun",
      "args": ["/path/to/figma-mcp/src/talk_to_figma_mcp/server.ts"]
    }
  }
}

Usage

Basic Workflow

1

Start WebSocket Server

bun socket
Leave this running in a terminal
2

Open Figma

Open your Figma file in desktop app or browser
3

Run Plugin

Plugins → Development → Cursor Talk to Figma MCP
4

Select Layers

Select the layers you want to work with
5

Use Cursor AI

In Cursor, describe what you want to do:
  • “Get the text content of all selected layers”
  • “Change the fill color to #FF6B6B”
  • “Replace ‘Hello’ with ‘Hi’ in all text layers”

Example Prompts

"What are the dimensions of the selected frame?"
"Get all text content from the current page"
"List all layer names in the selection"

Technical Details

MCP Protocol Implementation

The server exposes tools through the Model Context Protocol:
// Example tool definition
const tools = [
  {
    name: 'get_selection',
    description: 'Get currently selected layers in Figma',
    inputSchema: {
      type: 'object',
      properties: {}
    }
  },
  {
    name: 'set_property',
    description: 'Set a property on Figma nodes',
    inputSchema: {
      type: 'object',
      properties: {
        nodeIds: { type: 'array', items: { type: 'string' } },
        property: { type: 'string' },
        value: { type: 'any' }
      },
      required: ['nodeIds', 'property', 'value']
    }
  },
  // ... more tools
];

WebSocket Communication

// socket.ts
import { WebSocketServer } from 'ws';

const wss = new WebSocketServer({ port: 3000 });

wss.on('connection', (ws) => {
  console.log('Figma plugin connected');
  
  ws.on('message', (data) => {
    const message = JSON.parse(data.toString());
    
    if (message.type === 'response') {
      // Forward response to MCP server
      handleMCPResponse(message);
    }
  });
  
  // Send commands from MCP server to Figma
  mcpServer.on('command', (cmd) => {
    ws.send(JSON.stringify(cmd));
  });
});

Figma Plugin Side

// cursor_mcp_plugin/code.ts
figma.showUI(__html__, { width: 300, height: 200 });

const ws = new WebSocket('ws://localhost:3000');

ws.onmessage = async (event) => {
  const command = JSON.parse(event.data);
  
  // Execute command in Figma
  const result = await executeCommand(command);
  
  // Send result back
  ws.send(JSON.stringify({
    type: 'response',
    commandId: command.id,
    result
  }));
};

async function executeCommand(command: Command) {
  switch (command.name) {
    case 'get_selection':
      return figma.currentPage.selection.map(node => ({
        id: node.id,
        name: node.name,
        type: node.type
      }));
    
    case 'set_text':
      const textNode = figma.getNodeById(command.nodeId) as TextNode;
      await figma.loadFontAsync(textNode.fontName as FontName);
      textNode.characters = command.text;
      return { success: true };
    
    // ... more commands
  }
}

Windows + WSL Setup

1

Install Bun in WSL

curl -fsSL https://bun.sh/install | bash
2

Install Bun in Windows (PowerShell)

powershell -c "irm bun.sh/install.ps1 | iex"
3

Run WebSocket in WSL

cd figma-mcp
bun socket
4

Configure Cursor

Use the Windows path to WSL Bun in mcp.json:
{
  "mcpServers": {
    "TalkToFigma": {
      "command": "wsl",
      "args": [
        "bun",
        "/path/in/wsl/to/server.ts"
      ]
    }
  }
}

Use Cases

Localization

Bulk replace text for different languages across all screens

A/B Testing

Create design variations by programmatically changing elements

Data Population

Fill designs with real data from APIs or databases

Design Tokens

Apply design token changes across entire design systems

Batch Updates

Update pricing, dates, or other content across multiple artboards

Component Sync

Propagate changes to component instances automatically

Troubleshooting

  1. Ensure bun socket is running
  2. Check that port 3000 is not in use:
    lsof -i :3000
    
  3. Try restarting the WebSocket server
  1. Verify ~/.cursor/mcp.json is configured correctly
  2. Restart Cursor after config changes
  3. Check Cursor’s MCP logs for errors
  1. Ensure WebSocket server is running first
  2. Check browser console for errors
  3. Verify the plugin is running (should show in Figma UI)
  4. Try closing and reopening the plugin
  1. Ensure layers are selected in Figma
  2. Check WebSocket server logs for errors
  3. Verify command syntax in MCP server logs

Contributing

Contributions welcome! Notable contributions:

View on GitHub

Star the repo and contribute your own features

Resources

Video Tutorial

Watch the quick video tutorial

Figma Community

Install the plugin from Figma Community

MCP Documentation

Learn more about Model Context Protocol

Build docs developers (and LLMs) love