web-stylebook-mcp 0.1.0 → 0.1.1
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.ko.md +273 -0
- package/README.md +220 -47
- package/dist/catalog/stable-hash.d.ts +2 -0
- package/dist/catalog/stable-hash.js +39 -0
- package/dist/catalog/stable-hash.js.map +1 -0
- package/dist/catalog/validate.js +50 -1
- package/dist/catalog/validate.js.map +1 -1
- package/dist/protocol/errors.d.ts +4 -1
- package/dist/protocol/errors.js +15 -0
- package/dist/protocol/errors.js.map +1 -1
- package/dist/protocol/register-resources.js +10 -0
- package/dist/protocol/register-resources.js.map +1 -1
- package/dist/protocol/register-tools.js +15 -4
- package/dist/protocol/register-tools.js.map +1 -1
- package/dist/recommendation/scoring.js +14 -3
- package/dist/recommendation/scoring.js.map +1 -1
- package/dist/server-info.d.ts +2 -1
- package/dist/server-info.js +5 -1
- package/dist/server-info.js.map +1 -1
- package/dist/server.js +2 -2
- package/dist/server.js.map +1 -1
- package/dist/tokens/compile.js +9 -1
- package/dist/tokens/compile.js.map +1 -1
- package/dist/tokens/contrast.js +3 -2
- package/dist/tokens/contrast.js.map +1 -1
- package/generated/catalog.v1.json +73 -9
- package/generated/manifest.v1.json +1 -1
- package/package.json +4 -2
- package/skill/AGENTS.md +72 -0
- package/skill/CLAUDE.md +44 -8
- package/skill/web-stylebook-design/SKILL.md +134 -14
package/README.ko.md
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# web-stylebook-mcp
|
|
4
|
+
|
|
5
|
+
**AI 코딩 에이전트를 위한 디자인 인텔리전스.** 매번 똑같은 히어로 + 카드 3개는 그만.
|
|
6
|
+
에이전트가 점수화된 디자인 *계약*(방향·UI 상태 계획·토큰)을 받아, 근거를 바탕으로 코드를 씁니다.
|
|
7
|
+
|
|
8
|
+
[](https://www.npmjs.com/package/web-stylebook-mcp)
|
|
9
|
+
[](https://www.npmjs.com/package/web-stylebook-mcp)
|
|
10
|
+
[](./LICENSE)
|
|
11
|
+
[](https://nodejs.org)
|
|
12
|
+
[](https://modelcontextprotocol.io)
|
|
13
|
+
|
|
14
|
+
[English](./README.md) · **한국어**
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
코딩 에이전트는 *무엇이 어떻게 생겨야 하는지*를 정하지 못해서 매번 똑같은 UI로 도망칩니다 — 히어로 + 카드 3개 + 그라데이션. `web-stylebook-mcp`는 에이전트에게 **디자인 계약**(점수화된 시각 방향, UI 상태 계획, 디자인 토큰)을 건네는 Model Context Protocol 서버이고, [webstylebook.com](https://webstylebook.com)과 동일한 큐레이션 카탈로그에서 가져옵니다. **코드가 아니라 근거**를 돌려줍니다. 코드는 여전히 에이전트가 쓰지만, 이제 무엇을 만들지 알고 씁니다.
|
|
21
|
+
|
|
22
|
+
API 키 없음. 모델 호출 없음. 네트워크 없음. 파일시스템 접근 없음. **결정적이고, 읽기 전용이며, 완전히 로컬.**
|
|
23
|
+
|
|
24
|
+
## 없을 때 / 있을 때
|
|
25
|
+
|
|
26
|
+
| | `web-stylebook-mcp` 없이 | `web-stylebook-mcp`로 |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| **방향** | 한 가지 룩을 찍어서 밀어붙임 | 점수화된 후보 + 사유 코드 + *무엇을 왜 탈락*시켰는지 |
|
|
29
|
+
| **UI 상태** | 해피패스만, 빈/에러/로딩은 나중에 덧붙임 | 표면별 필수/권장/도메인 상태를 처음부터 |
|
|
30
|
+
| **토큰** | 손으로 고른 hex, 대비는 거의 미확인 | 역할 기반 토큰 + WCAG 대비 경고 |
|
|
31
|
+
| **결과** | 천편일률 AI UI | 에이전트가 근거로 삼아 구현하는 디자인 계약 |
|
|
32
|
+
|
|
33
|
+
## 직접 판단하는 걸 보세요
|
|
34
|
+
|
|
35
|
+
> *"SRE용 고밀도 모니터링 대시보드. 온콜로 하루 종일 본다. 차분하고 기술적으로. 사이버펑크는 피해서."*
|
|
36
|
+
|
|
37
|
+
```jsonc
|
|
38
|
+
// → recommend_design_direction (입력)
|
|
39
|
+
{
|
|
40
|
+
"productDescription": "High-density monitoring dashboard for SREs, watched all day on call",
|
|
41
|
+
"productType": "operational-saas",
|
|
42
|
+
"tone": ["calm", "technical"],
|
|
43
|
+
"density": "high",
|
|
44
|
+
"usageFrequency": "daily",
|
|
45
|
+
"avoid": ["cyberpunk"]
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```jsonc
|
|
50
|
+
// ← 결과
|
|
51
|
+
{
|
|
52
|
+
"confidence": "high",
|
|
53
|
+
"candidates": [ // 모두 0.91 동점 — 순서는 의미 없음
|
|
54
|
+
{ "style": "notion-style", "score": 0.91 },
|
|
55
|
+
{ "style": "platform-core", "score": 0.91 },
|
|
56
|
+
{ "style": "quiet-utility", "score": 0.91 },
|
|
57
|
+
{ "style": "runtime-signal", "score": 0.91 }
|
|
58
|
+
],
|
|
59
|
+
"rejected": [
|
|
60
|
+
{ "style": "cyberpunk-glitch", "reasons": ["EXPLICITLY_AVOIDED", "DAILY_USE_OVERSTIMULATION"] },
|
|
61
|
+
{ "style": "aurora-gradient", "reasons": ["PRODUCT_NOT_IDEAL", "DAILY_USE_OVERSTIMULATION"] }
|
|
62
|
+
],
|
|
63
|
+
"pairing": "macos-liquid-glass + notion-style (조용한 폼 / 내비)",
|
|
64
|
+
"guidance": "Treat candidates as scored evidence; pick by product context. 4 are tied — ordering isn't meaningful; use differentiators."
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
여기서 *하지 않는* 것에 주목하세요 — 정답 하나를 내세우지 않습니다. 네 방향이 0.91로 동점이고, 탈락에는 사유 코드가 붙고, 가이던스는 최종 선택을 모델에게 넘깁니다. 그 정직함이 핵심입니다. 서버는 근거를 주고, 결정은 에이전트가 합니다.
|
|
69
|
+
|
|
70
|
+
그다음 고른 방향을 실제 토큰으로:
|
|
71
|
+
|
|
72
|
+
```jsonc
|
|
73
|
+
// → compose_design_tokens(style: "notion-style", format: "css-variables", theme: "light")
|
|
74
|
+
// WCAG 대비 경고 0건
|
|
75
|
+
:root {
|
|
76
|
+
--color-canvas: #ffffff;
|
|
77
|
+
--color-text: #37352f;
|
|
78
|
+
--color-accent: #2383e2;
|
|
79
|
+
--color-border: #d3d3d1;
|
|
80
|
+
/* … 역할 기반 색·타이포·간격·radius·모션·밀도 */
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
요청 한 번에 — 에이전트는 방향을 고르고, 무엇이 왜 탈락했는지 보고, WCAG를 통과하는 토큰까지 받았습니다. 코드 한 줄 생성하지 않고.
|
|
85
|
+
|
|
86
|
+
## 에이전트가 이걸로 만든 결과물
|
|
87
|
+
|
|
88
|
+
다른 브리프 — *"흩어진 고객 피드백(지원 티켓, 세일즈 콜, 앱 리뷰, 슬랙)을 하나의 우선순위 로드맵으로 정리해주는 B2B SaaS **Throughline**의 마케팅 랜딩."* 레이아웃도, 히어로도, 스타일도 지정하지 않았습니다. 동반 스킬을 따라 에이전트는 스톡 히어로로 도망치는 대신 **제품의 핵심 아이디어에서** 첫 화면을 구성했습니다 — 오른쪽 절반은 다른 사이트에 복붙할 수 있는 장식 카드가 아니라, 제품의 실제 메커니즘(피드백 소스가 모여 자동 랭킹된 로드맵이 되는)을 그린 맞춤 다이어그램입니다.
|
|
89
|
+
|
|
90
|
+
<div align="center">
|
|
91
|
+
<img src="https://raw.githubusercontent.com/seungdori/web-stylebook-mcp/master/docs/example-throughline-hero.png" alt="web-stylebook-mcp로 AI 에이전트가 구성한 랜딩 히어로 — 일반적인 히어로가 아니라 피드백→로드맵 맞춤 시각화" width="840">
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<div align="center"><sub>동반 스킬을 따른 AI 에이전트가 구성 — 프롬프트는 제품과 스택만 설명했고, 레이아웃은 한마디도 없었습니다.</sub></div>
|
|
95
|
+
|
|
96
|
+
## 동작 방식
|
|
97
|
+
|
|
98
|
+
```mermaid
|
|
99
|
+
flowchart LR
|
|
100
|
+
A[AI 코딩 에이전트] -->|제품·톤·<br/>밀도·사용빈도| B(web-stylebook-mcp)
|
|
101
|
+
B --> C{번들된 카탈로그<br/>읽기 전용 · 오프라인}
|
|
102
|
+
C --> D[recommend_design_direction]
|
|
103
|
+
C --> E[compare_design_directions]
|
|
104
|
+
C --> F[get_ui_state_plan]
|
|
105
|
+
C --> G[compose_design_tokens]
|
|
106
|
+
D & E & F & G -->|디자인 계약<br/>점수 · 사유 코드 · 토큰| A
|
|
107
|
+
A -->|근거로<br/>코드 작성| H[당신의 UI]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
에이전트가 제품을 설명하면, 서버가 큐레이션 카탈로그를 점수화해 구조화된 근거를 돌려줍니다. 코드는 생성하지 않고, 어떤 것도 기기를 벗어나지 않습니다.
|
|
111
|
+
|
|
112
|
+
## 설치
|
|
113
|
+
|
|
114
|
+
**Node 20 이상** 필요.
|
|
115
|
+
|
|
116
|
+
<details open>
|
|
117
|
+
<summary><b>Codex CLI · IDE 확장</b></summary>
|
|
118
|
+
|
|
119
|
+
Codex CLI로 추가:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
codex mcp add web-stylebook -- npx -y web-stylebook-mcp@latest
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
또는 `~/.codex/config.toml`에 추가하세요. 신뢰한 저장소에서는 프로젝트 범위
|
|
126
|
+
`.codex/config.toml`도 사용할 수 있습니다:
|
|
127
|
+
|
|
128
|
+
```toml
|
|
129
|
+
[mcp_servers.web-stylebook]
|
|
130
|
+
command = "npx"
|
|
131
|
+
args = ["-y", "web-stylebook-mcp@latest"]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
설정을 편집한 뒤 Codex를 재시작하거나 새 세션을 여세요. Codex TUI에서는 `/mcp`로
|
|
135
|
+
서버 활성 상태를 확인할 수 있습니다.
|
|
136
|
+
|
|
137
|
+
</details>
|
|
138
|
+
|
|
139
|
+
<details>
|
|
140
|
+
<summary><b>Claude Code</b></summary>
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
claude mcp add web-stylebook -- npx -y web-stylebook-mcp@latest
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
</details>
|
|
147
|
+
|
|
148
|
+
<details>
|
|
149
|
+
<summary><b>Cursor · Windsurf · 일반 MCP 클라이언트</b></summary>
|
|
150
|
+
|
|
151
|
+
MCP 설정에 추가:
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"mcpServers": {
|
|
156
|
+
"web-stylebook": {
|
|
157
|
+
"command": "npx",
|
|
158
|
+
"args": ["-y", "web-stylebook-mcp@latest"]
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
</details>
|
|
165
|
+
|
|
166
|
+
<details>
|
|
167
|
+
<summary><b>Claude Desktop</b></summary>
|
|
168
|
+
|
|
169
|
+
같은 블록을 `claude_desktop_config.json`에 추가하고 재시작:
|
|
170
|
+
|
|
171
|
+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
172
|
+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"mcpServers": {
|
|
177
|
+
"web-stylebook": {
|
|
178
|
+
"command": "npx",
|
|
179
|
+
"args": ["-y", "web-stylebook-mcp@latest"]
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
</details>
|
|
186
|
+
|
|
187
|
+
## 툴
|
|
188
|
+
|
|
189
|
+
| 툴 | 받는 것 | 정직한 점 |
|
|
190
|
+
|------|--------------|-----------------|
|
|
191
|
+
| **`recommend_design_direction`** | 사유 코드가 붙은 점수화 스타일 후보, *이유*가 붙은 **탈락** 스타일, 보조 페어링, 신뢰도 | 최종 선택은 모델이 — 이건 근거 제공자입니다 |
|
|
192
|
+
| **`compare_design_directions`** | 2~4개 방향을 제품 적합성·반복 사용·밀도·신뢰·차별성·접근성 리스크·모션·유지보수로 비교 | 정답 하나를 선언하지 않습니다 |
|
|
193
|
+
| **`get_ui_state_plan`** | 표면(데이터 테이블·폼·체크아웃·채팅·개발자 콘솔)의 필수/권장/도메인 UI 상태 — 트리거·표시 필수·금지·접근성·모션 | 에이전트가 잊는 상태까지: 빈·에러·로딩·엣지 |
|
|
194
|
+
| **`compose_design_tokens`** | 역할 기반 토큰(색·타이포·간격·radius·모션·밀도)을 `json` / `css-variables` / `tailwind` / `typescript`, light / dark / both | WCAG 대비 경고를 숨기지 않고 내보냅니다 |
|
|
195
|
+
|
|
196
|
+
**카탈로그:** 스타일 48 · 컴포넌트 20 · 표면 5 · UI 상태 레시피 57 · 모션 프로파일 29 · 제품 아키타입 14.
|
|
197
|
+
|
|
198
|
+
## 다국어 출력
|
|
199
|
+
|
|
200
|
+
모든 툴은 선택적 `locale`을 받습니다. 사유 코드·가이던스·라벨이 요청한 언어로 돌아옵니다:
|
|
201
|
+
|
|
202
|
+
```text
|
|
203
|
+
"en" | "ko" | "ja" // English · 한국어 · 日本語
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## 리소스
|
|
207
|
+
|
|
208
|
+
카탈로그를 MCP 리소스로 직접 탐색:
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
webstylebook://manifest
|
|
212
|
+
webstylebook://styles · /styles/{id}
|
|
213
|
+
webstylebook://motion · /motion/{id}
|
|
214
|
+
webstylebook://components · /components/{id}
|
|
215
|
+
webstylebook://states/surfaces · /states/{surface} · /states/{surface}/{state}
|
|
216
|
+
webstylebook://products · /products/{id}
|
|
217
|
+
webstylebook://policies/anti-patterns · /policies/verification
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## 프롬프트
|
|
221
|
+
|
|
222
|
+
자주 쓰는 워크플로우용 MCP 프롬프트:
|
|
223
|
+
|
|
224
|
+
`design-product` · `design-screen` · `complete-ui-states` · `redesign-with-style` · `audit-design-direction`
|
|
225
|
+
|
|
226
|
+
## CLI
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
web-stylebook-mcp # stdio로 서버 실행 (기본)
|
|
230
|
+
web-stylebook-mcp --version
|
|
231
|
+
web-stylebook-mcp --catalog-info
|
|
232
|
+
web-stylebook-mcp --validate-catalog
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## 동반 스킬
|
|
236
|
+
|
|
237
|
+
[`skill/`](./skill)에 동반 스킬이 함께 들어있어, 에이전트가 적절한 순간에 이 툴들을 꺼내 쓰고 결과를 제대로 활용하게 합니다(색만 바꾸지 말 것, 후보를 여러 개 제시할 것, 신뢰는 지어내지 말 것, 재사용 컴포넌트로 떨어뜨릴 것):
|
|
238
|
+
|
|
239
|
+
**Codex**
|
|
240
|
+
|
|
241
|
+
- `skill/web-stylebook-design/`를 저장소의 `.agents/skills/web-stylebook-design/` 또는
|
|
242
|
+
사용자 범위 `~/.agents/skills/web-stylebook-design/` 같은 Codex 스킬 위치로 복사하거나
|
|
243
|
+
심볼릭 링크하세요.
|
|
244
|
+
- 스킬을 설치하지 않을 경우 `skill/AGENTS.md`를 프로젝트의 `AGENTS.md`에 복사하세요.
|
|
245
|
+
|
|
246
|
+
**Claude Code 및 기타 에이전트**
|
|
247
|
+
|
|
248
|
+
- 에이전트의 스킬 디렉터리를 `skill/web-stylebook-design/`로 지정하거나,
|
|
249
|
+
- `skill/CLAUDE.md`를 프로젝트의 `CLAUDE.md` 또는 해당 에이전트의 rules 파일에 복사하세요.
|
|
250
|
+
|
|
251
|
+
## 프라이버시 · 보안
|
|
252
|
+
|
|
253
|
+
| 항목 | |
|
|
254
|
+
|----------|---|
|
|
255
|
+
| API 키 | 없음 |
|
|
256
|
+
| 모델 호출 | 없음 |
|
|
257
|
+
| 네트워크 접근 | 없음 — 완전 오프라인 동작 |
|
|
258
|
+
| 프로젝트 / 파일시스템 접근 | 없음 |
|
|
259
|
+
| 동작 | 결정적, 읽기 전용 |
|
|
260
|
+
|
|
261
|
+
서버는 패키지에 번들된 카탈로그 스냅샷만 읽습니다. 어디로도 전송하지 않으며, 같은 입력은 항상 같은 계약을 냅니다.
|
|
262
|
+
|
|
263
|
+
## 호환성
|
|
264
|
+
|
|
265
|
+
- **Node:** 20 이상
|
|
266
|
+
- **전송:** stdio (Model Context Protocol)
|
|
267
|
+
- **클라이언트:** Codex CLI / IDE 확장 · Claude Code · Claude Desktop · Cursor · Windsurf, 그리고 모든 MCP 호환 클라이언트
|
|
268
|
+
|
|
269
|
+
## 라이선스
|
|
270
|
+
|
|
271
|
+
[MIT](./LICENSE) — 코드 **및** 번들된 카탈로그 스냅샷에 적용 (상업적 사용 자유).
|
|
272
|
+
|
|
273
|
+
> [webstylebook.com](https://webstylebook.com) 웹사이트는 CC BY-NC로 배포됩니다. 동일한 저작권자가 이 패키지에 번들된 카탈로그 스냅샷에 대해 MIT를 부여합니다.
|
package/README.md
CHANGED
|
@@ -1,17 +1,155 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# web-stylebook-mcp
|
|
2
4
|
|
|
3
|
-
**Design intelligence for coding agents.**
|
|
5
|
+
**Design intelligence for AI coding agents.** Stop shipping the same hero-plus-three-cards.
|
|
6
|
+
Your agent gets scored design *contracts* — directions, UI-state plans, tokens — then writes the code from evidence.
|
|
7
|
+
|
|
8
|
+
[](https://www.npmjs.com/package/web-stylebook-mcp)
|
|
9
|
+
[](https://www.npmjs.com/package/web-stylebook-mcp)
|
|
10
|
+
[](./LICENSE)
|
|
11
|
+
[](https://nodejs.org)
|
|
12
|
+
[](https://modelcontextprotocol.io)
|
|
13
|
+
|
|
14
|
+
**English** · [한국어](./README.ko.md)
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
Coding agents default to the same generic UI because they can't *decide* what it should look like — so they fall back to hero + 3 cards + a gradient. `web-stylebook-mcp` is a Model Context Protocol server that hands the agent **design contracts** — scored visual directions, UI-state plans, and design tokens — drawn from the same curated catalog as [webstylebook.com](https://webstylebook.com). It returns **evidence, not code**. Your agent still writes the code — now it knows what to build.
|
|
21
|
+
|
|
22
|
+
No API key. No model call. No network. No filesystem access. **Deterministic, read-only, fully local.**
|
|
23
|
+
|
|
24
|
+
## Without it / with it
|
|
25
|
+
|
|
26
|
+
| | Without `web-stylebook-mcp` | With `web-stylebook-mcp` |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| **Direction** | Guesses one look, commits to it | Scored candidates + reason codes + what it *rejected* and why |
|
|
29
|
+
| **UI states** | Happy path only; empty / error / loading bolted on later | Required / recommended / domain states up front, per surface |
|
|
30
|
+
| **Tokens** | Hand-picked hexes, contrast rarely checked | Role-based tokens with WCAG contrast warnings |
|
|
31
|
+
| **Result** | Generic AI UI | A defensible design contract the agent builds from |
|
|
32
|
+
|
|
33
|
+
## Watch it decide
|
|
34
|
+
|
|
35
|
+
> *"High-density monitoring dashboard for SREs, watched all day on call. Calm, technical. Avoid cyberpunk."*
|
|
36
|
+
|
|
37
|
+
```jsonc
|
|
38
|
+
// → recommend_design_direction (input)
|
|
39
|
+
{
|
|
40
|
+
"productDescription": "High-density monitoring dashboard for SREs, watched all day on call",
|
|
41
|
+
"productType": "operational-saas",
|
|
42
|
+
"tone": ["calm", "technical"],
|
|
43
|
+
"density": "high",
|
|
44
|
+
"usageFrequency": "daily",
|
|
45
|
+
"avoid": ["cyberpunk"]
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```jsonc
|
|
50
|
+
// ← result
|
|
51
|
+
{
|
|
52
|
+
"confidence": "high",
|
|
53
|
+
"candidates": [ // all tied at 0.91 — ordering is NOT meaningful
|
|
54
|
+
{ "style": "notion-style", "score": 0.91 },
|
|
55
|
+
{ "style": "platform-core", "score": 0.91 },
|
|
56
|
+
{ "style": "quiet-utility", "score": 0.91 },
|
|
57
|
+
{ "style": "runtime-signal", "score": 0.91 }
|
|
58
|
+
],
|
|
59
|
+
"rejected": [
|
|
60
|
+
{ "style": "cyberpunk-glitch", "reasons": ["EXPLICITLY_AVOIDED", "DAILY_USE_OVERSTIMULATION"] },
|
|
61
|
+
{ "style": "aurora-gradient", "reasons": ["PRODUCT_NOT_IDEAL", "DAILY_USE_OVERSTIMULATION"] }
|
|
62
|
+
],
|
|
63
|
+
"pairing": "macos-liquid-glass + notion-style (quieter forms / nav)",
|
|
64
|
+
"guidance": "Treat candidates as scored evidence; pick by product context. 4 are tied — ordering isn't meaningful; use differentiators."
|
|
65
|
+
}
|
|
66
|
+
```
|
|
4
67
|
|
|
5
|
-
|
|
6
|
-
choose a product‑fit visual direction, plan screens, cover real UI states, compose
|
|
7
|
-
design tokens, and avoid generic AI‑looking interfaces — without writing the code for them.
|
|
68
|
+
Notice what it *doesn't* do: it doesn't pretend there's one winner. Four directions tie at 0.91, the rejects come with reason codes, and the guidance tells the model to make the final call. That honesty is the point — the server provides evidence, the agent decides.
|
|
8
69
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
70
|
+
Then turn the chosen direction into real tokens:
|
|
71
|
+
|
|
72
|
+
```jsonc
|
|
73
|
+
// → compose_design_tokens(style: "notion-style", format: "css-variables", theme: "light")
|
|
74
|
+
// 0 WCAG contrast warnings
|
|
75
|
+
:root {
|
|
76
|
+
--color-canvas: #ffffff;
|
|
77
|
+
--color-text: #37352f;
|
|
78
|
+
--color-accent: #2383e2;
|
|
79
|
+
--color-border: #d3d3d1;
|
|
80
|
+
/* … role-based color, type, spacing, radius, motion, density */
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
One request in — and the agent chose a direction, saw what was rejected and why, and got tokens that pass WCAG, without generating a line of code.
|
|
85
|
+
|
|
86
|
+
## What an agent builds with it
|
|
87
|
+
|
|
88
|
+
A different brief — *"a marketing landing page for **Throughline**, a B2B SaaS that turns scattered customer feedback (support tickets, sales calls, app reviews, Slack) into one prioritized roadmap."* No layout, no hero, no styling was specified. Following the companion skill, the agent composed the opening **from the product's core idea** instead of reaching for a stock hero: the right half is a bespoke diagram of the product's actual mechanic — feedback sources converging into an auto-ranked roadmap — not a decorative card you could paste onto any other site.
|
|
89
|
+
|
|
90
|
+
<div align="center">
|
|
91
|
+
<img src="https://raw.githubusercontent.com/seungdori/web-stylebook-mcp/master/docs/example-throughline-hero.png" alt="A landing-page hero an AI agent composed using web-stylebook-mcp — a bespoke feedback-to-roadmap visualization rather than a generic hero" width="840">
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<div align="center"><sub>Composed by an AI agent following the companion skill — the prompt described the product and stack, nothing about the layout.</sub></div>
|
|
95
|
+
|
|
96
|
+
## How it works
|
|
97
|
+
|
|
98
|
+
```mermaid
|
|
99
|
+
flowchart LR
|
|
100
|
+
A[AI coding agent] -->|product, tone,<br/>density, usage| B(web-stylebook-mcp)
|
|
101
|
+
B --> C{Bundled catalog<br/>read-only · offline}
|
|
102
|
+
C --> D[recommend_design_direction]
|
|
103
|
+
C --> E[compare_design_directions]
|
|
104
|
+
C --> F[get_ui_state_plan]
|
|
105
|
+
C --> G[compose_design_tokens]
|
|
106
|
+
D & E & F & G -->|design contracts<br/>scores · reason codes · tokens| A
|
|
107
|
+
A -->|writes code<br/>from evidence| H[Your UI]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The agent describes the product; the server scores its curated catalog and returns structured evidence. No code is generated and nothing leaves your machine.
|
|
12
111
|
|
|
13
112
|
## Install
|
|
14
113
|
|
|
114
|
+
Requires **Node ≥ 20**.
|
|
115
|
+
|
|
116
|
+
<details open>
|
|
117
|
+
<summary><b>Codex CLI · IDE extension</b></summary>
|
|
118
|
+
|
|
119
|
+
Use the Codex CLI:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
codex mcp add web-stylebook -- npx -y web-stylebook-mcp@latest
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Or add it to `~/.codex/config.toml`. You can also use a project-scoped
|
|
126
|
+
`.codex/config.toml` in a trusted repository:
|
|
127
|
+
|
|
128
|
+
```toml
|
|
129
|
+
[mcp_servers.web-stylebook]
|
|
130
|
+
command = "npx"
|
|
131
|
+
args = ["-y", "web-stylebook-mcp@latest"]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Restart Codex or open a new session after editing config. In the Codex TUI, run `/mcp`
|
|
135
|
+
to confirm the server is active.
|
|
136
|
+
|
|
137
|
+
</details>
|
|
138
|
+
|
|
139
|
+
<details>
|
|
140
|
+
<summary><b>Claude Code</b></summary>
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
claude mcp add web-stylebook -- npx -y web-stylebook-mcp@latest
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
</details>
|
|
147
|
+
|
|
148
|
+
<details>
|
|
149
|
+
<summary><b>Cursor · Windsurf · generic MCP client</b></summary>
|
|
150
|
+
|
|
151
|
+
Add to your MCP config:
|
|
152
|
+
|
|
15
153
|
```json
|
|
16
154
|
{
|
|
17
155
|
"mcpServers": {
|
|
@@ -23,78 +161,113 @@ design tokens, and avoid generic AI‑looking interfaces — without writing the
|
|
|
23
161
|
}
|
|
24
162
|
```
|
|
25
163
|
|
|
26
|
-
|
|
27
|
-
companion skill / CLAUDE.md fragment (it tells the agent *when* to call these tools).
|
|
164
|
+
</details>
|
|
28
165
|
|
|
29
|
-
|
|
166
|
+
<details>
|
|
167
|
+
<summary><b>Claude Desktop</b></summary>
|
|
30
168
|
|
|
31
|
-
|
|
169
|
+
Add the same block to your `claude_desktop_config.json`, then restart:
|
|
32
170
|
|
|
33
|
-
- **
|
|
34
|
-
- **
|
|
171
|
+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
172
|
+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
35
173
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"mcpServers": {
|
|
177
|
+
"web-stylebook": {
|
|
178
|
+
"command": "npx",
|
|
179
|
+
"args": ["-y", "web-stylebook-mcp@latest"]
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
</details>
|
|
39
186
|
|
|
40
|
-
## Tools
|
|
187
|
+
## Tools
|
|
41
188
|
|
|
42
|
-
| Tool | What
|
|
43
|
-
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
189
|
+
| Tool | What you get | The honest part |
|
|
190
|
+
|------|--------------|-----------------|
|
|
191
|
+
| **`recommend_design_direction`** | Scored style candidates with reason codes, **rejected** styles with *why*, secondary pairings, confidence | The model makes the final pick — this is the evidence provider |
|
|
192
|
+
| **`compare_design_directions`** | 2–4 directions compared across product-fit, repeated-use, density, trust, distinctiveness, accessibility-risk, motion, maintenance | No single winner is declared |
|
|
193
|
+
| **`get_ui_state_plan`** | Required / recommended / domain UI states for a surface (data-table, form, checkout, chat, developer-console) — triggers, must-show, must-not, a11y, motion | Covers the states agents forget: empty, error, loading, edge |
|
|
194
|
+
| **`compose_design_tokens`** | Role-based tokens (color, type, spacing, radius, motion, density) as `json` / `css-variables` / `tailwind` / `typescript`, light / dark / both | Emits WCAG contrast warnings instead of hiding them |
|
|
48
195
|
|
|
49
|
-
|
|
50
|
-
|
|
196
|
+
**Catalog:** 48 styles · 20 components · 5 surfaces · 57 UI-state recipes · 29 motion profiles · 14 product archetypes.
|
|
197
|
+
|
|
198
|
+
## Localized output
|
|
199
|
+
|
|
200
|
+
Every tool takes an optional `locale`. Reason codes, guidance, and labels come back in the requested language:
|
|
201
|
+
|
|
202
|
+
```text
|
|
203
|
+
"en" | "ko" | "ja" // English · 한국어 · 日本語
|
|
204
|
+
```
|
|
51
205
|
|
|
52
206
|
## Resources
|
|
53
207
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
208
|
+
Browse the catalog directly over MCP resources:
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
webstylebook://manifest
|
|
212
|
+
webstylebook://styles · /styles/{id}
|
|
213
|
+
webstylebook://motion · /motion/{id}
|
|
214
|
+
webstylebook://components · /components/{id}
|
|
215
|
+
webstylebook://states/surfaces · /states/{surface} · /states/{surface}/{state}
|
|
216
|
+
webstylebook://products · /products/{id}
|
|
217
|
+
webstylebook://policies/anti-patterns · /policies/verification
|
|
218
|
+
```
|
|
58
219
|
|
|
59
220
|
## Prompts
|
|
60
221
|
|
|
222
|
+
Ready-made MCP prompts for common workflows:
|
|
223
|
+
|
|
61
224
|
`design-product` · `design-screen` · `complete-ui-states` · `redesign-with-style` · `audit-design-direction`
|
|
62
225
|
|
|
63
226
|
## CLI
|
|
64
227
|
|
|
65
228
|
```bash
|
|
66
|
-
web-stylebook-mcp
|
|
229
|
+
web-stylebook-mcp # run the server over stdio (default)
|
|
67
230
|
web-stylebook-mcp --version
|
|
68
231
|
web-stylebook-mcp --catalog-info
|
|
69
232
|
web-stylebook-mcp --validate-catalog
|
|
70
233
|
```
|
|
71
234
|
|
|
72
|
-
##
|
|
235
|
+
## Companion skill
|
|
73
236
|
|
|
74
|
-
|
|
237
|
+
A companion skill ships in [`skill/`](./skill) so your agent reaches for these tools at the right moment — and uses the results well (compose, don't recolor; offer multiple candidates; earn trust, don't fake it; land on reusable components):
|
|
75
238
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
239
|
+
**Codex**
|
|
240
|
+
|
|
241
|
+
- Copy or symlink `skill/web-stylebook-design/` into a Codex skill location such as
|
|
242
|
+
`.agents/skills/web-stylebook-design/` in your repo, or `~/.agents/skills/web-stylebook-design/`
|
|
243
|
+
for your user profile.
|
|
244
|
+
- If you do not want to install the skill, copy `skill/AGENTS.md` into your project's `AGENTS.md`.
|
|
245
|
+
|
|
246
|
+
**Claude Code and other agents**
|
|
247
|
+
|
|
248
|
+
- Point your agent's skills directory at `skill/web-stylebook-design/`, **or**
|
|
249
|
+
- Copy `skill/CLAUDE.md` into your project's `CLAUDE.md` or equivalent rules file.
|
|
82
250
|
|
|
83
251
|
## Privacy & security
|
|
84
252
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
253
|
+
| Property | |
|
|
254
|
+
|----------|---|
|
|
255
|
+
| API key | None |
|
|
256
|
+
| Model calls | None |
|
|
257
|
+
| Network access | None — works fully offline |
|
|
258
|
+
| Project / filesystem access | None |
|
|
259
|
+
| Behavior | Deterministic, read-only |
|
|
260
|
+
|
|
261
|
+
The server reads from a catalog snapshot bundled in the package. Nothing is sent anywhere; the same inputs always yield the same contracts.
|
|
88
262
|
|
|
89
263
|
## Compatibility
|
|
90
264
|
|
|
91
|
-
- Node ≥ 20
|
|
92
|
-
-
|
|
265
|
+
- **Node:** ≥ 20
|
|
266
|
+
- **Transport:** stdio (Model Context Protocol)
|
|
267
|
+
- **Clients:** Codex CLI / IDE extension, Claude Code, Claude Desktop, Cursor, Windsurf, and any MCP-compatible client
|
|
93
268
|
|
|
94
269
|
## License
|
|
95
270
|
|
|
96
|
-
MIT — covers
|
|
97
|
-
catalog data, freely and commercially.
|
|
271
|
+
[MIT](./LICENSE) — covers the code **and** the bundled catalog snapshot (free for commercial use).
|
|
98
272
|
|
|
99
|
-
> The [
|
|
100
|
-
> package's MIT grant is provided by the same copyright holder for the catalog snapshot shipped here.
|
|
273
|
+
> The [webstylebook.com](https://webstylebook.com) website is licensed CC BY-NC. The same owner grants an MIT license for the catalog snapshot bundled in this package.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Runtime mirror of the build's deterministic serializer (scripts/lib/stable-json.mts),
|
|
2
|
+
// so `--validate-catalog` can recompute the content hash and detect a tampered body —
|
|
3
|
+
// not just a malformed hash string. Must stay byte-identical to the build serializer.
|
|
4
|
+
import { createHash } from 'node:crypto';
|
|
5
|
+
function nfkc(s) {
|
|
6
|
+
return s.normalize('NFKC');
|
|
7
|
+
}
|
|
8
|
+
function codepointCompare(a, b) {
|
|
9
|
+
if (a < b)
|
|
10
|
+
return -1;
|
|
11
|
+
if (a > b)
|
|
12
|
+
return 1;
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
function stableNormalize(value) {
|
|
16
|
+
if (Array.isArray(value))
|
|
17
|
+
return value.map(stableNormalize);
|
|
18
|
+
if (value !== null && typeof value === 'object') {
|
|
19
|
+
const input = value;
|
|
20
|
+
const out = {};
|
|
21
|
+
for (const key of Object.keys(input).sort(codepointCompare)) {
|
|
22
|
+
const v = stableNormalize(input[key]);
|
|
23
|
+
if (v !== undefined)
|
|
24
|
+
out[key] = v;
|
|
25
|
+
}
|
|
26
|
+
return out;
|
|
27
|
+
}
|
|
28
|
+
if (typeof value === 'string')
|
|
29
|
+
return nfkc(value);
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
function stableStringify(value) {
|
|
33
|
+
return JSON.stringify(stableNormalize(value), null, 2) + '\n';
|
|
34
|
+
}
|
|
35
|
+
/** Content hash over the envelope WITHOUT its own contentHash field. */
|
|
36
|
+
export function contentHashOf(envelopeWithoutHash) {
|
|
37
|
+
return `sha256:${createHash('sha256').update(stableStringify(envelopeWithoutHash), 'utf8').digest('hex')}`;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=stable-hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stable-hash.js","sourceRoot":"","sources":["../../src/catalog/stable-hash.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,sFAAsF;AACtF,sFAAsF;AAEtF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,SAAS,IAAI,CAAC,CAAS;IACrB,OAAO,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC;AACD,SAAS,gBAAgB,CAAC,CAAS,EAAE,CAAS;IAC5C,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC,CAAC;IACrB,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IACpB,OAAO,CAAC,CAAC;AACX,CAAC;AACD,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC5D,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,KAAK,GAAG,KAAgC,CAAC;QAC/C,MAAM,GAAG,GAA4B,EAAE,CAAC;QACxC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC5D,MAAM,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;YACtC,IAAI,CAAC,KAAK,SAAS;gBAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;IAClD,OAAO,KAAK,CAAC;AACf,CAAC;AACD,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;AAChE,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,aAAa,CAAC,mBAA4B;IACxD,OAAO,UAAU,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAC7G,CAAC"}
|