Skip to content
Open
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ebb02a8
feat: Add Figma server configuration and dependencies
jeevanpillay May 27, 2025
c352e21
feat: Implement Figma MCP server with WebSocket integration for real-…
jeevanpillay May 27, 2025
d9a86c7
feat: Enhance Figma MCP plugin with WebSocket support and UI improvem…
jeevanpillay May 27, 2025
7355c3a
fix: Update WebSocket configuration for Figma MCP plugin and server
jeevanpillay May 27, 2025
32d4356
feat: Implement plugin status request and response handling in Figma MCP
jeevanpillay May 27, 2025
48c2665
refactor: Improve server startup logging and error handling in Figma MCP
jeevanpillay May 28, 2025
6d72fec
refactor: Simplify Figma MCP plugin and server for basic functionality
jeevanpillay May 28, 2025
78cb012
feat: Enhance Figma MCP plugin and server with comprehensive WebSocke…
jeevanpillay May 28, 2025
e8cc62b
feat: Revamp Figma MCP plugin and server for socket communication
jeevanpillay May 28, 2025
3ce79cf
feat: Remove bridge server and refactor Figma MCP plugin for improved…
jeevanpillay May 28, 2025
003c7f5
feat: Transition Figma MCP plugin to WebSocket server architecture
jeevanpillay May 28, 2025
584688e
refactor: Remove Figma MCP server and related configurations
jeevanpillay May 28, 2025
19cd79c
feat: Add WebSocket mock server and related configurations
jeevanpillay May 28, 2025
41880bc
feat: Transition Figma MCP plugin to WebSocket client architecture
jeevanpillay May 28, 2025
b73948a
refactor: Simplify Figma MCP plugin by removing WebSocket client impl…
jeevanpillay May 28, 2025
ba7a87a
feat: Enhance WebSocket mock server with automatic startup and config…
jeevanpillay May 28, 2025
be6400d
refactor: Streamline Figma MCP server startup and configuration
jeevanpillay May 28, 2025
0b07dde
feat: Enhance Figma plugin messaging with additional status updates
jeevanpillay May 28, 2025
5608d45
feat: Implement WebSocket server signal handling and cleanup
jeevanpillay May 28, 2025
892665b
feat: Enhance Figma plugin WebSocket messaging and error handling
jeevanpillay May 28, 2025
53e78bb
feat: Update Figma server messaging and testing enhancements
jeevanpillay May 28, 2025
263d1e4
refactor: Remove Figma WebSocket test client and update server tools
jeevanpillay May 28, 2025
da7b074
feat: Implement JavaScript code execution in Figma plugin
jeevanpillay May 28, 2025
f6a2645
refactor: Optimize JavaScript code execution in Figma plugin
jeevanpillay May 28, 2025
d95f5dc
feat: Add WebSocket dependency for Figma server integration
jeevanpillay May 29, 2025
b61a78a
refactor: Clean up unused request_id retrieval in Figma WebSocket server
jeevanpillay May 29, 2025
c4e8642
Implement Figma MCP server with WebSocket-based plugin integration
cursoragent May 29, 2025
7ca42b6
feat: Add Figma plugin installation and interface images
jeevanpillay May 29, 2025
ca35a47
Merge pull request #39 from lightfastai/cursor/add-figma-docs-to-docs…
jeevanpillay May 29, 2025
be37a9a
refactor: Improve error handling and add server status functionality …
jeevanpillay May 29, 2025
04948aa
refactor: Update Figma tools to remove deprecated functions and impro…
jeevanpillay May 29, 2025
469b807
refactor: Remove deprecated Figma test files and update related tests
jeevanpillay May 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions addons/figma/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Node
*.log
*.log.*
node_modules

out/
dist/
code.js
124 changes: 124 additions & 0 deletions addons/figma/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Lightfast MCP Figma Plugin

A Figma plugin that connects as a WebSocket client to the Lightfast MCP server for real-time design automation.

## Architecture

- **UI (ui.html)**: Handles the WebSocket connection to the MCP server
- **Plugin Code (code.ts)**: Handles Figma API interactions and design commands
- **Communication**: UI and plugin code communicate via `postMessage`

## Features

### WebSocket Connection
- Real WebSocket client implementation in the UI
- Automatic reconnection with exponential backoff
- Connection status monitoring
- Ping/pong heartbeat support

### Design Commands
- Create rectangles, circles, and text
- Delete selected elements
- Select all elements
- Get document information
- Real-time command execution from MCP server

### Document Information
- Current document and page details
- Selection information
- Viewport state
- Connection status

## Usage

1. **Load the Plugin**: Install and run the plugin in Figma
2. **Connect to Server**: Enter the MCP server URL (default: `ws://localhost:9003`) and click Connect
3. **Test Connection**: Use the test buttons to verify communication
4. **Execute Commands**: Commands can be executed locally or received from the MCP server

## WebSocket Protocol

### Client → Server Messages
```json
{
"type": "plugin_info",
"plugin_info": {
"name": "Lightfast MCP Figma Plugin",
"version": "1.0.0",
"capabilities": ["document_info", "design_commands"],
"platform": "figma"
}
}
```

### Server → Client Messages
```json
{
"type": "execute_design_command",
"command": "create rectangle",
"request_id": "12345"
}
```

### Response Messages
```json
{
"type": "design_command_response",
"request_id": "12345",
"result": {
"message": "Rectangle created successfully",
"created_node": {
"id": "node_id",
"name": "AI Created Rectangle",
"type": "RECTANGLE"
}
}
}
```

## Development

### Building
The plugin uses TypeScript. Compile with:
```bash
tsc
```

### Testing
1. Start the MCP server on `ws://localhost:9003`
2. Load the plugin in Figma
3. Connect to the server
4. Test commands and communication

## Configuration

### Network Access
The plugin requires network access to connect to the MCP server. Allowed domains are configured in `manifest.json`:
- `ws://localhost:9003` (default)
- `ws://localhost:8003` (alternative)

### Capabilities
- Document access: `dynamic-page`
- Editor type: `figma`
- Network access: WebSocket connections to localhost

## Error Handling

- Connection failures with retry logic
- Command execution error reporting
- Graceful disconnection handling
- UI error display and logging

## License

This plugin is part of the Lightfast MCP project and follows the same license terms.

## Support

For issues and support:
1. Check the main lightfast-mcp project documentation
2. Review server logs: `uv run lightfast-figma-server`
3. Test WebSocket connectivity: Use the standalone server for testing
4. Use the MCP orchestrator: `uv run lightfast-mcp-orchestrator start`
5. Check Figma console for plugin errors
6. Verify WebSocket server settings in plugin UI
Loading
Loading