@fridaplatform-stk/figma2frida-mcp 1.0.0
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/LICENSE +25 -0
- package/README.md +216 -0
- package/dist/figma2frida.d.ts +1 -0
- package/dist/figma2frida.js +2840 -0
- package/dist/figma2frida.js.map +1 -0
- package/package.json +87 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
=====================
|
|
3
|
+
|
|
4
|
+
Copyright © 2024 Frank Fiegel (frank@glama.ai)
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person
|
|
7
|
+
obtaining a copy of this software and associated documentation
|
|
8
|
+
files (the “Software”), to deal in the Software without
|
|
9
|
+
restriction, including without limitation the rights to use,
|
|
10
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the
|
|
12
|
+
Software is furnished to do so, subject to the following
|
|
13
|
+
conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be
|
|
16
|
+
included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
20
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
22
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
23
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
24
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
25
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Figma2Frida MCP Server
|
|
2
|
+
|
|
3
|
+
Figma to Frida MCP Server - Bridge between Figma Desktop MCP and design system components with Pinecone search.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This MCP server connects Figma Desktop MCP to your design system components stored in Pinecone, enabling intelligent component suggestions based on Figma designs.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 🔗 **Figma Integration**: Connects to Figma Desktop MCP
|
|
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
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
|
|
20
|
+
- Node.js 18+
|
|
21
|
+
- Figma Desktop with MCP enabled (running at `http://127.0.0.1:3845/sse`)
|
|
22
|
+
- Pinecone account with API key
|
|
23
|
+
- Frida AI account with bearer token
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
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
|
+
```
|
|
38
|
+
|
|
39
|
+
## Configuration
|
|
40
|
+
|
|
41
|
+
### Environment Variables
|
|
42
|
+
|
|
43
|
+
Create a `.env` file in the project root with the following variables:
|
|
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
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Important**: `PINECONE_NAMESPACE` should NOT be in `.env` - it's passed as a command-line argument.
|
|
61
|
+
|
|
62
|
+
## Local Development
|
|
63
|
+
|
|
64
|
+
### Running Locally
|
|
65
|
+
|
|
66
|
+
Use the `run-local.sh` script for local testing:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Make sure the script is executable
|
|
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
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The script will:
|
|
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`
|
|
84
|
+
|
|
85
|
+
### Testing the Server
|
|
86
|
+
|
|
87
|
+
Once running, test with curl:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
curl -X POST http://localhost:8080/mcp \
|
|
91
|
+
-H "Content-Type: application/json" \
|
|
92
|
+
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Visual Studio / GitHub Copilot Setup
|
|
96
|
+
|
|
97
|
+
### Configuration
|
|
98
|
+
|
|
99
|
+
Add this to your MCP configuration file (location depends on your IDE):
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"mcpServers": {
|
|
104
|
+
"figma2frida": {
|
|
105
|
+
"command": "node",
|
|
106
|
+
"args": [
|
|
107
|
+
"/absolute/path/to/figma2frida_mcp/dist/figma2frida.js",
|
|
108
|
+
"--pinecone-namespace",
|
|
109
|
+
"org01_proj01"
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Important**:
|
|
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
|
|
121
|
+
|
|
122
|
+
### Restart Your IDE
|
|
123
|
+
|
|
124
|
+
After adding the configuration, restart Visual Studio / GitHub Copilot to load the MCP server.
|
|
125
|
+
|
|
126
|
+
## Available Tools
|
|
127
|
+
|
|
128
|
+
- `figma_get_screenshot` - Get visual screenshot from Figma (fast)
|
|
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
|
|
132
|
+
|
|
133
|
+
## Project Structure
|
|
134
|
+
|
|
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
|
+
```
|
|
161
|
+
|
|
162
|
+
## Development
|
|
163
|
+
|
|
164
|
+
### Build
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
npm run build
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Development Mode
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
npm run dev
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Publishing to npm
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Build first
|
|
180
|
+
npm run build
|
|
181
|
+
|
|
182
|
+
# Publish
|
|
183
|
+
npm publish
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
After publishing, users can install globally:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
npm install -g @fridaplatform-stk/figma2frida-mcp
|
|
190
|
+
figma2frida-mcp --pinecone-namespace org01_proj01
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Troubleshooting
|
|
194
|
+
|
|
195
|
+
### "Cannot find module 'fastmcp'"
|
|
196
|
+
Run `npm install` to install dependencies.
|
|
197
|
+
|
|
198
|
+
### "Figma MCP connection failed"
|
|
199
|
+
Make sure Figma Desktop is running with MCP enabled at `http://127.0.0.1:3845/sse`.
|
|
200
|
+
|
|
201
|
+
### "Pinecone namespace not found"
|
|
202
|
+
Make sure you're passing `--pinecone-namespace` as an argument (not in `.env`).
|
|
203
|
+
|
|
204
|
+
### Visual Studio can't find the MCP server
|
|
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
|
|
208
|
+
|
|
209
|
+
## License
|
|
210
|
+
|
|
211
|
+
MIT
|
|
212
|
+
|
|
213
|
+
## Author
|
|
214
|
+
|
|
215
|
+
Frida Platform STK
|
|
216
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|