@spaced-out/ui-design-system 0.5.34-beta.2 → 0.5.35

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/mcp/README.md CHANGED
@@ -1,526 +1,60 @@
1
- # Genesis UI Design System MCP Server
1
+ # Genesis MCP Server
2
2
 
3
- A Model Context Protocol (MCP) server that provides AI assistants (Claude, Cursor, etc.) with access to the Genesis UI Design System.
3
+ MCP server for AI assistants to access the Genesis UI Design System.
4
4
 
5
- ## Features
5
+ ## Quick Setup
6
6
 
7
- - 📦 **Component Discovery**: List and search all available components
8
- - 🎨 **Design Tokens**: Access colors, spacing, typography, shadows, and more
9
- - 📚 **Documentation**: Browse component stories and TypeScript definitions
10
- - 🔍 **Dependency Analysis**: Understand component dependencies
11
- - 🚀 **Onboarding Templates**: Get starter templates for new components
12
- - 🪝 **Hooks Information**: Query available React hooks
7
+ ### Cursor / Claude Desktop
13
8
 
14
- ## 🎯 No Local Dependencies Required!
15
-
16
- Unlike traditional MCP servers that require a local copy of the design system, this server **bundles all data at build time**. Users only need to run `npx` - no cloning, no environment variables!
17
-
18
- ## 📦 Installation for Users
19
-
20
- ### With Cursor
21
-
22
- ⚠️ **macOS Users**: Cursor may not find `npx` in its PATH. Use the full path instead.
23
-
24
- 1. Find your `npx` path in terminal:
25
-
26
- ```bash
27
- which npx
28
- ```
29
-
30
- 2. Add to your Cursor MCP settings with the **full path**:
31
-
32
- ```json
33
- {
34
- "mcpServers": {
35
- "genesis-design-system": {
36
- "command": "/opt/homebrew/bin/npx",
37
- "args": ["-y", "@spaced-out/genesis-mcp-server@latest"]
38
- }
39
- }
40
- }
41
- ```
42
-
43
- **Common npx locations:**
44
-
45
- - Apple Silicon Mac (Homebrew): `/opt/homebrew/bin/npx`
46
- - Intel Mac (Homebrew): `/usr/local/bin/npx`
47
- - nvm users: `/Users/YOUR_USERNAME/.nvm/versions/node/vX.X.X/bin/npx`
48
-
49
- **Windows/Linux users** can typically use `"command": "npx"` directly.
50
-
51
- ### With Claude Desktop
52
-
53
- ⚠️ **macOS Users**: Claude Desktop may not find `npx` in its PATH. Use the full path instead.
54
-
55
- Add to your Claude config file:
56
-
57
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
58
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
59
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
60
-
61
- 1. Find your `npx` path in terminal:
9
+ 1. Find your `npx` path:
62
10
 
63
11
  ```bash
64
12
  which npx
65
13
  ```
66
14
 
67
- 2. Use the **full path** in your config:
15
+ 2. Add to MCP settings:
68
16
 
69
17
  ```json
70
18
  {
71
19
  "mcpServers": {
72
20
  "genesis-design-system": {
73
21
  "command": "/opt/homebrew/bin/npx",
74
- "args": ["-y", "@spaced-out/genesis-mcp-server@latest"]
22
+ "args": ["-y", "@spaced-out/genesis-mcp@latest"]
75
23
  }
76
24
  }
77
25
  }
78
26
  ```
79
27
 
80
- **Common npx locations:**
81
-
82
- - Apple Silicon Mac (Homebrew): `/opt/homebrew/bin/npx`
83
- - Intel Mac (Homebrew): `/usr/local/bin/npx`
84
- - nvm users: `/Users/YOUR_USERNAME/.nvm/versions/node/vX.X.X/bin/npx`
85
-
86
- **Windows/Linux users** can typically use `"command": "npx"` directly.
28
+ > Replace `/opt/homebrew/bin/npx` with your actual path from step 1.
87
29
 
88
- Then restart Cursor or Claude Desktop.
30
+ 3. Restart the app.
89
31
 
90
- ## 🔧 Development
32
+ ## Available Tools
91
33
 
92
- ### Building the Data
34
+ | Tool | Description |
35
+ | -------------------------------- | ----------------------------- |
36
+ | `list_components` | List all components |
37
+ | `get_component` | Get component details & types |
38
+ | `search_components` | Search by name |
39
+ | `list_hooks` | List all hooks |
40
+ | `get_hook` | Get hook details |
41
+ | `get_design_tokens` | Get design tokens |
42
+ | `get_component_template` | New component template |
43
+ | `get_css_module_guidelines` | CSS Module patterns |
44
+ | `analyze_component_dependencies` | Dependency analysis |
93
45
 
94
- This server extracts design system metadata at build time. To build:
46
+ ## Development
95
47
 
96
48
  ```bash
97
- # Install dependencies
98
49
  yarn install
99
-
100
- # Build the data bundle
101
- yarn build
102
- ```
103
-
104
- This creates `data/design-system.json` with all component, hook, and token information.
105
-
106
- ### Testing Locally
107
-
108
- ```bash
109
- # After building, test the server
110
- node index.js
50
+ yarn build # Generate design-system.json
51
+ node index.js # Test locally
111
52
  ```
112
53
 
113
- Or test with MCP Inspector:
114
-
115
- ```bash
116
- npx @modelcontextprotocol/inspector node index.js
117
- ```
118
-
119
- ### Publishing
120
-
121
- ```bash
122
- # The prepublishOnly script runs yarn build automatically
123
- yarn publish
124
- ```
125
-
126
- ## 📊 How It Works
127
-
128
- ### Build Time (CI/CD)
129
-
130
- 1. `build-mcp-data.js` scans the design system:
131
-
132
- - Reads all components from `src/components/`
133
- - Reads all hooks from `src/hooks/`
134
- - Reads all design tokens from `design-tokens/`
135
-
136
- 2. Extracts file contents and metadata
137
-
138
- 3. Bundles everything into `data/design-system.json`
139
-
140
- 4. Package is published to npm with bundled data
141
-
142
- ### Runtime (User's Machine)
143
-
144
- 1. User runs `npx @spaced-out/genesis-mcp-server`
145
-
146
- 2. Server loads pre-bundled `data/design-system.json`
147
-
148
- 3. Serves data via MCP protocol (stdio)
149
-
150
- 4. AI assistant queries the server for design system info
151
-
152
- **Result:** No local design system needed! ✨
153
-
154
- ## 🏗️ Architecture
155
-
156
- ```
157
- ui-design-system/
158
- ├── src/
159
- │ ├── components/ # Source components
160
- │ └── hooks/ # Source hooks
161
- ├── design-tokens/ # Source tokens
162
- └── mcp/ # 👈 MCP Server
163
- ├── index.js # MCP server (reads from data/)
164
- ├── build-mcp-data.js # Build script (extracts from ../)
165
- ├── data/
166
- │ └── design-system.json # Bundled data (git-ignored)
167
- ├── package.json
168
- └── README.md
169
- ```
170
-
171
- ## 📝 Available Tools
172
-
173
- The MCP server provides these tools to AI assistants:
174
-
175
- - `list_components` - List all available components
176
- - `get_component` - Get detailed component information **including exported types** (e.g., IconType, IconSize from Icon component)
177
- - `search_components` - Search components by name
178
- - `list_hooks` - List all available hooks
179
- - `get_hook` - Get detailed hook information
180
- - `get_design_tokens` - Get all or filtered design tokens
181
- - `get_component_template` - Get template for new components
182
- - `get_design_token_import_guidelines` - Get guidelines for importing design tokens in CSS Module files with correct paths and examples
183
- - `get_css_module_guidelines` - **NEW!** Get comprehensive CSS Module styling guidelines including class naming conventions (BEM patterns), token usage, icon color patterns, and common mistakes to avoid
184
- - `analyze_component_dependencies` - Analyze component dependencies
185
-
186
- ## 🔄 CI/CD Integration
187
-
188
- ### Automatic Publishing
189
-
190
- The MCP server is automatically published to npm via GitHub Actions (`.github/workflows/publish-mcp.yml`).
191
-
192
- **Triggers:**
193
-
194
- - Push to `master` branch when files change in:
195
- - `src/**` (component/hook changes)
196
- - `design-tokens/**` (token changes)
197
- - `mcp/**` (MCP server changes)
198
- - Manual workflow dispatch
199
-
200
- **Process:**
201
-
202
- 1. **Auto-version bump**: If `src/` or `design-tokens/` changed, automatically bumps patch version
203
- 2. **Build**: Generates fresh MCP data bundle with latest design system changes
204
- 3. **Commit**: Pushes version bump back to master (with `[skip ci]` to avoid loops)
205
- 4. **Publish**: Publishes new version to npm
206
-
207
- **What this means for you:**
208
-
209
- ✅ Update a component → Merge to master → New MCP version automatically published!
210
-
211
- No need to manually bump versions when changing design system files. The workflow handles it for you.
212
-
213
- ### Version Management
214
-
215
- **Automatic (recommended):**
216
-
217
- - Changes to `src/` or `design-tokens/` → patch version bumped automatically
218
- - E.g., `1.0.5` → `1.0.6`
219
-
220
- **Manual (for major/minor releases):**
221
-
222
- ```bash
223
- cd mcp
224
- yarn version --minor # or --major
225
- git push --follow-tags
226
- ```
227
-
228
- **Manual MCP-only changes:**
229
-
230
- - If you only change files in `mcp/`, manually bump the version to publish
231
-
232
- ## 📈 Data Size
233
-
234
- The bundled JSON includes:
235
-
236
- - Full TypeScript component implementations
237
- - Storybook stories
238
- - CSS modules
239
- - Design tokens
240
- - Hook implementations
241
-
242
- Typical size: 5-15 MB (cached by npm, so only downloaded once)
243
-
244
- ## 🔐 Private Packages
245
-
246
- If publishing to a private npm registry:
247
-
248
- ```json
249
- {
250
- "publishConfig": {
251
- "registry": "https://your-private-registry.com"
252
- }
253
- }
254
- ```
255
-
256
- Users configure their registry:
257
-
258
- ```bash
259
- npm config set @spaced-out:registry https://your-private-registry.com
260
- # or with yarn
261
- yarn config set registry https://your-private-registry.com
262
- ```
263
-
264
- ## 🐛 Troubleshooting
265
-
266
- ### "spawn npx ENOENT" Error (macOS/Windows)
267
-
268
- **Symptoms:**
269
-
270
- - Cursor or Claude Desktop logs show `spawn npx ENOENT` error
271
- - MCP server fails to start with connection errors
272
- - Error message: `Server transport closed unexpectedly`
273
-
274
- **Cause:**
275
- GUI applications on macOS and Windows don't inherit your terminal's PATH environment variables, so they cannot find the `npx` command.
276
-
277
- **Solution:**
278
-
279
- 1. Find your `npx` path in terminal:
280
-
281
- **macOS/Linux:**
282
-
283
- ```bash
284
- which npx
285
- ```
286
-
287
- **Windows (PowerShell):**
288
-
289
- ```powershell
290
- where.exe npx
291
- ```
292
-
293
- 2. Use the **full path** in your MCP configuration instead of just `"command": "npx"`:
294
-
295
- **Example (macOS):**
296
-
297
- ```json
298
- {
299
- "mcpServers": {
300
- "genesis-design-system": {
301
- "command": "/opt/homebrew/bin/npx",
302
- "args": ["-y", "@spaced-out/genesis-mcp-server@latest"]
303
- }
304
- }
305
- }
306
- ```
307
-
308
- **Example (Windows):**
309
-
310
- ```json
311
- {
312
- "mcpServers": {
313
- "genesis-design-system": {
314
- "command": "C:\\Program Files\\nodejs\\npx.cmd",
315
- "args": ["-y", "@spaced-out/genesis-mcp-server@latest"]
316
- }
317
- }
318
- }
319
- ```
320
-
321
- **Common npx locations:**
322
-
323
- **macOS:**
324
-
325
- - Homebrew (Apple Silicon): `/opt/homebrew/bin/npx`
326
- - Homebrew (Intel): `/usr/local/bin/npx`
327
- - nvm: `/Users/YOUR_USERNAME/.nvm/versions/node/vX.X.X/bin/npx`
328
-
329
- **Windows:**
330
-
331
- - Default Node.js: `C:\Program Files\nodejs\npx.cmd`
332
- - nvm-windows: `C:\Users\YOUR_USERNAME\AppData\Roaming\nvm\vX.X.X\npx.cmd`
333
-
334
- **Linux:**
335
-
336
- - Most distributions: `/usr/bin/npx` or `/usr/local/bin/npx`
337
-
338
- 3. Restart your AI assistant (Cursor or Claude Desktop)
339
-
340
- **Verify the fix:**
341
- After restarting, check the application logs. You should see successful initialization:
342
-
343
- ```
344
- ✅ Loaded Genesis design system data
345
- Version: X.X.X
346
- Components: XX
347
- Hooks: XX
348
- ```
349
-
350
- Instead of `ENOENT` errors.
351
-
352
- ### MCP Inspector (Advanced Debugging)
353
-
354
- If you're still having issues, use the MCP Inspector to debug:
355
-
356
- ```bash
357
- npx @modelcontextprotocol/inspector
358
- ```
359
-
360
- Navigate to `http://127.0.0.1:6274` and configure:
361
-
362
- - **Transport type:** Stdio
363
- - **Command:** Your full npx path (e.g., `/opt/homebrew/bin/npx`)
364
- - **Arguments:** `-y @spaced-out/genesis-mcp-server@latest`
365
-
366
- Click **Connect** to test the connection. If it fails, check the terminal logs for detailed error messages.
367
-
368
- ### Test the Server Directly
369
-
370
- Test if the server runs correctly in your terminal:
371
-
372
- ```bash
373
- npx -y @spaced-out/genesis-mcp-server@latest
374
- ```
375
-
376
- You should see:
377
-
378
- ```
379
- ✅ Loaded Genesis design system data
380
- Version: X.X.X
381
- Components: XX
382
- Hooks: XX
383
- Built: YYYY-MM-DD
384
- ```
385
-
386
- If this fails, there may be an issue with the published package.
387
-
388
- ### Package Not Found
389
-
390
- **Error:** `npm ERR! 404 '@spaced-out/genesis-mcp-server@latest' is not in this registry`
391
-
392
- **Solution:**
393
-
394
- - Verify the package is published: `npm view @spaced-out/genesis-mcp-server`
395
- - If using a private registry, ensure you're authenticated
396
- - Check your npm registry configuration: `npm config get registry`
397
-
398
- ### Node.js Version
399
-
400
- **Error:** `The engine "node" is incompatible with this module`
401
-
402
- **Solution:**
403
- This server requires Node.js >= 18.0.0. Update your Node.js installation:
404
-
405
- ```bash
406
- node --version # Check current version
407
- ```
408
-
409
- Use [nvm](https://github.com/nvm-sh/nvm) or download from [nodejs.org](https://nodejs.org/).
410
-
411
- ## 🤝 Contributing
412
-
413
- When updating the design system:
414
-
415
- 1. Changes to components/hooks/tokens are automatically detected
416
- 2. CI/CD runs `npm run build` to regenerate data
417
- 3. New version is published to npm
418
- 4. Users get updates on next `npx` run (or immediately with `@latest`)
419
-
420
- ## 🎨 Integration with Figma MCP
421
-
422
- The Genesis MCP server works seamlessly alongside the Figma MCP server, enabling a powerful design-to-code workflow. By using both servers together, you can bridge design and implementation.
423
-
424
- ### Why Use Both?
425
-
426
- **Figma MCP** provides:
427
-
428
- - Design screenshots and visual context
429
- - Component properties and variants from Figma
430
- - Design tokens and variables from Figma files
431
- - Layout measurements and spacing
432
-
433
- **Genesis MCP** provides:
434
-
435
- - Actual React component implementations
436
- - Design system tokens and guidelines
437
- - TypeScript types and APIs
438
- - CSS Module styling patterns
439
-
440
- Together, they create a complete workflow: **Design in Figma → Implement with Genesis**
441
-
442
- ### Configuration Examples
443
-
444
- You can run multiple MCP servers simultaneously:
445
-
446
- **VS Code/Cursor:**
447
-
448
- ```json
449
- {
450
- "mcpServers": {
451
- "genesis-design-system": {
452
- "command": "/opt/homebrew/bin/npx",
453
- "args": ["-y", "@spaced-out/genesis-mcp-server@latest"]
454
- },
455
- "figma-desktop": {
456
- "command": "/opt/homebrew/bin/npx",
457
- "args": ["-y", "@modelcontextprotocol/server-figma"]
458
- }
459
- }
460
- }
461
- ```
462
-
463
- **Claude Desktop:**
464
-
465
- ```json
466
- {
467
- "mcpServers": {
468
- "genesis-design-system": {
469
- "command": "/opt/homebrew/bin/npx",
470
- "args": ["-y", "@spaced-out/genesis-mcp-server@latest"]
471
- },
472
- "figma-desktop": {
473
- "command": "/opt/homebrew/bin/npx",
474
- "args": ["-y", "@modelcontextprotocol/server-figma"]
475
- }
476
- }
477
- }
478
- ```
479
-
480
- ### Workflow Examples
481
-
482
- **Design-to-Code:**
483
-
484
- ```
485
- "Show me the current Figma selection"
486
- "Find the matching Genesis component for this design"
487
- "Implement this Figma button using Genesis Button component"
488
- ```
489
-
490
- **Token Mapping:**
491
-
492
- ```
493
- "Compare Figma colors with Genesis color tokens"
494
- "What Genesis spacing token matches this 16px gap?"
495
- "Map this Figma shadow to Genesis elevation tokens"
496
- ```
497
-
498
- **Validation:**
499
-
500
- ```
501
- "Does Genesis have a component matching this Figma design?"
502
- "Are these Figma colors available in Genesis palette?"
503
- "What Genesis components would I need for this Figma screen?"
504
- ```
505
-
506
- ### Requirements
507
-
508
- - **Figma MCP**: Figma Desktop app running with design files open
509
- - **Genesis MCP**: Node.js >= 18.0.0
510
-
511
- See [Figma MCP documentation](https://modelcontextprotocol.io/docs/tools/figma) for Figma setup details.
512
-
513
- ## 📚 Additional Resources
514
-
515
- - [MCP Documentation](https://modelcontextprotocol.io)
516
- - [Figma MCP Documentation](https://modelcontextprotocol.io/docs/tools/figma)
517
- - [MCP Inspector](https://github.com/modelcontextprotocol/inspector)
518
- - [Genesis Storybook MCP Guide](https://your-storybook-url.com/?path=/docs/model-context-protocol--docs)
519
-
520
- ## 📄 License
54
+ ## Troubleshooting
521
55
 
522
- UNLICENSED - Internal use only
56
+ **"spawn npx ENOENT"**: Use full path to `npx` (see setup above).
523
57
 
524
- ---
58
+ **Package not found**: Run `npm view @spaced-out/genesis-mcp` to verify.
525
59
 
526
- **Built with ❤️ by the Central UI team**
60
+ **Node version**: Requires Node.js >= 18.0.0