web-stylebook-mcp 0.1.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.
Files changed (70) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +100 -0
  3. package/dist/catalog/repository.d.ts +72 -0
  4. package/dist/catalog/repository.js +111 -0
  5. package/dist/catalog/repository.js.map +1 -0
  6. package/dist/catalog/validate.d.ts +7 -0
  7. package/dist/catalog/validate.js +49 -0
  8. package/dist/catalog/validate.js.map +1 -0
  9. package/dist/cli.d.ts +2 -0
  10. package/dist/cli.js +59 -0
  11. package/dist/cli.js.map +1 -0
  12. package/dist/localization.d.ts +5 -0
  13. package/dist/localization.js +10 -0
  14. package/dist/localization.js.map +1 -0
  15. package/dist/protocol/errors.d.ts +20 -0
  16. package/dist/protocol/errors.js +46 -0
  17. package/dist/protocol/errors.js.map +1 -0
  18. package/dist/protocol/register-prompts.d.ts +2 -0
  19. package/dist/protocol/register-prompts.js +76 -0
  20. package/dist/protocol/register-prompts.js.map +1 -0
  21. package/dist/protocol/register-resources.d.ts +3 -0
  22. package/dist/protocol/register-resources.js +85 -0
  23. package/dist/protocol/register-resources.js.map +1 -0
  24. package/dist/protocol/register-tools.d.ts +3 -0
  25. package/dist/protocol/register-tools.js +184 -0
  26. package/dist/protocol/register-tools.js.map +1 -0
  27. package/dist/protocol/result.d.ts +5 -0
  28. package/dist/protocol/result.js +26 -0
  29. package/dist/protocol/result.js.map +1 -0
  30. package/dist/recommendation/compare.d.ts +35 -0
  31. package/dist/recommendation/compare.js +118 -0
  32. package/dist/recommendation/compare.js.map +1 -0
  33. package/dist/recommendation/explain.d.ts +5 -0
  34. package/dist/recommendation/explain.js +88 -0
  35. package/dist/recommendation/explain.js.map +1 -0
  36. package/dist/recommendation/index.d.ts +4 -0
  37. package/dist/recommendation/index.js +11 -0
  38. package/dist/recommendation/index.js.map +1 -0
  39. package/dist/recommendation/normalize-context.d.ts +3 -0
  40. package/dist/recommendation/normalize-context.js +177 -0
  41. package/dist/recommendation/normalize-context.js.map +1 -0
  42. package/dist/recommendation/scoring.d.ts +8 -0
  43. package/dist/recommendation/scoring.js +370 -0
  44. package/dist/recommendation/scoring.js.map +1 -0
  45. package/dist/recommendation/types.d.ts +72 -0
  46. package/dist/recommendation/types.js +3 -0
  47. package/dist/recommendation/types.js.map +1 -0
  48. package/dist/server-info.d.ts +4 -0
  49. package/dist/server-info.js +16 -0
  50. package/dist/server-info.js.map +1 -0
  51. package/dist/server.d.ts +5 -0
  52. package/dist/server.js +25 -0
  53. package/dist/server.js.map +1 -0
  54. package/dist/state-atlas/planner.d.ts +42 -0
  55. package/dist/state-atlas/planner.js +82 -0
  56. package/dist/state-atlas/planner.js.map +1 -0
  57. package/dist/tokens/compile.d.ts +27 -0
  58. package/dist/tokens/compile.js +304 -0
  59. package/dist/tokens/compile.js.map +1 -0
  60. package/dist/tokens/contrast.d.ts +18 -0
  61. package/dist/tokens/contrast.js +51 -0
  62. package/dist/tokens/contrast.js.map +1 -0
  63. package/dist/types.d.ts +287 -0
  64. package/dist/types.js +36 -0
  65. package/dist/types.js.map +1 -0
  66. package/generated/catalog.v1.json +18533 -0
  67. package/generated/manifest.v1.json +27 -0
  68. package/package.json +47 -0
  69. package/skill/CLAUDE.md +36 -0
  70. package/skill/web-stylebook-design/SKILL.md +95 -0
@@ -0,0 +1,27 @@
1
+ {
2
+ "catalogVersion": "0.1.0",
3
+ "contentHash": "sha256:b488ad6a09e013c68d89f2f180f20b4e6b52c58d6853814d8b89d67600b545c5",
4
+ "counts": {
5
+ "components": 20,
6
+ "fusions": 16,
7
+ "motionPatterns": 29,
8
+ "productArchetypes": 14,
9
+ "stateRecipes": 57,
10
+ "stateSurfaces": 5,
11
+ "styles": 32
12
+ },
13
+ "domains": [
14
+ "styles",
15
+ "motion",
16
+ "components",
17
+ "states",
18
+ "products",
19
+ "policies"
20
+ ],
21
+ "languages": [
22
+ "en",
23
+ "ko",
24
+ "ja"
25
+ ],
26
+ "schema": "webstylebook.catalog.v1"
27
+ }
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "web-stylebook-mcp",
3
+ "version": "0.1.0",
4
+ "description": "Design intelligence for coding agents — choose a product-fit visual direction, cover real UI states, and compose design tokens from the Web Stylebook catalog.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "bin": {
8
+ "web-stylebook-mcp": "./dist/cli.js"
9
+ },
10
+ "main": "./dist/server.js",
11
+ "types": "./dist/server.d.ts",
12
+ "files": [
13
+ "dist",
14
+ "generated",
15
+ "skill",
16
+ "README.md"
17
+ ],
18
+ "engines": {
19
+ "node": ">=20"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/seungdori/web-stylebook-mcp.git"
24
+ },
25
+ "homepage": "https://github.com/seungdori/web-stylebook-mcp#readme",
26
+ "bugs": "https://github.com/seungdori/web-stylebook-mcp/issues",
27
+ "scripts": {
28
+ "build": "tsc -p tsconfig.json",
29
+ "typecheck": "tsc -p tsconfig.json --noEmit",
30
+ "pretest": "tsc -p tsconfig.json",
31
+ "test": "vitest run",
32
+ "start": "node dist/cli.js",
33
+ "dev": "tsx src/cli.ts",
34
+ "prepublishOnly": "npm run build"
35
+ },
36
+ "keywords": ["mcp", "model-context-protocol", "design", "ui", "design-system", "coding-agent"],
37
+ "dependencies": {
38
+ "@modelcontextprotocol/sdk": "1.29.0",
39
+ "zod": "4.4.3"
40
+ },
41
+ "devDependencies": {
42
+ "@types/node": "^25.6.0",
43
+ "tsx": "^4.21.0",
44
+ "typescript": "^6.0.3",
45
+ "vitest": "^4.1.9"
46
+ }
47
+ }
@@ -0,0 +1,36 @@
1
+ <!-- Web Stylebook MCP — copy this block into your project's CLAUDE.md (or a rules file)
2
+ if your agent host does not support skills. It is the invocation trigger. -->
3
+
4
+ ## Designing UI — use Web Stylebook first
5
+
6
+ Before writing JSX/HTML/CSS for any new or redesigned UI surface (page, screen, component,
7
+ dashboard, form, checkout, chat, developer console), call the **`web-stylebook`** MCP server:
8
+
9
+ 1. `recommend_design_direction` with the product context (productType, tone, density,
10
+ usageFrequency, trustSensitivity, constraints, avoid). Use the scored `candidates` as
11
+ evidence and pick with product context — don't blindly take `candidates[0]`. Note the
12
+ `rejected` styles and their reasons.
13
+ 2. Read `webstylebook://styles/{id}` for your picks; write a `design.md` brief (intent, color
14
+ *roles*, type roles, layout, motion use/avoid, UI-state coverage, a11y, anti-patterns,
15
+ assumptions, verification) with no empty sections.
16
+ 3. `get_ui_state_plan` for each surface and implement required + recommended states (respect
17
+ every `mustNot`).
18
+ 4. `compose_design_tokens` for a starting token set; obey the contrast warnings.
19
+ 5. Self-audit against `webstylebook://policies/verification`.
20
+
21
+ **Compose, don't recolor.** Tokens are scalars, not a design — swapping a token block over one
22
+ layout is a reskin and is not acceptable. Give each direction its own composition. For open-ended
23
+ requests, fully compose **several candidate pages** (distinct layouts) and let the user pick; drop
24
+ context-inappropriate styles even if high-scored (e.g. low-contrast for elderly/medical). Land on
25
+ **reusable components** (tokens = shared foundation, component states = the `get_ui_state_plan`
26
+ contracts), not a one-off HTML file.
27
+
28
+ **Earn trust, don't fake it.** No invented metrics ("99.2% on-time") and no compliance/IT-jargon
29
+ trust signals (TLS·AES-256, ISO 27001) — choose signals by what the real user weighs (for a patient:
30
+ doctors, departments, hours, location, insurance, emergency care). Back every claim with browsable
31
+ content (don't say "214 doctors" then show three). Never default to the formulaic hero.
32
+ **Component states (hover/focus/active/disabled) are owned by the component** — never let context
33
+ selectors (`nav a:hover`) bleed in and override a primitive's own states.
34
+
35
+ The catalog is the single source of truth — read the live resources, don't cache them here.
36
+ Output is deterministic and model-free; the server never sees your repo.
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: web-stylebook-design
3
+ description: Use BEFORE building or redesigning any frontend UI (a page, screen, component, dashboard, form, checkout, chat, or developer console). Calls the Web Stylebook MCP to choose a product-fit visual direction, cover real (non-happy-path) UI states, and compose design tokens — so the result doesn't look like a generic AI template. Trigger whenever the user asks to build/design/redesign a UI, "make a page/screen/app", "style this", or wants a design direction, even if they don't say "Web Stylebook".
4
+ ---
5
+
6
+ # Web Stylebook — design before you build
7
+
8
+ You have the **Web Stylebook MCP** server (`web-stylebook`) connected. It returns design
9
+ *contracts* (scored directions, UI-state plans, tokens), not code. You still write the code.
10
+ Calling it before writing UI produces far better, less generic results.
11
+
12
+ ## When to fire
13
+
14
+ Before writing JSX/HTML/CSS for any new or redesigned UI surface. If you catch yourself about
15
+ to scaffold a page from memory, stop and run step 1 first.
16
+
17
+ ## Workflow
18
+
19
+ 1. **`recommend_design_direction`** — pass the product context (productType, tone, density,
20
+ usageFrequency, trustSensitivity, constraints, avoid). It returns **scored candidates** with
21
+ reason codes, **rejected** styles with reasons, secondary **pairings**, assumptions, and a
22
+ confidence. Treat `candidates` as evidence — *you* pick using product context; `candidates[0]`
23
+ is the strongest match, not a mandate.
24
+ 2. **Read the chosen styles** — `webstylebook://styles/{id}` for each pick (primary + any pairing).
25
+ 3. **Write `design.md`** — a brief with: intent, audience/tasks, chosen direction + why, rejected
26
+ directions, tone, color *roles* (not a raw palette), type roles, spacing/density, layout rules,
27
+ surface hierarchy, component behavior, motion (use AND avoid), UI-state coverage, responsive,
28
+ accessibility, anti-patterns, assumptions, verification checklist. Never leave a section empty.
29
+ 4. **Plan each screen** — organize hierarchy by the primary user task. Do **not** default to
30
+ Hero + Features + Testimonial + CTA. Look up component vocabulary in `webstylebook://components`.
31
+ 5. **`get_ui_state_plan`** — for each surface (data-table, form, checkout, chat, developer-console).
32
+ Implement the required + recommended states, honoring `mustNot` (e.g. no silent auto-retry, don't
33
+ lose user input, don't imply a charge that didn't happen).
34
+ 6. **`compose_design_tokens`** — emit a starting token set (css-variables / tailwind / typescript).
35
+ Heed the contrast warnings; don't ship 8–12% ghost borders.
36
+ 7. **Implement, then self-audit** against `webstylebook://policies/verification` and
37
+ `…/anti-patterns`.
38
+
39
+ ## Active design — compose, don't recolor
40
+
41
+ `compose_design_tokens` returns color/radius/type/spacing **scalars**. Tokens are not a design.
42
+ Swapping a token block over one fixed layout is a *reskin* — it reads as "one screen recolored"
43
+ and is **not acceptable** as a design direction. A real direction has its **own composition**:
44
+ layout, hierarchy, density, component choice, motion — built from the style's facets + component
45
+ vocabulary, not just its tokens.
46
+
47
+ - **Offer a candidate set, not one screen.** For an open-ended design request, take the top
48
+ context-fit candidates and **fully compose each as a distinct page** (different layouts, not the
49
+ same layout recolored). Present them with an honest per-candidate critique + a recommendation, and
50
+ let the user choose. A single one-shot output is the weaker default.
51
+ - **Apply active judgment over the score.** Drop a high-scored candidate when the context defeats it
52
+ — e.g. low-contrast styles (neumorphism) for elderly / medical / high-trust — even if it ranks #1.
53
+ The score is evidence; product context decides. The MCP's own guidance says so.
54
+ - **Lead with the landing surface.** When the user just says "design X", start from the landing/hero,
55
+ not an internal dashboard.
56
+ - **Land on reusable components.** The deliverable is a component library: tokens as the shared
57
+ foundation (swap to re-skin everything), and components whose states are exactly the
58
+ `get_ui_state_plan` contracts. Not a one-off HTML file.
59
+
60
+ ## Editorial discipline — earn trust, don't fake it
61
+
62
+ The fastest "AI smell" is filler content dressed as substance. Hold the line:
63
+
64
+ - **No invented metrics.** Don't fabricate impressive-sounding numbers ("99.2% on-time rate",
65
+ "1.4-min average booking"). If it didn't come from the user/product, don't print it.
66
+ - **No compliance/IT jargon as trust signals.** "TLS·AES-256", "ISO 27001", cipher specs — the
67
+ end user doesn't care. Choose trust signals by what THIS audience actually weighs. For a hospital
68
+ patient: doctors by name/specialty/experience, departments, location·transit·parking, hours
69
+ (incl. nights/weekends), insurance, wait time, reviews, emergency capability. Compliance, if shown
70
+ at all, goes small in the footer — not a hero trust band.
71
+ - **Back every claim with content.** "214 specialists" requires a way to browse them (or a few
72
+ representatives + "see all →"). A headline number with three cards reads as a lie.
73
+ - **Don't default to the formulaic hero.** [giant headline + subline + two equal buttons + a
74
+ decorative right-side card] is the layout everyone now reads as AI. Lead with the primary task,
75
+ prefer one clear action, and make any hero panel functional, not decorative.
76
+ - **Intentional typography.** Generic system-sans (especially for Korean/CJK) reads as default —
77
+ pick a real display face.
78
+
79
+ ## `compare_design_directions`
80
+
81
+ When the user is torn between looks, pass 2–4 directions. It returns each one's favorable
82
+ conditions and likely failure mode — there is deliberately no single winner; choose by product fit.
83
+
84
+ ## Rules
85
+
86
+ - **Never present a token-swap recolor as a design direction** — compose each direction's own layout.
87
+ - **Default to a multi-candidate set + an honest recommendation**, not one screen; the user picks.
88
+ - **Component states are owned by the component.** Interaction states (hover/focus/active/disabled)
89
+ live on the primitive's own classes — never let an ancestor/context selector (`nav a:hover`,
90
+ `.card a`) bleed in and override them. Scope context rules with `:not(.btn)` etc. A primitive must
91
+ look and behave the same wherever it's placed.
92
+ - The MCP is the single source of design knowledge — **don't** paraphrase or cache its catalog here.
93
+ Always read the live resources.
94
+ - Everything it returns is deterministic and model-free: same input → same output.
95
+ - It never sees your repo. Give it a short product summary as input; it gives you a contract back.