@omnifyjp/mcp-design-system 0.2.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/README.md +133 -0
- package/dist/index.js +1165 -0
- package/dist/index.js.map +1 -0
- package/dist/setup.js +68 -0
- package/dist/setup.js.map +1 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# @omnifyjp/mcp-design-system
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server that exposes the @omnifyjp design system to AI tools — Claude Code, Cursor, Windsurf, etc.
|
|
4
|
+
|
|
5
|
+
When consumers install `@omnifyjp/ui` via npm, they get components but **not** the design rules. This package bridges that gap: configure once, and AI tools automatically know how to use the design system correctly.
|
|
6
|
+
|
|
7
|
+
## How It Works
|
|
8
|
+
|
|
9
|
+
This is a **stdio MCP server** — no HTTP server, no ports, no daemon to run. AI tools launch it automatically as a subprocess, communicate via stdin/stdout, and terminate it when done.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
AI Tool (Claude Code / Cursor)
|
|
13
|
+
↓ spawns process
|
|
14
|
+
node @omnifyjp/mcp-design-system
|
|
15
|
+
↓ JSON-RPC over stdin/stdout
|
|
16
|
+
AI gets design tokens, rules, component APIs
|
|
17
|
+
↓ process exits when session ends
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
### For this monorepo (development)
|
|
23
|
+
|
|
24
|
+
Already configured in `.mcp.json` at the repo root. Just build:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pnpm --filter @omnifyjp/mcp-design-system build
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Claude Code will automatically pick up the MCP server on next session.
|
|
31
|
+
|
|
32
|
+
### For consumers
|
|
33
|
+
|
|
34
|
+
`.mcp.json` is auto-configured on install. Just install `@omnifyjp/shell` (which depends on this package):
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install @omnifyjp/shell
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The `postinstall` script automatically creates `.mcp.json` in your project root:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"mcpServers": {
|
|
45
|
+
"omnify-design": {
|
|
46
|
+
"type": "stdio",
|
|
47
|
+
"command": "npx",
|
|
48
|
+
"args": ["@omnifyjp/mcp-design-system"]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
If `.mcp.json` already exists, it merges the `omnify-design` entry without overwriting your other MCP servers.
|
|
55
|
+
|
|
56
|
+
That's it. No server to run, no environment variables, no manual configuration.
|
|
57
|
+
|
|
58
|
+
## What AI Tools Get
|
|
59
|
+
|
|
60
|
+
### Resources
|
|
61
|
+
|
|
62
|
+
| URI | Content |
|
|
63
|
+
|-----|---------|
|
|
64
|
+
| `design://tokens` | All design tokens — colors, density, layout, shadows, z-index, transitions, shared types (UIColor, UIVariant, UISize) |
|
|
65
|
+
| `design://rules` | WRONG→RIGHT cheat sheet, DOs/DON'Ts, sidebar sizing rules, interaction patterns, code quality standards |
|
|
66
|
+
| `design://components` | Component inventory — 53 primitives + 14 domain components with props and usage |
|
|
67
|
+
| `design://layout` | Layout patterns — page, card, dialog, table, sidebar, header, drawer |
|
|
68
|
+
|
|
69
|
+
### Tools
|
|
70
|
+
|
|
71
|
+
| Tool | Description |
|
|
72
|
+
|------|-------------|
|
|
73
|
+
| `validate_component` | Validate React code against design rules. Catches hardcoded colors (`bg-white`, `text-gray-500`), wrong spacing (`p-6` instead of `p-page`), layout anti-patterns (`h-screen`), and more. |
|
|
74
|
+
| `suggest_token` | Describe what you need ("page background", "subdued text") → get the correct design token |
|
|
75
|
+
| `get_component_api` | Get props, variants, sizes, and usage example for any component |
|
|
76
|
+
|
|
77
|
+
## Examples
|
|
78
|
+
|
|
79
|
+
### AI validates code automatically
|
|
80
|
+
|
|
81
|
+
When writing a component, the AI can call `validate_component` to check:
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
// This code has violations:
|
|
85
|
+
<div className="bg-white p-6 border-gray-200">
|
|
86
|
+
<h1 className="text-3xl font-bold">Title</h1>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
// validate_component output:
|
|
90
|
+
// - Line 1: Hardcoded `bg-white` → Use `bg-background` or `bg-card`
|
|
91
|
+
// - Line 1: Hardcoded `p-6` → Use `p-page`
|
|
92
|
+
// - Line 1: Hardcoded `border-gray-200` → Use `border-border`
|
|
93
|
+
// - Line 2: `text-3xl font-bold` → Use `text-page-title font-semibold`
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### AI suggests tokens
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
suggest_token("subdued text color")
|
|
100
|
+
→ text-muted-foreground (CSS: --muted-foreground) — Subdued text (replaces text-gray-500/600)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### AI looks up component API
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
get_component_api("Button")
|
|
107
|
+
→ variant: default | secondary | outline | soft | ghost | link
|
|
108
|
+
→ color: primary | destructive | success | warning | info
|
|
109
|
+
→ size: xs | sm | default | lg | xl
|
|
110
|
+
→ Example: <Button variant="soft" color="success" size="sm">Approve</Button>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Development
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Build
|
|
117
|
+
pnpm --filter @omnifyjp/mcp-design-system build
|
|
118
|
+
|
|
119
|
+
# Watch mode
|
|
120
|
+
pnpm --filter @omnifyjp/mcp-design-system dev
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Keeping Content in Sync
|
|
124
|
+
|
|
125
|
+
When design tokens, rules, or components change in `@omnifyjp/ui`, update the corresponding MCP resource:
|
|
126
|
+
|
|
127
|
+
| Change | Update |
|
|
128
|
+
|--------|--------|
|
|
129
|
+
| `theme.css` tokens | `src/resources/tokens.ts` |
|
|
130
|
+
| Design rules / CLAUDE.md | `src/resources/rules.ts` |
|
|
131
|
+
| New/removed components | `src/resources/components.ts` |
|
|
132
|
+
| Layout patterns | `src/resources/layout.ts` |
|
|
133
|
+
| Cheat sheet WRONG→RIGHT | `src/resources/rules.ts` |
|