This project implements a Model Context Protocol (MCP) integration between Cursor AI and Figma Dev mode, allowing Cursor to communicate with Figma for reading designs.
cursorfigmavideo.mp4
src/talk_to_figma_mcp/- TypeScript MCP server for Figma integrationsrc/cursor_mcp_plugin/- Figma plugin for communicating with Cursorsrc/socket.ts- WebSocket server that facilitates communication between the MCP server and Figma plugin
-
Install Bun if you haven’t already:
curl -fsSL https://bun.sh/install | bash -
Clone the repo and navigate to the folder:
git clone [email protected]:eqlion/cursor-talk-to-figma-dev-mcp.git cd cursor-talk-to-figma-dev-mcp
-
Install JS dependencies:
bun install
-
Start the WebSocket server (used for communication between the Figma plugin and the MCP server):
bun socket
-
Add the server to your Cursor MCP config at
~/.cursor/mcp.json:Run
which bunto find the full path to"command", then update your config:{ "mcpServers": { "TalkToFigma": { "command": "/Users/YOURUSERNAME/.bun/bin/bun", "args": [ "/Users/YOURUSERNAME/path/to/cursor-talk-to-figma-dev-mcp/src/talk_to_figma_mcp/server.ts" ] } } }Alternatively, go to Cursor > Settings… > Cursor Settings > MCP and click “Add new global MCP server.”
You might need to refresh the server connection if it doesn’t connect right away.
-
Done! You’re all set.
- Open any Figma file you want to use.
- Switch to dev mode (if not already enabled).
- In the right pane, go to “Plugins”.
- In the Plugins section:
- Switch to Development,
- Click New,
- Choose “Import plugin from manifest…”
- In the file dialog, navigate to the repo folder, open the
cursor_mcp_plugindirectory, and selectmanifest.json. - If everything was configured correctly, the plugin should now be active.
- Start the WebSocket server
- Install the MCP server in Cursor
- Open Figma and run the Cursor MCP Plugin
- Connect the plugin to the WebSocket server by joining a channel using
join_channel - Use Cursor to communicate with Figma using the MCP tools
The MCP server provides the following tools for interacting with Figma:
get_document_info- Get information about the current Figma documentget_selection- Get information about the current selectionget_node_info- Get detailed information about a specific nodeget_nodes_info- Get detailed information about multiple nodes by providing an array of node IDs
get_annotations- Get all annotations in the current document or specific nodescan_nodes_by_types- Scan for nodes with specific types (useful for finding annotation targets)
scan_text_nodes- Scan text nodes with intelligent chunking for large designs
get_styles- Get information about local stylesget_local_components- Get information about local componentsget_team_components- Get information about team components
export_node_as_image- Export a node as an image (PNG, JPG, SVG, or PDF)execute_figma_code- Execute arbitrary JavaScript code in Figma (use with caution)
join_channel- Join a specific channel to communicate with Figma
-
Navigate to the Figma plugin directory:
cd src/cursor_mcp_plugin -
Edit code.js and ui.html
When working with the Figma MCP:
- Always join a channel before sending commands
- Get document overview using
get_document_infofirst - Check current selection with
get_selectionbefore modifications - Verify changes using
get_node_info - Use component instances when possible for consistency
- Handle errors appropriately as all commands can throw exceptions
- For large designs:
- Use chunking parameters in
scan_text_nodes - Monitor progress through WebSocket updates
- Implement appropriate error handling
- Use chunking parameters in
- For text operations:
- Use batch operations when possible
- Consider structural relationships
- Verify changes with targeted exports
- For converting legacy annotations:
- Scan text nodes to identify numbered markers and descriptions
- Use
scan_nodes_by_typesto find UI elements that annotations refer to - Match markers with their target elements using path, name, or proximity
- Categorize annotations appropriately with
get_annotations - Create native annotations with
set_multiple_annotationsin batches - Verify all annotations are properly linked to their targets
- Delete legacy annotation nodes after successful conversion
MIT
This project is based on cursor-talk-to-figma-mcp by Sonny Lazuardi, which is licensed under the MIT License.