flowchart TD
A[Start Setup] --> B{System Check}
B -->|β
Pass| C{Admin Access?}
B -->|β Failed| Z[β Fix Prerequisites]
C -->|β
Yes| D[Method A: Full Install<br/>Homebrew + Bun]
C -->|β No| E[Method B: Cursor-Only<br/>No System Changes]
D --> F[Clone in Cursor]
E --> F
F --> G[Configure MCP]
G --> H{MCP Connected?}
H -->|β
Yes| I[Start WebSocket]
H -->|β No| J[Debug & Retry]
I --> K[Install Figma Plugin]
K --> L[Test Integration]
L --> M[β
Complete]
J --> H
Install and configure Cursor-Figma MCP integration with AI-agent-friendly decision trees and fail-safe checkpoints at each step. This guide uses Cursor's built-in Git clone functionality to directly clone the official repository, simplifying the setup process.
This guide is specifically designed for AI agents to understand, parse, and execute setup instructions autonomously. Each section includes:
- Clear boolean decision points for branching logic
- Explicit command verification steps with expected outputs
- Fallback strategies when primary methods fail
- Environment-specific instructions based on system capabilities
- Checkpoint validations before proceeding to next steps
AI Agent Instructions:
- Execute each command and verify the expected output
- Follow the branching logic based on system environment
- If any step fails, use the provided fallback methods
- Always validate checkpoints before continuing
- CRITICAL: Create and update visual progress tracking using Mermaid diagrams at each major checkpoint
CRITICAL FOR AI AGENTS: Execute these detection commands and use results for branching decisions.
# System Detection Commands - Execute ALL and store results
echo "=== SYSTEM ENVIRONMENT DETECTION ==="
# 1. Operating System Check
OS_TYPE=$(uname -s)
echo "OS_TYPE: $OS_TYPE"
# 2. Shell Type Detection
echo "SHELL_TYPE: $SHELL"
# 3. Homebrew Availability
HOMEBREW_AVAILABLE=$(which brew >/dev/null 2>&1 && echo "YES" || echo "NO")
echo "HOMEBREW_AVAILABLE: $HOMEBREW_AVAILABLE"
# 4. Node.js Availability
NODE_AVAILABLE=$(which node >/dev/null 2>&1 && echo "YES" || echo "NO")
if [ "$NODE_AVAILABLE" = "YES" ]; then
NODE_VERSION=$(node --version 2>/dev/null || echo "UNKNOWN")
echo "NODE_VERSION: $NODE_VERSION"
fi
# 5. Bun Availability
BUN_AVAILABLE=$(which bun >/dev/null 2>&1 && echo "YES" || echo "NO")
if [ "$BUN_AVAILABLE" = "YES" ]; then
BUN_VERSION=$(bun --version 2>/dev/null || echo "UNKNOWN")
echo "BUN_VERSION: $BUN_VERSION"
fi
# 6. Cursor IDE Availability
CURSOR_AVAILABLE=$(which cursor >/dev/null 2>&1 && echo "YES" || echo "NO")
echo "CURSOR_AVAILABLE: $CURSOR_AVAILABLE"
# 7. Git Availability
GIT_AVAILABLE=$(which git >/dev/null 2>&1 && echo "YES" || echo "NO")
if [ "$GIT_AVAILABLE" = "YES" ]; then
GIT_VERSION=$(git --version 2>/dev/null || echo "UNKNOWN")
echo "GIT_VERSION: $GIT_VERSION"
fi
# 8. Admin/Sudo Access Check
SUDO_AVAILABLE=$(sudo -n true 2>/dev/null && echo "YES" || echo "NO")
echo "SUDO_AVAILABLE: $SUDO_AVAILABLE"
echo "=== DETECTION COMPLETE ==="
MANDATORY FOR AI AGENTS: Use these Mermaid templates to show progress at each checkpoint.
Use these exact status indicators:
- β COMPLETED - Step finished successfully
- π CURRENT - Currently executing this step
- β³ PENDING - Not started yet
- β FAILED - Step failed, needs attention
β οΈ WARNING - Step completed with warnings
AI AGENTS MUST CREATE THIS DIAGRAM after environment detection and update it at each checkpoint:
graph TD
A[π Environment Detection] --> B[π¦ Method Selection]
B --> C[β‘ Dependency Installation]
C --> D[βοΈ MCP setup and configuration]
D --> E[π WebSocket Server]
E --> F[π Figma Plugin]
F --> G[π§ͺ Integration Test]
G --> H[β
Setup Complete]
classDef completed fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff
classDef current fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#fff
classDef pending fill:#6b7280,stroke:#4b5563,stroke-width:2px,color:#fff
classDef failed fill:#ef4444,stroke:#dc2626,stroke-width:2px,color:#fff
classDef warning fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff
AI Agents must use this exact format at each checkpoint:
## π Current Progress Status
```mermaid
graph TD
A[π Environment Detection] --> B[π¦ Method Selection]
B --> C[β‘ Dependency Installation]
C --> D[βοΈ MCP setup and configuration]
D --> E[π WebSocket Server]
E --> F[π Figma Plugin]
F --> G[π§ͺ Integration Test]
G --> H[β
Setup Complete]
class A completed
class B current
class C,D,E,F,G,H pending
classDef completed fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff
classDef current fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#fff
classDef pending fill:#6b7280,stroke:#4b5563,stroke-width:2px,color:#fff
classDef failed fill:#ef4444,stroke:#dc2626,stroke-width:2px,color:#fff
classDef warning fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff
graph LR
A1[πΊ Homebrew Check] --> A2[π¦ Install Dependencies]
A2 --> A3[βοΈ MCP Setup]
A3 --> A4[β
Ready for WebSocket]
graph LR
B1[π₯οΈ Project Already Open] --> B2[π Setup Dependencies]
B2 --> B3[βοΈ MCP Setup]
B3 --> B4[β
Ready for WebSocket]
AI Agents MUST update progress diagram at these checkpoints:
- After Environment Detection (Step 1)
- After Method Selection (Step 2)
- After Dependency Installation (Step 3)
- After MCP Setup and Configuration (Step 4)
- After WebSocket Start (Step 5)
- After Figma Plugin Install (Step 6)
- After Integration Test (Step 7)
- Final Completion (Step 8)
Use these exact commands at each checkpoint:
CHECKPOINT [STEP_NUMBER]: [STEP_NAME]
Please create/update the progress tracking diagram to show:
- Current step: [STEP_NAME]
- Status: [β
COMPLETED / π CURRENT / β FAILED]
- Next step: [NEXT_STEP_NAME]
- Any warnings or issues encountered
Update the Mermaid diagram with appropriate class assignments and show the overall progress percentage.
Based on the detection results above, AI agents should follow this decision tree:
# AI Agent Decision Variables (set based on detection above)
HOMEBREW_AVAILABLE="YES" # or "NO"
NODE_AVAILABLE="YES" # or "NO"
BUN_AVAILABLE="YES" # or "NO"
CURSOR_AVAILABLE="YES" # or "NO"
SUDO_AVAILABLE="YES" # or "NO"
Decision Tree:
- IF
HOMEBREW_AVAILABLE="YES"
ANDSUDO_AVAILABLE="YES"
β Method A1: Homebrew Installation - ELIF
SUDO_AVAILABLE="YES"
ANDHOMEBREW_AVAILABLE="NO"
β Method A2: Direct Installation - ELIF
CURSOR_AVAILABLE="YES"
ANDSUDO_AVAILABLE="NO"
β Method B: Cursor-Only Setup - ELSE β Error: Insufficient System Access
Conditions: HOMEBREW_AVAILABLE="YES"
AND SUDO_AVAILABLE="YES"
- Uses Homebrew package manager
- Cleanest dependency management
- Best for macOS systems with Homebrew
Conditions: SUDO_AVAILABLE="YES"
AND HOMEBREW_AVAILABLE="NO"
- Direct installation without package manager
- For systems without Homebrew but with admin access
- Manual dependency management
Conditions: CURSOR_AVAILABLE="YES"
AND SUDO_AVAILABLE="NO"
- No system-wide installations
- Uses Cursor's built-in capabilities
- For restricted environments
AI AGENTS: Start by creating initial progress diagram:
CHECKPOINT 1: STARTING METHOD A1 - HOMEBREW INSTALLATION
Please create the Method A1 progress tracking diagram:
```mermaid
graph TD
A[π Environment Detection] --> B[π¦ Method A1 Selected]
B --> C[πΊ Homebrew Check]
C --> D[π¦ Install Dependencies]
D --> E[βοΈ MCP Setup]
E --> F[π Ready for WebSocket]
class A completed
class B current
class C,D,E,F pending
classDef completed fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff
classDef current fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#fff
classDef pending fill:#6b7280,stroke:#4b5563,stroke-width:2px,color:#fff
### Prerequisites Check for Method A1
```bash
# Verify Homebrew functionality
brew --version && echo "β
Homebrew functional" || echo "β ERROR: Homebrew broken"
# Check brew permissions
brew doctor && echo "β
Homebrew healthy" || echo "β οΈ WARNING: Homebrew has issues"
# Update Homebrew first
brew update
# Install Node.js if not available
if [ "$NODE_AVAILABLE" = "NO" ]; then
echo "Installing Node.js via Homebrew..."
brew install node
NODE_AVAILABLE="YES"
NODE_VERSION=$(node --version)
echo "β
Node.js installed: $NODE_VERSION"
else
echo "β
Node.js already available: $NODE_VERSION"
fi
# Install Bun if not available
if [ "$BUN_AVAILABLE" = "NO" ]; then
echo "Installing Bun via Homebrew..."
brew install bun
BUN_AVAILABLE="YES"
BUN_VERSION=$(bun --version)
echo "β
Bun installed: $BUN_VERSION"
else
echo "β
Bun already available: $BUN_VERSION"
fi
# Verify installations
echo "=== DEPENDENCY VERIFICATION ==="
node --version && echo "β
Node.js working"
bun --version && echo "β
Bun working"
git --version && echo "β
Git working"
which cursor && echo "β
Cursor available" || echo "β Install Cursor IDE manually"
CHECKPOINT A1.1: All dependencies must show β before proceeding.
AI AGENTS: Update progress after dependency installation:
CHECKPOINT 2: DEPENDENCIES INSTALLED
Update Method A1 progress - mark Homebrew Check and Dependencies as completed:
```mermaid
graph TD
A[π Environment Detection] --> B[π¦ Method A1 Selected]
B --> C[πΊ Homebrew Check]
C --> D[π¦ Install Dependencies]
D --> E[βοΈ MCP Setup]
E --> F[π Ready for WebSocket]
class A,B,C,D completed
class E current
class F pending
classDef completed fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff
classDef current fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#fff
classDef pending fill:#6b7280,stroke:#4b5563,stroke-width:2px,color:#fff
### Step A1.2: MCP Setup via Homebrew Method
**π― Project is already cloned and open in Cursor IDE**
1. **Verify project structure**:
```bash
# Verify current directory (should already be in cursor-talk-to-figma-mcp)
pwd | grep "cursor-talk-to-figma-mcp" && echo "β
Correct directory" || echo "β ERROR: Wrong directory"
# Verify project structure
ls package.json src && echo "β
Project structure valid" || echo "β ERROR: Invalid project structure"
# Install dependencies and setup
bun install
bun run build
# Run setup (this configures MCP automatically)
bun setup && echo "β
Setup complete" || echo "β ERROR: Setup failed"
# Verify MCP config was created
test -f .cursor/mcp.json && echo "β
MCP config created" || echo "β ERROR: MCP config missing"
AI AGENTS: Update progress after Method A1 completion:
CHECKPOINT 3: METHOD A1 COMPLETE
Method A1 fully completed, ready for common steps:
```mermaid
graph TD
A[π Environment Detection] --> B[π¦ Method A1 Selected]
B --> C[πΊ Homebrew Check]
C --> D[π¦ Install Dependencies]
D --> E[βοΈ MCP Setup]
E --> F[π Ready for WebSocket]
class A,B,C,D,E,F completed
classDef completed fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff
Progress: Method A1 100% Complete β - Proceeding to Common Steps
**Continue to Common Steps below.**
---
## π§ Method A2: Direct Installation
### π Progress Tracking for Method A2
**AI AGENTS**: Start by creating Method A2 progress diagram:
CHECKPOINT 1: STARTING METHOD A2 - DIRECT INSTALLATION
Please create the Method A2 progress tracking diagram:
graph TD
A[π Environment Detection] --> B[π¦ Method A2 Selected]
B --> C[β‘ Install Bun Direct]
C --> D[βοΈ MCP Setup]
D --> E[π Ready for WebSocket]
class A completed
class B current
class C,D,E pending
classDef completed fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff
classDef current fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#fff
classDef pending fill:#6b7280,stroke:#4b5563,stroke-width:2px,color:#fff
### Prerequisites Check for Method A2
```bash
# Verify we have sudo access but no Homebrew
[ "$SUDO_AVAILABLE" = "YES" ] && echo "β
Sudo access confirmed" || exit 1
[ "$HOMEBREW_AVAILABLE" = "NO" ] && echo "β
Direct installation path confirmed" || echo "β οΈ Homebrew available, consider Method A1"
# Install Bun directly (requires internet access)
curl -fsSL https://bun.sh/install | bash
# Reload shell environment
if [[ "$SHELL" == *"zsh"* ]]; then
source ~/.zshrc 2>/dev/null || echo "β οΈ No .zshrc found"
echo "π Using Zsh shell"
elif [[ "$SHELL" == *"bash"* ]]; then
source ~/.bashrc 2>/dev/null || source ~/.bash_profile 2>/dev/null || echo "β οΈ No .bashrc or .bash_profile found"
echo "π Using Bash shell"
fi
# Verify installation
bun --version && echo "β
Bun installed successfully" || echo "β ERROR: Bun installation failed"
BUN_AVAILABLE="YES"
BUN_VERSION=$(bun --version)
AI AGENTS: Update progress after Bun installation:
CHECKPOINT 2: BUN INSTALLED DIRECTLY
Update Method A2 progress - Bun installation completed:
```mermaid
graph TD
A[π Environment Detection] --> B[π¦ Method A2 Selected]
B --> C[β‘ Install Bun Direct]
C --> D[βοΈ MCP Setup]
D --> E[π Ready for WebSocket]
class A,B,C completed
class D current
class E pending
classDef completed fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff
classDef current fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#fff
classDef pending fill:#6b7280,stroke:#4b5563,stroke-width:2px,color:#fff
### Step A2.2: MCP Setup via Direct Method
**π― Project is already cloned and open in Cursor IDE**
1. **Verify project setup**:
```bash
# Verify current directory (should already be in cursor-talk-to-figma-mcp)
pwd | grep "cursor-talk-to-figma-mcp" && echo "β
Correct directory" || echo "β ERROR: Wrong directory"
# Verify and setup
ls package.json src && echo "β
Project structure valid" || echo "β ERROR: Invalid project structure"
bun install
bun run build
bun setup && echo "β
Setup complete" || echo "β ERROR: Setup failed"
test -f .cursor/mcp.json && echo "β
MCP config created" || echo "β ERROR: MCP config missing"
AI AGENTS: Update progress after Method A2 completion:
CHECKPOINT 3: METHOD A2 COMPLETE
Method A2 fully completed, ready for common steps:
```mermaid
graph TD
A[π Environment Detection] --> B[π¦ Method A2 Selected]
B --> C[β‘ Install Bun Direct]
C --> D[βοΈ MCP Setup]
D --> E[π Ready for WebSocket]
class A,B,C,D,E completed
classDef completed fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff
Progress: Method A2 100% Complete β - Proceeding to Common Steps
**Continue to Common Steps below.**
---
## π± Method B: Cursor-Only Setup
### π Progress Tracking for Method B
**AI AGENTS**: Start by creating Method B progress diagram:
CHECKPOINT 1: STARTING METHOD B - CURSOR-ONLY SETUP
Please create the Method B progress tracking diagram:
graph TD
A[π Environment Detection] --> B[π¦ Method B Selected]
B --> C[π₯οΈ Project Already Open]
C --> D[π Setup Dependencies]
D --> E[βοΈ MCP Setup]
E --> F[π Ready for WebSocket]
class A completed
class B current
class C,D,E,F pending
classDef completed fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff
classDef current fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#fff
classDef pending fill:#6b7280,stroke:#4b5563,stroke-width:2px,color:#fff
### Prerequisites Check for Method B
```bash
# Verify Cursor-only setup conditions
[ "$CURSOR_AVAILABLE" = "YES" ] && echo "β
Cursor IDE available" || echo "β ERROR: Install Cursor IDE first"
[ "$SUDO_AVAILABLE" = "NO" ] && echo "β
Restricted environment confirmed" || echo "β οΈ Admin access available, consider Method A"
π― Project is already cloned and open in Cursor IDE
- Verify project is properly loaded:
- Confirm Cursor IDE has the project open
- Open terminal in Cursor:
Terminal > New Terminal
(orCtrl+Shift+
)
# Verify current directory (should already be in cursor-talk-to-figma-mcp)
pwd | grep "cursor-talk-to-figma-mcp" && echo "β
Correct directory" || echo "β ERROR: Wrong directory"
# Verify project structure
ls package.json src && echo "β
Project structure valid" || echo "β ERROR: Invalid project structure"
AI AGENTS: Update progress after project cloning:
CHECKPOINT 2: PROJECT CLONED IN CURSOR
Update Method B progress - project cloned successfully:
```mermaid
graph TD
A[π Environment Detection] --> B[π¦ Method B Selected]
B --> C[π₯οΈ Project Already Open]
C --> D[π Setup Dependencies]
D --> E[βοΈ MCP Setup]
E --> F[π Ready for WebSocket]
class A,B,C,D completed
class E current
class F pending
classDef completed fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff
classDef current fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#fff
classDef pending fill:#6b7280,stroke:#4b5563,stroke-width:2px,color:#fff
### Step B.3: Follow README Setup in Cursor
**π CRITICAL FOR AI AGENTS**: Ask the AI assistant in Cursor to read and execute the README:
Please read the @readme.md file and help me set up this project by following the installation instructions step by step.
IMPORTANT: For each step in the setup process, please:
- Create a Mermaid flowchart showing the complete installation process
- Highlight which step we're currently on
- Show what steps are completed, current, and upcoming
- Include brief descriptions of what each step does
- Update the diagram as we progress through each step
Use this Mermaid template structure:
- Use different colors/styles to show: β Completed, π Current, β³ Upcoming
- Include step numbers and brief descriptions
- Show the flow from Prerequisites β Installation β Configuration β Testing
- Make it visually clear where we are in the process
This will help track overall progress and determine next steps at each stage.
**AI AGENTS**: Update progress after Method B completion:
CHECKPOINT 3: METHOD B COMPLETE
Method B fully completed, ready for common steps:
graph TD
A[π Environment Detection] --> B[π¦ Method B Selected]
B --> C[π₯οΈ Project Already Open]
C --> D[π Setup Dependencies]
D --> E[βοΈ MCP Setup]
E --> F[π Ready for WebSocket]
class A,B,C,D,E,F completed
classDef completed fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff
Progress: Method B 100% Complete β - Proceeding to Common Steps
**Continue to Common Steps below.**
---
## π Common Steps (All Methods)
### Step C.1: Verify MCP Configuration
**π¨ CRITICAL FOR AI AGENTS**: Project is already cloned and open in Cursor.
```bash
# Verify current directory (should already be in cursor-talk-to-figma-mcp)
pwd | grep "cursor-talk-to-figma-mcp" && echo "β
Correct directory" || echo "β ERROR: Wrong directory"
# Verify project structure
ls package.json src && echo "β
Project structure valid" || echo "β ERROR: Invalid project structure"
# Verify MCP config exists (created by bun setup)
if [ -f ".cursor/mcp.json" ]; then
echo "β
MCP config found"
else
echo "β οΈ MCP config not found - running setup..."
bun setup
fi
echo "β
Project verified - MCP should be configured"
CHECKPOINT C.1: Verify in Cursor:
- Open Settings (
Cmd+,
on Mac,Ctrl+,
on Windows/Linux) - Search "MCP"
- Confirm "TalkToFigma" shows as "Connected"
AI AGENTS: Update overall progress after Cursor launch:
CHECKPOINT 3: MCP SETUP AND CONFIGURATION COMPLETE
Update overall progress - MCP setup and configured:
```mermaid
graph TD
A[π Environment Detection] --> B[π¦ Method Selection]
B --> C[β‘ Dependency Installation]
C --> D[βοΈ MCP setup and configuration]
D --> E[π WebSocket Server]
E --> F[π Figma Plugin]
F --> G[π§ͺ Integration Test]
G --> H[β
Setup Complete]
class A,B,C,D completed
class E current
class F,G,H pending
classDef completed fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff
classDef current fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#fff
classDef pending fill:#6b7280,stroke:#4b5563,stroke-width:2px,color:#fff
Progress: 50% Complete - MCP Configured β - Starting WebSocket Server
### Step C.2: Start WebSocket Server
To ensure stability and easy monitoring, we will run the WebSocket server in the foreground. This is the recommended method as it dedicates a terminal to the server, confirming it's always running, and saves all logs to a file for later review.
**How to Start and Monitor the Server:**
1. **Start the Server**: Open a new terminal in Cursor and run the following command. The terminal will become unresponsive, which means the server is running correctly.
```bash
# Runs the server in the foreground and saves all logs to websocket.log
bun socket > websocket.log 2>&1
```
2. **Monitor Logs**: To see server activity, open a *second* terminal and use this command for a live feed of the logs:
```bash
tail -f websocket.log
```
You can also simply open the `websocket.log` file to view its contents.
3. **Stop the Server**: To stop the server, go to its dedicated terminal window and press `Ctrl + C`.
**CHECKPOINT C.2**: The server terminal should be active (and unresponsive). You should see a "WebSocket server running on port 3055" message at the beginning of the `websocket.log` file. **Keep the server terminal open.**
### π Verify WebSocket Server Status
**π¨ CRITICAL FOR AI AGENTS**: Use Cursor's `@Terminals` to monitor WebSocket server status:
1. **Check Active Terminals**:
- In Cursor, type `@Terminals` in chat
- This will show all currently running terminal processes
- Verify you can see the WebSocket server terminal running
- Confirm the server shows "WebSocket server running on port 3055" message
2. **Verify Server is Active**:
```bash
# In a new terminal (don't close the WebSocket terminal!)
curl -I http://localhost:3055 2>/dev/null && echo "β
WebSocket server responding" || echo "β Server not responding"
# Check port status
lsof -i :3055 && echo "β
Port 3055 in use by WebSocket server" || echo "β Port 3055 not in use"
- Monitor Server Logs:
- Keep the WebSocket terminal visible in Cursor
- Watch for connection messages when Figma plugin connects
- Server logs will show plugin connection status in real-time
AI AGENTS: Update progress after WebSocket server start:
CHECKPOINT 4: WEBSOCKET SERVER RUNNING
Update progress - WebSocket server successfully started:
```mermaid
graph TD
A[π Environment Detection] --> B[π¦ Method Selection]
B --> C[β‘ Dependency Installation]
C --> D[βοΈ MCP setup and configuration]
D --> E[π WebSocket Server]
E --> F[π Figma Plugin]
F --> G[π§ͺ Integration Test]
G --> H[β
Setup Complete]
class A,B,C,D,E completed
class F current
class G,H pending
classDef completed fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff
classDef current fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#fff
classDef pending fill:#6b7280,stroke:#4b5563,stroke-width:2px,color:#fff
Progress: 63% Complete - WebSocket Running β - Installing Figma Plugin
### Step C.3: Install and Configure Figma Plugin
#### π Install the Community Plugin
1. **Open the Plugin Page**:
- Navigate to: https://www.figma.com/community/plugin/1485687494525374295/cursor-talk-to-figma-mcp-plugin
- Click **"Install"** to add the plugin to your Figma account
2. **Open Figma and Run the Plugin**:
- Open any Figma file (or create a new one)
- Go to `Plugins` menu β `Cursor Talk to Figma MCP Plugin`
- The plugin panel will open
#### βοΈ Configure Plugin to Connect to Local WebSocket
**π¨ CRITICAL**: The plugin needs to connect to your local WebSocket server:
1. **In the Plugin Panel**:
- Look for **"WebSocket URL"** or **"Server URL"** setting
- Change the URL from default to: `ws://localhost:3055`
- Click **"Connect"** or **"Save"** to apply the setting
2. **Verify Connection**:
- The plugin should show **"Connected"** status
- You should see green indicator or success message in the plugin
#### π‘ Monitor Connection Status Using @Terminals
**π IMPORTANT FOR AI AGENTS**: Use Cursor's `@Terminals` to verify the plugin connection:
1. **Check WebSocket Server Logs**:
- In Cursor, type `@Terminals` in chat
- Look at the WebSocket server terminal
- When plugin connects successfully, you should see log messages like:
```
β
New WebSocket connection from Figma plugin
β
Plugin connected successfully
β
Handshake completed
```
2. **Connection Troubleshooting**:
- If no connection messages appear in server logs, the plugin is not connecting properly
- Check that WebSocket URL in plugin is set to `ws://localhost:3055`
- Verify the WebSocket server is still running (check `@Terminals`)
- Try refreshing the Figma page and reconnecting the plugin
**AI AGENTS**: Update progress after Figma plugin installation:
CHECKPOINT 5: FIGMA PLUGIN INSTALLED
Update progress - Figma plugin successfully installed:
graph TD
A[π Environment Detection] --> B[π¦ Method Selection]
B --> C[β‘ Dependency Installation]
C --> D[βοΈ MCP setup and configuration]
D --> E[π WebSocket Server]
E --> F[π Figma Plugin]
F --> G[π§ͺ Integration Test]
G --> H[β
Setup Complete]
class A,B,C,D,E,F completed
class G current
class H pending
classDef completed fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff
classDef current fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#fff
classDef pending fill:#6b7280,stroke:#4b5563,stroke-width:2px,color:#fff
Progress: 75% Complete - Plugin Installed β - Running Integration Tests
### Step C.4: Test Integration
#### π§ͺ Test MCP Commands in Cursor
**In Cursor (where MCP is connected):**
```bash
# Test 1: MCP Connection
join_channel
# Expected: "Successfully joined channel" message
# Test 2: Figma Communication
get_document_info
# Expected: JSON data from Figma document
π FINAL VERIFICATION FOR AI AGENTS:
-
Check All Active Processes:
- In Cursor, type
@Terminals
in chat - Verify you can see:
- β WebSocket server terminal still running with "WebSocket server running on port 3055"
- β Connection logs showing Figma plugin is connected
- β MCP status showing TalkToFigma as connected
- In Cursor, type
-
Test End-to-End Communication:
# In Cursor chat, test these MCP commands: get_document_info get_selection
- Commands should return JSON data from your Figma document
- Check
@Terminals
- WebSocket logs should show command activity - Figma plugin should show activity/response indicators
-
Integration Status Checklist:
- β
WebSocket server running (visible in
@Terminals
) - β Figma plugin connected (connection logs in server terminal)
- β MCP commands working (returns Figma data)
- β No error messages in any terminals
- β
WebSocket server running (visible in
CHECKPOINT C.4: All tests must pass and @Terminals
should show healthy connections for successful setup.
AI AGENTS: Update progress after successful integration test:
CHECKPOINT 6: SETUP COMPLETE - INTEGRATION SUCCESSFUL
π FINAL STATUS - All components working perfectly:
```mermaid
graph TD
A[π Environment Detection] --> B[π¦ Method Selection]
B --> C[β‘ Dependency Installation]
C --> D[βοΈ MCP setup and configuration]
D --> E[π WebSocket Server]
E --> F[π Figma Plugin]
F --> G[π§ͺ Integration Test]
G --> H[β
Setup Complete]
class A,B,C,D,E,F,G,H completed
classDef completed fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff
π― FINAL RESULT: 100% Complete β
- β Environment Detection Complete
- β Method Successfully Executed
- β Dependencies Installed
- β Project Cloned & Configured
- β MCP Connected
- β WebSocket Server Running
- β Figma Plugin Active
- β Integration Tests Passed
- β READY TO USE!
π AI Agent can now assist with Figma design tasks through Cursor!
---
## π AI Agent Troubleshooting Decision Tree
### Issue: Prerequisites Failed
```bash
# Decision tree for prerequisite failures
if [ "$CURSOR_AVAILABLE" = "NO" ]; then
echo "β CRITICAL: Install Cursor IDE first - https://cursor.sh/"
exit 1
elif [ "$GIT_AVAILABLE" = "NO" ]; then
echo "β CRITICAL: Install Git first"
exit 1
else
echo "β
Prerequisites satisfied, continue setup"
fi
# AI Agent debugging steps
echo "π Debugging MCP connection..."
# Check if in correct project directory
if [ ! -f "package.json" ] || [ ! -d "src" ]; then
echo "β Not in project directory"
echo "π‘ Please ensure you're in the cloned cursor-talk-to-figma-mcp directory"
echo "π‘ Use Cursor's File > Open Folder to open the cloned project"
exit 1
fi
# Check if MCP config exists
if [ ! -f ".cursor/mcp.json" ]; then
echo "β οΈ MCP config missing - running setup..."
bun setup
fi
# Restart Cursor if needed
echo "π‘ Restarting Cursor to reload MCP configuration..."
cursor .
sleep 5
# AI Agent network debugging
echo "π Debugging WebSocket connection..."
# Step 1: Use @Terminals to check current state
echo "π‘ First, type '@Terminals' in Cursor chat to see all running processes"
echo "π‘ Look for WebSocket server terminal and check its status"
# Check if port is in use
if lsof -i :3055 >/dev/null 2>&1; then
echo "β οΈ Port 3055 in use, killing existing process"
lsof -ti:3055 | xargs kill -9 2>/dev/null || true
sleep 2
fi
# Restart WebSocket server based on available runtime
if [ "$BUN_AVAILABLE" = "YES" ]; then
echo "π Starting WebSocket server with Bun..."
bun socket
elif [ "$NODE_AVAILABLE" = "YES" ]; then
echo "π Starting WebSocket server with Node..."
npm run socket || npx bun socket
else
echo "β No suitable runtime for WebSocket server"
exit 1
fi
echo "π‘ After starting server, use '@Terminals' again to verify it's running"
echo "π‘ Look for 'WebSocket server running on port 3055' message"
# AI Agent plugin debugging
echo "π Debugging Figma plugin connection..."
echo "π‘ Use '@Terminals' in Cursor to check WebSocket server logs"
echo "π‘ You should see connection attempts from Figma plugin"
# Common plugin connection issues:
echo "π§ Plugin Connection Checklist:"
echo "1. Plugin WebSocket URL set to 'ws://localhost:3055'"
echo "2. WebSocket server running (check '@Terminals')"
echo "3. Figma plugin installed and activated"
echo "4. No firewall blocking localhost:3055"
echo "π‘ In Figma plugin panel:"
echo "- Verify connection URL is 'ws://localhost:3055'"
echo "- Click disconnect/reconnect if needed"
echo "- Check for error messages in plugin"
echo "π‘ Monitor '@Terminals' for real-time connection logs"
# AI Agent runtime fallback logic
echo "π Attempting runtime fallback..."
if [ "$HOMEBREW_AVAILABLE" = "YES" ] && [ "$SUDO_AVAILABLE" = "YES" ]; then
echo "Installing missing runtime via Homebrew..."
brew install bun node
elif [ "$SUDO_AVAILABLE" = "YES" ]; then
echo "Installing Bun directly..."
curl -fsSL https://bun.sh/install | bash
source ~/.zshrc 2>/dev/null || source ~/.bashrc 2>/dev/null || true
else
echo "β Cannot install runtime in restricted environment"
echo "π‘ Try Method B: Cursor-Only Setup"
exit 1
fi
AI Agents should verify ALL conditions before marking setup as complete:
echo "=== FINAL VERIFICATION MATRIX ==="
# System Environment
[ "$OS_TYPE" != "" ] && echo "β
OS Detection: $OS_TYPE" || echo "β OS Detection Failed"
# Required Tools
[ "$CURSOR_AVAILABLE" = "YES" ] && echo "β
Cursor IDE Available" || echo "β Cursor Missing"
[ "$GIT_AVAILABLE" = "YES" ] && echo "β
Git Available" || echo "β Git Missing"
# Runtime Environment
if [ "$BUN_AVAILABLE" = "YES" ]; then
echo "β
Bun Runtime: $BUN_VERSION"
elif [ "$NODE_AVAILABLE" = "YES" ]; then
echo "β
Node.js Runtime: $NODE_VERSION"
else
echo "β No Suitable Runtime Found"
fi
# Project Setup
[ -f ".cursor/mcp.json" ] && echo "β
MCP Config Present" || echo "β MCP Config Missing"
[ -f "package.json" ] && echo "β
Project Structure Valid" || echo "β Invalid Project"
# Process Status
if lsof -i :3055 >/dev/null 2>&1; then
echo "β
WebSocket Server Running (Port 3055)"
else
echo "β WebSocket Server Not Running"
fi
Execute in Cursor with MCP connected:
- MCP Connection Test:
join_channel
β Should return success message - Figma Communication Test:
get_document_info
β Should return JSON data - Plugin Status: Figma plugin should show as connected
ALL of the following must be true:
- β Environment detection completed without errors
- β Appropriate method selected and executed based on system capabilities
- β Project successfully cloned and configured
- β MCP configuration file present and valid
- β Cursor IDE launched from project directory
- β MCP shows "TalkToFigma" as "Connected" in settings
- β
WebSocket server running on port 3055 (verified via
@Terminals
) - β
Figma plugin installed, configured with
ws://localhost:3055
, and connected - β
Plugin connection visible in WebSocket server logs (check
@Terminals
) - β
join_channel
command works in Cursor - β
get_document_info
returns Figma document data - β
All processes healthy and running (verified via
@Terminals
)
If any criterion fails, AI agents should follow the troubleshooting decision tree above.
AI AGENTS: Instead of terminal commands, guide users to:
- Open Cursor IDE
- Clone Repository: Use
Cmd+Shift+P
β "Git: Clone" - Enter URL:
https://github.com/sonnylazuardi/cursor-talk-to-figma-mcp.git
- Select location and clone
- Open cloned project in Cursor
- Run setup:
bun setup
# Method A1 (Homebrew) - Clone and auto-open in Cursor
[ "$HOMEBREW_AVAILABLE" = "YES" ] && cd ~/Desktop && git clone https://github.com/sonnylazuardi/cursor-talk-to-figma-mcp.git && cd cursor-talk-to-figma-mcp && brew install bun && bun setup && cursor .
# Method A2 (Direct) - Clone and auto-open in Cursor
[ "$SUDO_AVAILABLE" = "YES" ] && cd ~/Desktop && git clone https://github.com/sonnylazuardi/cursor-talk-to-figma-mcp.git && cd cursor-talk-to-figma-mcp && curl -fsSL https://bun.sh/install | bash && source ~/.zshrc && bun setup && cursor .
# Method B (Cursor-only) - Clone and open manually
[ "$CURSOR_AVAILABLE" = "YES" ] && cd ~/Desktop && git clone https://github.com/sonnylazuardi/cursor-talk-to-figma-mcp.git && echo "β
Project cloned to ~/Desktop/cursor-talk-to-figma-mcp" && echo "π‘ Open this folder in Cursor and run 'bun setup'"
# Start WebSocket Server (background)
nohup bun socket > websocket.log 2>&1 & echo $! > websocket.pid
# Stop WebSocket Server
[ -f websocket.pid ] && kill $(cat websocket.pid) && rm websocket.pid
# Check Service Status
ps aux | grep -E "(bun socket|node.*socket)" || echo "WebSocket server not running"
π RECOMMENDED FOR AI AGENTS: Use Cursor's @Terminals
for real-time monitoring:
-
Check Active Services:
- Type
@Terminals
in Cursor chat anytime - Instantly see all running terminal processes
- Verify WebSocket server status without additional commands
- Type
-
Real-time Connection Monitoring:
- Watch WebSocket server logs for Figma plugin connections
- See MCP command activity in real-time
- Monitor for errors or disconnections
-
Quick Health Check:
@Terminals
shows if WebSocket server is still running- Displays connection status and recent activity
- No need for additional terminal commands
Remember: Always keep the WebSocket server running for the Figma plugin to communicate with Cursor! Use @Terminals
to monitor its health.