@fridaplatform-stk/figma2frida-mcp 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -152
- package/dist/figma2frida.js +598 -966
- package/dist/figma2frida.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,216 +1,176 @@
|
|
|
1
1
|
# Figma2Frida MCP Server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> AI-powered bridge between Figma designs and your organization's design system components
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 🎯 What Is Figma2Frida?
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**Figma2Frida MCP Server** is a bridge that connects your AI coding assistant (Claude, Cursor, GitHub Copilot) with Figma designs and your organization's design system. It enables you to:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- **Generate production-ready code** directly from Figma designs
|
|
10
|
+
- **Automatically use components** from your design system library
|
|
11
|
+
- **Match components intelligently** using AI-powered semantic search
|
|
12
|
+
- **Preserve exact layouts** - spacing, alignment, and visual hierarchy from Figma
|
|
13
|
+
- **Get component documentation** - props, types, and usage examples included
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
- 🔍 **Pinecone Search**: Semantic search for design system components
|
|
13
|
-
- 🤖 **Frida AI**: Intelligent component recommendations
|
|
14
|
-
- 🎨 **Component Suggestions**: Suggests matching components based on Figma designs
|
|
15
|
-
- 📸 **Screenshot Support**: Get visual screenshots from Figma
|
|
16
|
-
- 🚀 **Fast Code Generation**: Optimized for rapid code generation
|
|
15
|
+
### Available Tools
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
Your AI assistant gets four specialized tools:
|
|
19
18
|
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
19
|
+
1. **`figma_get_design_context`** - Generate code from Figma with automatic component matching *(main tool)*
|
|
20
|
+
2. **`figma_suggest_components`** - Browse and discover design system components
|
|
21
|
+
3. **`figma_get_screenshot`** - Quick visual reference from Figma
|
|
22
|
+
4. **`figma_improve_layout`** - Fine-tune generated code to match Figma exactly
|
|
24
23
|
|
|
25
|
-
##
|
|
24
|
+
## 🔄 How It Works
|
|
26
25
|
|
|
27
|
-
```bash
|
|
28
|
-
# Clone the repository
|
|
29
|
-
git clone <your-repo-url>
|
|
30
|
-
cd figma2frida_mcp
|
|
31
|
-
|
|
32
|
-
# Install dependencies
|
|
33
|
-
npm install
|
|
34
|
-
|
|
35
|
-
# Build the project
|
|
36
|
-
npm run build
|
|
37
26
|
```
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
# Pinecone Configuration
|
|
47
|
-
PINECONE_API_KEY=your_pinecone_api_key_here
|
|
48
|
-
PINECONE_INDEX_NAME=your_index_name
|
|
49
|
-
# PINECONE_NAMESPACE is passed as argument (not in .env)
|
|
50
|
-
|
|
51
|
-
# Frida AI Configuration
|
|
52
|
-
FRIDA_BEARER_TOKEN=your_frida_bearer_token_here
|
|
53
|
-
FRIDA_BASE_URL=https://api.frida.ai
|
|
54
|
-
|
|
55
|
-
# Server Configuration (optional)
|
|
56
|
-
HTTP_STREAM=true # Set to true for HTTP mode, false for stdio
|
|
57
|
-
PORT=8080 # Port for HTTP stream mode
|
|
27
|
+
1. Select design in Figma
|
|
28
|
+
↓
|
|
29
|
+
2. Ask your AI: "Generate code for this design"
|
|
30
|
+
↓
|
|
31
|
+
3. MCP fetches design → Searches your component library → Uses Frida AI
|
|
32
|
+
↓
|
|
33
|
+
4. Get production-ready code with your design system components
|
|
58
34
|
```
|
|
59
35
|
|
|
60
|
-
**
|
|
61
|
-
|
|
62
|
-
|
|
36
|
+
**Behind the scenes:**
|
|
37
|
+
- Connects to Figma Desktop (local MCP server)
|
|
38
|
+
- Searches your component library in Pinecone
|
|
39
|
+
- Uses Frida AI for intelligent component matching
|
|
40
|
+
- Validates your API token via Firebase
|
|
63
41
|
|
|
64
|
-
|
|
42
|
+
## 📦 Installation
|
|
65
43
|
|
|
66
|
-
|
|
44
|
+
### Step 1: Install the Package
|
|
67
45
|
|
|
68
46
|
```bash
|
|
69
|
-
|
|
70
|
-
chmod +x run-local.sh
|
|
71
|
-
|
|
72
|
-
# With default namespace (org01_proj01)
|
|
73
|
-
./run-local.sh
|
|
74
|
-
|
|
75
|
-
# With custom namespace
|
|
76
|
-
./run-local.sh org02_proj02
|
|
47
|
+
npm install -g @fridaplatform-stk/figma2frida-mcp
|
|
77
48
|
```
|
|
78
49
|
|
|
79
|
-
|
|
80
|
-
- Start the server in HTTP Stream mode
|
|
81
|
-
- Use the namespace from the command-line argument
|
|
82
|
-
- Load all other settings from `.env` file
|
|
83
|
-
- Make the server available at `http://localhost:8080/mcp`
|
|
50
|
+
### Step 2: Configure Your AI Assistant
|
|
84
51
|
|
|
85
|
-
|
|
52
|
+
Add to your configuration file:
|
|
86
53
|
|
|
87
|
-
|
|
54
|
+
**Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
88
55
|
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"mcpServers": {
|
|
59
|
+
"figma2frida": {
|
|
60
|
+
"command": "npx",
|
|
61
|
+
"args": [
|
|
62
|
+
"@fridaplatform-stk/figma2frida-mcp",
|
|
63
|
+
"--project-id",
|
|
64
|
+
"YOUR_PROJECT_ID",
|
|
65
|
+
"--frida-api-token",
|
|
66
|
+
"YOUR_API_TOKEN"
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
93
71
|
```
|
|
94
72
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
### Configuration
|
|
98
|
-
|
|
99
|
-
Add this to your MCP configuration file (location depends on your IDE):
|
|
73
|
+
**Cursor** (similar configuration in settings):
|
|
100
74
|
|
|
101
75
|
```json
|
|
102
76
|
{
|
|
103
77
|
"mcpServers": {
|
|
104
78
|
"figma2frida": {
|
|
105
|
-
"command": "
|
|
79
|
+
"command": "npx",
|
|
106
80
|
"args": [
|
|
107
|
-
"/
|
|
108
|
-
"--
|
|
109
|
-
"
|
|
81
|
+
"@fridaplatform-stk/figma2frida-mcp",
|
|
82
|
+
"--project-id",
|
|
83
|
+
"YOUR_PROJECT_ID",
|
|
84
|
+
"--frida-api-token",
|
|
85
|
+
"YOUR_API_TOKEN"
|
|
110
86
|
]
|
|
111
87
|
}
|
|
112
88
|
}
|
|
113
89
|
}
|
|
114
90
|
```
|
|
115
91
|
|
|
116
|
-
|
|
117
|
-
- Use the **absolute path** to `dist/figma2frida.js`
|
|
118
|
-
- Replace `org01_proj01` with your namespace
|
|
119
|
-
- Make sure you've run `npm run build` first
|
|
120
|
-
- The `.env` file should be in the project root
|
|
92
|
+
### Step 3: Restart Your AI Assistant
|
|
121
93
|
|
|
122
|
-
|
|
94
|
+
Restart Claude Desktop, Cursor, or your IDE to load the MCP server.
|
|
123
95
|
|
|
124
|
-
|
|
96
|
+
## 🔑 Getting Access Tokens
|
|
125
97
|
|
|
126
|
-
|
|
98
|
+
To use Figma2Frida, you need:
|
|
99
|
+
- **Project ID** - Your organization's project identifier
|
|
100
|
+
- **Frida API Token** - Authentication token for Frida services
|
|
127
101
|
|
|
128
|
-
|
|
129
|
-
- `figma_get_design_context` - Get design data and generated code (with caching & streaming)
|
|
130
|
-
- `figma_suggest_components` - Suggest design system components based on Figma design (with Pinecone & Frida AI)
|
|
131
|
-
- `figma_improve_layout` - Trigger layout improvement to match Figma frame reference
|
|
102
|
+
### How to Get Tokens
|
|
132
103
|
|
|
133
|
-
|
|
104
|
+
**Contact the Softtek Frida Team:**
|
|
134
105
|
|
|
135
|
-
|
|
136
|
-
figma2frida_mcp/
|
|
137
|
-
├── src/
|
|
138
|
-
│ └── figma2frida/
|
|
139
|
-
│ ├── figma2frida.ts # Main MCP server
|
|
140
|
-
│ ├── clients/
|
|
141
|
-
│ │ └── figma-client.ts # Figma Desktop MCP client
|
|
142
|
-
│ ├── handlers/
|
|
143
|
-
│ │ └── component-suggestion-handler.ts
|
|
144
|
-
│ ├── services/
|
|
145
|
-
│ │ ├── component-lookup.ts
|
|
146
|
-
│ │ ├── frida/
|
|
147
|
-
│ │ │ └── frida-client.ts
|
|
148
|
-
│ │ └── pinecone/
|
|
149
|
-
│ │ └── pinecone-service.ts
|
|
150
|
-
│ └── utils/
|
|
151
|
-
│ ├── component-extractor.ts
|
|
152
|
-
│ ├── design-query-extractor.ts
|
|
153
|
-
│ └── formatters.ts
|
|
154
|
-
├── dist/
|
|
155
|
-
│ ├── figma2frida.js # Built server (for production)
|
|
156
|
-
│ └── figma2frida.d.ts
|
|
157
|
-
├── run-local.sh # Local development script
|
|
158
|
-
├── .env # Environment variables (create this)
|
|
159
|
-
└── package.json
|
|
160
|
-
```
|
|
106
|
+
📧 Reach out to your organization's Frida team or Softtek Frida support to request access.
|
|
161
107
|
|
|
162
|
-
|
|
108
|
+
You'll need to provide:
|
|
109
|
+
- Your organization name
|
|
110
|
+
- Intended use case
|
|
111
|
+
- Team/project information
|
|
163
112
|
|
|
164
|
-
|
|
113
|
+
The Frida team will provide your credentials securely.
|
|
165
114
|
|
|
166
|
-
|
|
167
|
-
npm run build
|
|
168
|
-
```
|
|
115
|
+
### 💡 Recommended: Frida Code Copilot Extension
|
|
169
116
|
|
|
170
|
-
|
|
117
|
+
For the best experience, also install the **[Frida Code Copilot VS Code Extension](https://marketplace.visualstudio.com/)**:
|
|
171
118
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
119
|
+
- Automatically manages your projects and components
|
|
120
|
+
- Visual component browser in VS Code
|
|
121
|
+
- Real-time component library updates
|
|
122
|
+
- Works seamlessly with this MCP server
|
|
175
123
|
|
|
176
|
-
##
|
|
124
|
+
## 📋 Prerequisites
|
|
177
125
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
126
|
+
- **Node.js 18+**
|
|
127
|
+
- **Figma Desktop** with MCP enabled
|
|
128
|
+
- **Frida API Token** (contact Softtek Frida team)
|
|
129
|
+
|
|
130
|
+
## 🚀 Example Usage
|
|
131
|
+
|
|
132
|
+
Once configured, simply ask your AI assistant:
|
|
181
133
|
|
|
182
|
-
|
|
183
|
-
|
|
134
|
+
```
|
|
135
|
+
"Generate React code for this Figma button component"
|
|
184
136
|
```
|
|
185
137
|
|
|
186
|
-
|
|
138
|
+
```
|
|
139
|
+
"What card components are available in my design system?"
|
|
140
|
+
```
|
|
187
141
|
|
|
188
|
-
```bash
|
|
189
|
-
npm install -g @fridaplatform-stk/figma2frida-mcp
|
|
190
|
-
figma2frida-mcp --pinecone-namespace org01_proj01
|
|
191
142
|
```
|
|
143
|
+
"Update this code to match the Figma spacing exactly"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The AI will automatically use the Figma2Frida tools to help you.
|
|
147
|
+
|
|
148
|
+
## 🐛 Troubleshooting
|
|
149
|
+
|
|
150
|
+
**"Authentication failed"**
|
|
151
|
+
→ Verify your Frida API token with the Softtek team
|
|
152
|
+
|
|
153
|
+
**"Not connected to Figma MCP"**
|
|
154
|
+
→ Make sure Figma Desktop is running with MCP enabled
|
|
192
155
|
|
|
193
|
-
|
|
156
|
+
**"Missing required argument"**
|
|
157
|
+
→ Check both `--project-id` and `--frida-api-token` are in your config
|
|
194
158
|
|
|
195
|
-
|
|
196
|
-
|
|
159
|
+
**"Rate limit exceeded"**
|
|
160
|
+
→ Wait a few minutes before trying again
|
|
197
161
|
|
|
198
|
-
|
|
199
|
-
Make sure Figma Desktop is running with MCP enabled at `http://127.0.0.1:3845/sse`.
|
|
162
|
+
## 🤝 Support
|
|
200
163
|
|
|
201
|
-
|
|
202
|
-
Make sure you're passing `--pinecone-namespace` as an argument (not in `.env`).
|
|
164
|
+
- **Softtek Frida Team**: Contact for access tokens and support
|
|
203
165
|
|
|
204
|
-
|
|
205
|
-
- Check the absolute path is correct
|
|
206
|
-
- Make sure `dist/figma2frida.js` exists (run `npm run build`)
|
|
207
|
-
- Check Visual Studio's MCP logs for errors
|
|
166
|
+
## 📄 License
|
|
208
167
|
|
|
209
|
-
|
|
168
|
+
MIT License
|
|
210
169
|
|
|
211
|
-
|
|
170
|
+
## 👥 Author
|
|
212
171
|
|
|
213
|
-
|
|
172
|
+
**Frida Platform STK** - Softtek
|
|
214
173
|
|
|
215
|
-
|
|
174
|
+
---
|
|
216
175
|
|
|
176
|
+
Made with ❤️ by the Frida team
|