Figma MCP Write Bridge
A Model Context Protocol server that enables AI agents to programmatically create, modify, and manage Figma documents via a WebSocket bridge and Figma plugin.
README
Figma MCP Write Bridge
A Model Context Protocol (MCP) server that enables AI coding agents to manipulate Figma documents programmatically through a WebSocket bridge and Figma plugin.
Overview
This project provides a local MCP server that exposes write/manipulation tools for running Figma documents. It allows AI assistants and LLMs to create, modify, and manage Figma design elements programmatically via a lightweight plugin bridge.
Architecture
AI Client (VS Code) ←→ MCP Server (stdio) ←→ WebSocket Bridge ←→ Figma Plugin
- MCP Server (
server.ts): Runs locally and exposes tools via the Model Context Protocol over stdio - WebSocket Bridge: Enables communication between the server and Figma plugin
- Figma Plugin: Executes Figma API operations and returns results
Features
Node Creation
- Create frames, rectangles, ellipses, lines, polygons, and stars
- Add text with customizable fonts and styling
- Place images from base64-encoded data
Node Management
- Find and select nodes by name or type
- Rename, delete, duplicate nodes
- Resize and rotate elements
- Position nodes precisely
- Group and ungroup nodes
Styling & Effects
- Set fills and strokes with hex color support
- Configure corner radius, opacity, and blend modes
- Add drop shadows, inner shadows, and blur effects
- Manage layout grids
Layout
- Configure Auto Layout
- Set child constraints
- Control spacing and alignment
Text Manipulation
- Edit text content
- Apply text styles (font family, size, weight, spacing)
- Set text colors
Components & Boolean Operations
- Create components and instances
- Detach instances
- Perform boolean operations (union, subtract, intersect, exclude)
Data & Export
- Export nodes as PNG, JPG, or SVG
- Manage plugin data (JSON storage)
- Batch apply properties to multiple nodes
Installation
Prerequisites
- Node.js 18+ installed
- Figma desktop app or browser access
- An MCP-compatible AI client (e.g., VS Code with Copilot)
Setup
-
Clone the repository
git clone https://github.com/yourusername/figma-mcp-write-bridge.git cd figma-mcp-write-bridge -
Install dependencies
npm install -
Import the Figma plugin
- Open Figma
- Go to Plugins → Development → Import plugin from manifest
- Select
plugin/manifest.jsonfrom this project
Usage
Starting the Server
npm start
This will:
- Start the WebSocket server on
ws://127.0.0.1:3055 - Initialize the MCP server listening on stdio
- Wait for the Figma plugin to connect
Running the Figma Plugin
- Open a Figma document
- Go to Plugins → Development → MCP Figma Write Bridge
- The plugin runs with a hidden UI to establish the WebSocket connection
- You should see
[bridge] Plugin connectedin the server logs
Connecting Your AI Client
Configure your MCP client (e.g., VS Code) to use this server:
{
"mcpServers": {
"figma-write": {
"command": "node",
"args": [
"--loader",
"tsx",
"/path/to/figma-mcp-write-bridge/server.ts"
]
}
}
}
Or using npm:
{
"mcpServers": {
"figma-write": {
"command": "npm",
"args": ["start"],
"cwd": "/path/to/figma-mcp-write-bridge"
}
}
}
Available Tools
Creation Tools
create_frame- Create a new framecreate_rectangle- Create a rectangle with optional corner radiuscreate_ellipse- Create an ellipsecreate_line- Create a linecreate_polygon- Create a polygon with specified number of sidescreate_star- Create a star shapeadd_text- Add text with font stylingplace_image_base64- Place an image from base64 data
Node Management
find_nodes- Find nodes by name or typeselect_nodes- Select specific nodesget_selection- Get currently selected nodesrename_node- Rename a nodedelete_node- Delete a nodeduplicate_node- Duplicate a noderesize_node- Resize a noderotate_node- Rotate a nodeset_position- Set absolute positiongroup_nodes- Group multiple nodesungroup- Ungroup a group node
Styling
set_fill- Set fill colorset_stroke- Configure stroke propertiesset_corner_radius- Set corner radius (uniform or per-corner)set_opacity- Set opacityset_blend_mode- Set blend modeadd_effect- Add visual effects (shadows, blurs)clear_effects- Remove all effects
Layout
layout_grid_add- Add layout gridlayout_grid_clear- Clear layout gridsset_auto_layout- Configure Auto Layoutset_constraints- Set child constraints
Text
set_text_content- Edit text contentset_text_style- Apply text stylingset_text_color- Set text color
Components
create_component- Create a componentcreate_instance- Create component instancedetach_instance- Detach instance from component
Advanced
boolean_op- Boolean operations on vector nodesexport_node- Export as PNG/JPG/SVGset_plugin_data/get_plugin_data- Store/retrieve JSON data
Example Usage
Once connected, you can ask your AI assistant to:
"Create a blue rectangle 200x100 at position 50,50"
"Add a text saying 'Hello World' with Arial font size 24"
"Group the selected nodes and name it 'Header'"
"Export the frame as PNG"
or even:
"Create a full landing page design with both desktop and mobile layouts with the theme ... and describe the idea in mind"
The AI will use the appropriate MCP tools to execute these operations in your Figma document.
Development
Project Structure
figma-mcp-write-bridge/
├── server.ts # MCP server & WebSocket bridge
├── plugin/
│ ├── plugin.js # Figma plugin implementation
│ ├── ui.html # Hidden UI for WebSocket access
│ └── manifest.json # Plugin manifest
├── package.json
└── tsconfig.json
Adding New Tools
-
Implement the action in
plugin/plugin.js:async function myNewAction(input) { const { param1, param2 } = input; // Figma API operations return { result: "success" }; } -
Add to the dispatcher in
handleAction():case "my_new_action": return myNewAction(input); -
Register the MCP tool in
server.ts:registerTool( "my_new_tool", z.object({ param1: z.string(), param2: z.number() }), "Description of what this tool does", "my_new_action" );
Debugging
- Server logs: Check stderr output from
npm start - Plugin logs: Open Figma → Plugins → Development → Open Console
- WebSocket connection: Look for
[bridge] Plugin connectedmessage - Timeouts: Default 15s timeout for operations (configurable in
sendToPlugin())
Limitations
- Single client connection (one plugin instance at a time)
- Operations must complete within 15 seconds
- Requires Figma desktop app or browser access
- Network access must be allowed in Figma plugin settings
Troubleshooting
"Figma plugin not connected" error
- Ensure the Figma plugin is running (Plugins → Development → MCP Figma Write Bridge)
- Check that the server is running (
npm start) - Verify WebSocket connection logs
Plugin times out
- Check Figma console for errors
- Ensure the action is implemented in
plugin.js - Verify the
replyToid matches in responses
Font loading errors
- Font must be available in Figma
- Font name and style must match exactly
- Text operations automatically load fonts before modification
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly with a running Figma instance
- Submit a pull request
License
MIT License - see LICENSE file for details
Acknowledgments
- Built with the Model Context Protocol SDK
- Uses Figma Plugin API
Support
For issues, questions, or feature requests, please open an issue on GitHub.
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.