@tekton-ui/mcp-server 0.3.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 (179) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +980 -0
  3. package/dist/auth/cache.d.ts +28 -0
  4. package/dist/auth/cache.d.ts.map +1 -0
  5. package/dist/auth/cache.js +48 -0
  6. package/dist/auth/cache.js.map +1 -0
  7. package/dist/auth/guard.d.ts +13 -0
  8. package/dist/auth/guard.d.ts.map +1 -0
  9. package/dist/auth/guard.js +21 -0
  10. package/dist/auth/guard.js.map +1 -0
  11. package/dist/auth/state.d.ts +32 -0
  12. package/dist/auth/state.d.ts.map +1 -0
  13. package/dist/auth/state.js +72 -0
  14. package/dist/auth/state.js.map +1 -0
  15. package/dist/auth/theme-access.d.ts +10 -0
  16. package/dist/auth/theme-access.d.ts.map +1 -0
  17. package/dist/auth/theme-access.js +24 -0
  18. package/dist/auth/theme-access.js.map +1 -0
  19. package/dist/auth/verify.d.ts +44 -0
  20. package/dist/auth/verify.d.ts.map +1 -0
  21. package/dist/auth/verify.js +77 -0
  22. package/dist/auth/verify.js.map +1 -0
  23. package/dist/cli/credentials.d.ts +29 -0
  24. package/dist/cli/credentials.d.ts.map +1 -0
  25. package/dist/cli/credentials.js +66 -0
  26. package/dist/cli/credentials.js.map +1 -0
  27. package/dist/cli/index.d.ts +7 -0
  28. package/dist/cli/index.d.ts.map +1 -0
  29. package/dist/cli/index.js +36 -0
  30. package/dist/cli/index.js.map +1 -0
  31. package/dist/cli/login.d.ts +9 -0
  32. package/dist/cli/login.d.ts.map +1 -0
  33. package/dist/cli/login.js +120 -0
  34. package/dist/cli/login.js.map +1 -0
  35. package/dist/cli/logout.d.ts +9 -0
  36. package/dist/cli/logout.d.ts.map +1 -0
  37. package/dist/cli/logout.js +18 -0
  38. package/dist/cli/logout.js.map +1 -0
  39. package/dist/cli/status.d.ts +9 -0
  40. package/dist/cli/status.d.ts.map +1 -0
  41. package/dist/cli/status.js +31 -0
  42. package/dist/cli/status.js.map +1 -0
  43. package/dist/data/component-registry.d.ts +30 -0
  44. package/dist/data/component-registry.d.ts.map +1 -0
  45. package/dist/data/component-registry.js +320 -0
  46. package/dist/data/component-registry.js.map +1 -0
  47. package/dist/data/examples/screen-examples.d.ts +38 -0
  48. package/dist/data/examples/screen-examples.d.ts.map +1 -0
  49. package/dist/data/examples/screen-examples.js +500 -0
  50. package/dist/data/examples/screen-examples.js.map +1 -0
  51. package/dist/data/hint-generator.d.ts +16 -0
  52. package/dist/data/hint-generator.d.ts.map +1 -0
  53. package/dist/data/hint-generator.js +298 -0
  54. package/dist/data/hint-generator.js.map +1 -0
  55. package/dist/data/recipe-resolver.d.ts +48 -0
  56. package/dist/data/recipe-resolver.d.ts.map +1 -0
  57. package/dist/data/recipe-resolver.js +226 -0
  58. package/dist/data/recipe-resolver.js.map +1 -0
  59. package/dist/data/template-matcher.d.ts +50 -0
  60. package/dist/data/template-matcher.d.ts.map +1 -0
  61. package/dist/data/template-matcher.js +240 -0
  62. package/dist/data/template-matcher.js.map +1 -0
  63. package/dist/generators/core-resolver.d.ts +56 -0
  64. package/dist/generators/core-resolver.d.ts.map +1 -0
  65. package/dist/generators/core-resolver.js +490 -0
  66. package/dist/generators/core-resolver.js.map +1 -0
  67. package/dist/generators/css-generator.d.ts +49 -0
  68. package/dist/generators/css-generator.d.ts.map +1 -0
  69. package/dist/generators/css-generator.js +294 -0
  70. package/dist/generators/css-generator.js.map +1 -0
  71. package/dist/generators/index.d.ts +13 -0
  72. package/dist/generators/index.d.ts.map +1 -0
  73. package/dist/generators/index.js +16 -0
  74. package/dist/generators/index.js.map +1 -0
  75. package/dist/generators/llm-generator.d.ts +96 -0
  76. package/dist/generators/llm-generator.d.ts.map +1 -0
  77. package/dist/generators/llm-generator.js +296 -0
  78. package/dist/generators/llm-generator.js.map +1 -0
  79. package/dist/index.d.ts +3 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +818 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/schemas/mcp-schemas.d.ts +4132 -0
  84. package/dist/schemas/mcp-schemas.d.ts.map +1 -0
  85. package/dist/schemas/mcp-schemas.js +946 -0
  86. package/dist/schemas/mcp-schemas.js.map +1 -0
  87. package/dist/storage/blueprint-storage.d.ts +68 -0
  88. package/dist/storage/blueprint-storage.d.ts.map +1 -0
  89. package/dist/storage/blueprint-storage.js +135 -0
  90. package/dist/storage/blueprint-storage.js.map +1 -0
  91. package/dist/storage/timestamp-manager.d.ts +32 -0
  92. package/dist/storage/timestamp-manager.d.ts.map +1 -0
  93. package/dist/storage/timestamp-manager.js +59 -0
  94. package/dist/storage/timestamp-manager.js.map +1 -0
  95. package/dist/tools/export-screen.d.ts +34 -0
  96. package/dist/tools/export-screen.d.ts.map +1 -0
  97. package/dist/tools/export-screen.js +344 -0
  98. package/dist/tools/export-screen.js.map +1 -0
  99. package/dist/tools/generate-blueprint.d.ts +15 -0
  100. package/dist/tools/generate-blueprint.d.ts.map +1 -0
  101. package/dist/tools/generate-blueprint.js +165 -0
  102. package/dist/tools/generate-blueprint.js.map +1 -0
  103. package/dist/tools/generate-screen.d.ts +13 -0
  104. package/dist/tools/generate-screen.d.ts.map +1 -0
  105. package/dist/tools/generate-screen.js +82 -0
  106. package/dist/tools/generate-screen.js.map +1 -0
  107. package/dist/tools/get-screen-generation-context.d.ts +11 -0
  108. package/dist/tools/get-screen-generation-context.d.ts.map +1 -0
  109. package/dist/tools/get-screen-generation-context.js +316 -0
  110. package/dist/tools/get-screen-generation-context.js.map +1 -0
  111. package/dist/tools/list-components.d.ts +15 -0
  112. package/dist/tools/list-components.d.ts.map +1 -0
  113. package/dist/tools/list-components.js +46 -0
  114. package/dist/tools/list-components.js.map +1 -0
  115. package/dist/tools/list-icon-libraries.d.ts +12 -0
  116. package/dist/tools/list-icon-libraries.d.ts.map +1 -0
  117. package/dist/tools/list-icon-libraries.js +48 -0
  118. package/dist/tools/list-icon-libraries.js.map +1 -0
  119. package/dist/tools/list-screen-templates.d.ts +15 -0
  120. package/dist/tools/list-screen-templates.d.ts.map +1 -0
  121. package/dist/tools/list-screen-templates.js +63 -0
  122. package/dist/tools/list-screen-templates.js.map +1 -0
  123. package/dist/tools/list-themes.d.ts +13 -0
  124. package/dist/tools/list-themes.d.ts.map +1 -0
  125. package/dist/tools/list-themes.js +42 -0
  126. package/dist/tools/list-themes.js.map +1 -0
  127. package/dist/tools/list-tokens.d.ts +13 -0
  128. package/dist/tools/list-tokens.d.ts.map +1 -0
  129. package/dist/tools/list-tokens.js +92 -0
  130. package/dist/tools/list-tokens.js.map +1 -0
  131. package/dist/tools/preview-component.d.ts +18 -0
  132. package/dist/tools/preview-component.d.ts.map +1 -0
  133. package/dist/tools/preview-component.js +178 -0
  134. package/dist/tools/preview-component.js.map +1 -0
  135. package/dist/tools/preview-icon-library.d.ts +13 -0
  136. package/dist/tools/preview-icon-library.d.ts.map +1 -0
  137. package/dist/tools/preview-icon-library.js +63 -0
  138. package/dist/tools/preview-icon-library.js.map +1 -0
  139. package/dist/tools/preview-screen-template.d.ts +18 -0
  140. package/dist/tools/preview-screen-template.d.ts.map +1 -0
  141. package/dist/tools/preview-screen-template.js +101 -0
  142. package/dist/tools/preview-screen-template.js.map +1 -0
  143. package/dist/tools/preview-theme.d.ts +15 -0
  144. package/dist/tools/preview-theme.d.ts.map +1 -0
  145. package/dist/tools/preview-theme.js +71 -0
  146. package/dist/tools/preview-theme.js.map +1 -0
  147. package/dist/tools/validate-environment.d.ts +37 -0
  148. package/dist/tools/validate-environment.d.ts.map +1 -0
  149. package/dist/tools/validate-environment.js +153 -0
  150. package/dist/tools/validate-environment.js.map +1 -0
  151. package/dist/tools/validate-screen-definition.d.ts +10 -0
  152. package/dist/tools/validate-screen-definition.d.ts.map +1 -0
  153. package/dist/tools/validate-screen-definition.js +463 -0
  154. package/dist/tools/validate-screen-definition.js.map +1 -0
  155. package/dist/tools/validate-screen.d.ts +13 -0
  156. package/dist/tools/validate-screen.d.ts.map +1 -0
  157. package/dist/tools/validate-screen.js +106 -0
  158. package/dist/tools/validate-screen.js.map +1 -0
  159. package/dist/utils/dependency-extractor.d.ts +13 -0
  160. package/dist/utils/dependency-extractor.d.ts.map +1 -0
  161. package/dist/utils/dependency-extractor.js +232 -0
  162. package/dist/utils/dependency-extractor.js.map +1 -0
  163. package/dist/utils/error-handler.d.ts +29 -0
  164. package/dist/utils/error-handler.d.ts.map +1 -0
  165. package/dist/utils/error-handler.js +48 -0
  166. package/dist/utils/error-handler.js.map +1 -0
  167. package/dist/utils/logger.d.ts +8 -0
  168. package/dist/utils/logger.d.ts.map +1 -0
  169. package/dist/utils/logger.js +14 -0
  170. package/dist/utils/logger.js.map +1 -0
  171. package/dist/utils/package-json-reader.d.ts +37 -0
  172. package/dist/utils/package-json-reader.d.ts.map +1 -0
  173. package/dist/utils/package-json-reader.js +108 -0
  174. package/dist/utils/package-json-reader.js.map +1 -0
  175. package/dist/utils/tailwind-config-reader.d.ts +23 -0
  176. package/dist/utils/tailwind-config-reader.d.ts.map +1 -0
  177. package/dist/utils/tailwind-config-reader.js +81 -0
  178. package/dist/utils/tailwind-config-reader.js.map +1 -0
  179. package/package.json +72 -0
package/README.md ADDED
@@ -0,0 +1,980 @@
1
+ # @tekton/mcp-server
2
+
3
+ Tekton MCP Server v2.0.0 - stdio-based MCP protocol implementation for Claude Code.
4
+
5
+ ## Overview
6
+
7
+ MCP (Model Context Protocol) server enabling AI-driven blueprint generation, theme preview, and production code export for the Tekton design system.
8
+
9
+ **SPEC**: [SPEC-MCP-002 v2.0.0](../../.moai/specs/SPEC-MCP-002/spec.md) - stdio-based MCP Standard
10
+
11
+ ## Features
12
+
13
+ - **🤖 stdio MCP Protocol**: Claude Code native tool registration via JSON-RPC 2.0 (13 tools)
14
+ - **🎨 Theme Preview**: 13 built-in OKLCH-based themes with CSS variable generation
15
+ - **📋 Blueprint Generation**: Natural language → Blueprint JSON with validation
16
+ - **💾 Data-Only Output**: No file system writes, Claude Code handles file operations
17
+ - **🚀 Production Export**: JSX, TSX, Vue code generation
18
+ - **🏗️ Screen Generation** (SPEC-LAYOUT-002): JSON screen definition → Production code
19
+ - **✅ Screen Validation**: Validate screen definitions with helpful error suggestions
20
+ - **🏷️ Layout Tokens**: List shell, page, and section tokens from SPEC-LAYOUT-001
21
+ - **🧩 Component Discovery** (SPEC-MCP-003): Browse 30+ UI components with props and examples
22
+ - **📄 Template Discovery** (SPEC-MCP-003): Explore 13 screen templates with customization boundaries
23
+ - **🔒 Secure Design**: No previewUrl/filePath exposure, input validation, path traversal protection
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ pnpm install
29
+ ```
30
+
31
+ ## Authentication (Phase 4.1)
32
+
33
+ The MCP server supports optional API key authentication to enable access to premium themes.
34
+
35
+ ### Environment Variables
36
+
37
+ ```bash
38
+ # Required for premium theme access
39
+ TEKTON_API_KEY=tk_live_xxx...
40
+
41
+ # Optional: API endpoint (defaults to https://tekton-ui.com)
42
+ TEKTON_API_URL=https://tekton-ui.com # or http://localhost:3000 for dev
43
+ ```
44
+
45
+ ### Theme Access Tiers
46
+
47
+ **Free Themes** (No authentication required):
48
+
49
+ - `next-tailwind-shadcn`
50
+ - `vite-tailwind-shadcn`
51
+ - `next-styled-components`
52
+ - `next-tailwind-radix`
53
+ - `saas-modern`
54
+ - `tech-startup`
55
+
56
+ **Premium Themes** (Requires valid API key and license):
57
+
58
+ - `calm-wellness` - Serene wellness applications
59
+ - `dynamic-fitness` - Energetic fitness tracking
60
+ - `korean-fintech` - Professional financial services
61
+ - `media-streaming` - Video/audio streaming platforms
62
+ - `premium-editorial` - Sophisticated content platforms
63
+ - `saas-dashboard` - Modern SaaS dashboards
64
+ - `warm-humanist` - Warm and inviting experiences
65
+
66
+ ### Authentication Behavior
67
+
68
+ **Without API Key**:
69
+
70
+ - Server starts normally
71
+ - Only free themes are accessible
72
+ - Premium themes return authentication error
73
+
74
+ **With Valid API Key**:
75
+
76
+ - Server verifies key on startup (cached for 5 minutes)
77
+ - Free themes always accessible
78
+ - Licensed premium themes become accessible
79
+ - Unlicensed premium themes return license error
80
+
81
+ **With Invalid API Key**:
82
+
83
+ - Server logs error but continues running
84
+ - Falls back to free themes only
85
+ - Does not crash the server
86
+
87
+ ## Quick Start
88
+
89
+ ### 1. Build the Server
90
+
91
+ ```bash
92
+ pnpm install
93
+ pnpm build
94
+ ```
95
+
96
+ ### 2. Test with MCP Inspector
97
+
98
+ ```bash
99
+ pnpm inspect
100
+ # Opens browser at http://localhost:6274
101
+ ```
102
+
103
+ ### 3. Integrate with Claude Code
104
+
105
+ See [Claude Code Integration Guide](../../.moai/specs/SPEC-MCP-002/CLAUDE-CODE-INTEGRATION.md) for complete setup instructions.
106
+
107
+ **Quick Config** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
108
+
109
+ ```json
110
+ {
111
+ "mcpServers": {
112
+ "tekton": {
113
+ "command": "node",
114
+ "args": ["/absolute/path/to/tekton/packages/mcp-server/dist/index.js"],
115
+ "env": {
116
+ "NODE_ENV": "production",
117
+ "TEKTON_API_KEY": "tk_live_your_api_key_here",
118
+ "TEKTON_API_URL": "https://tekton-ui.com"
119
+ }
120
+ }
121
+ }
122
+ }
123
+ ```
124
+
125
+ **Note**: Remove `TEKTON_API_KEY` from env to run with free themes only.
126
+
127
+ ## MCP Tools
128
+
129
+ ### 1. Generate Blueprint
130
+
131
+ **Tool**: `generate-blueprint`
132
+
133
+ **Description**: Generate a UI blueprint from natural language description
134
+
135
+ **Input**:
136
+
137
+ ```json
138
+ {
139
+ "description": "User profile dashboard with avatar, bio, settings link",
140
+ "layout": "sidebar-left",
141
+ "themeId": "calm-wellness",
142
+ "componentHints": ["Card", "Avatar", "Button"]
143
+ }
144
+ ```
145
+
146
+ **Output** (Data-Only, v2.0.0):
147
+
148
+ ```json
149
+ {
150
+ "success": true,
151
+ "blueprint": {
152
+ "id": "bp-1738123456789-abc123",
153
+ "name": "User profile dashboard",
154
+ "themeId": "calm-wellness",
155
+ "layout": "sidebar-left",
156
+ "components": [...],
157
+ "timestamp": 1738123456789
158
+ }
159
+ }
160
+ ```
161
+
162
+ **Note**: `previewUrl` field removed in v2.0.0 (use SPEC-PLAYGROUND-001 for visual preview)
163
+
164
+ ### 2. Preview Theme
165
+
166
+ **Tool**: `preview-theme`
167
+
168
+ **Description**: Preview a Tekton theme and retrieve its design tokens
169
+
170
+ **Input**:
171
+
172
+ ```json
173
+ {
174
+ "themeId": "premium-editorial"
175
+ }
176
+ ```
177
+
178
+ **Output** (Data-Only, v2.0.0):
179
+
180
+ ```json
181
+ {
182
+ "success": true,
183
+ "theme": {
184
+ "id": "premium-editorial",
185
+ "name": "Premium Editorial",
186
+ "description": "Elegant magazine-style UI",
187
+ "cssVariables": {
188
+ "--color-primary": "oklch(0.2 0 0)",
189
+ "--color-secondary": "oklch(0.98 0 0)",
190
+ "--font-family": "Georgia",
191
+ "--border-radius": "0"
192
+ }
193
+ }
194
+ }
195
+ ```
196
+
197
+ **Note**: `previewUrl` field removed in v2.0.0
198
+
199
+ ### 3. Export Screen
200
+
201
+ **Tool**: `export-screen`
202
+
203
+ **Description**: Export a blueprint to production-ready code (TSX/JSX/Vue)
204
+
205
+ **Input** (v2.0.0: accepts blueprint object):
206
+
207
+ ```json
208
+ {
209
+ "blueprint": {
210
+ "id": "bp-1738123456789-abc123",
211
+ "name": "User Dashboard",
212
+ "themeId": "calm-wellness",
213
+ "layout": "sidebar-left",
214
+ "components": [],
215
+ "timestamp": 1738123456789
216
+ },
217
+ "format": "tsx"
218
+ }
219
+ ```
220
+
221
+ **Output** (Data-Only, v2.0.0):
222
+
223
+ ```json
224
+ {
225
+ "success": true,
226
+ "code": "import React from 'react';\n\nexport default function UserDashboard() { ... }"
227
+ }
228
+ ```
229
+
230
+ **Note**: `filePath` field removed in v2.0.0. Claude Code handles file writes.
231
+
232
+ ### 4. List Themes
233
+
234
+ **Tool**: `list-themes`
235
+
236
+ **Description**: List all available themes from `.moai/themes/generated/`
237
+
238
+ **Input**:
239
+
240
+ ```json
241
+ {}
242
+ ```
243
+
244
+ **Output**:
245
+
246
+ ```json
247
+ {
248
+ "success": true,
249
+ "themes": [
250
+ {
251
+ "id": "calm-wellness",
252
+ "name": "Calm Wellness",
253
+ "description": "Serene wellness applications",
254
+ "brandTone": "calm",
255
+ "schemaVersion": "2.1"
256
+ }
257
+ ],
258
+ "count": 13
259
+ }
260
+ ```
261
+
262
+ ## Screen Generation Tools (SPEC-LAYOUT-002 Phase 4)
263
+
264
+ ### 5. Generate Screen
265
+
266
+ **Tool**: `generate_screen`
267
+
268
+ **Description**: Generate production-ready code from JSON screen definition
269
+
270
+ **Input**:
271
+
272
+ ```json
273
+ {
274
+ "screenDefinition": {
275
+ "id": "user-dashboard",
276
+ "shell": "shell.web.dashboard",
277
+ "page": "page.dashboard",
278
+ "sections": [
279
+ {
280
+ "id": "header",
281
+ "token": "section.container",
282
+ "components": [
283
+ {
284
+ "type": "Heading",
285
+ "props": { "level": 1, "children": "Dashboard" }
286
+ }
287
+ ]
288
+ }
289
+ ]
290
+ },
291
+ "outputFormat": "react",
292
+ "options": {
293
+ "typescript": true,
294
+ "cssFramework": "styled-components"
295
+ }
296
+ }
297
+ ```
298
+
299
+ **Output**:
300
+
301
+ ```json
302
+ {
303
+ "success": true,
304
+ "code": "import React from 'react';\nimport styled from 'styled-components';\n\n...",
305
+ "cssVariables": ":root { --shell-header-height: 64px; ... }"
306
+ }
307
+ ```
308
+
309
+ **Output Formats**:
310
+
311
+ - `css-in-js`: Styled-components or Emotion
312
+ - `tailwind`: Tailwind CSS classes
313
+ - `react`: Pure React component with CSS variables
314
+
315
+ ### 6. Validate Screen
316
+
317
+ **Tool**: `validate_screen`
318
+
319
+ **Description**: Validate JSON screen definition with helpful feedback
320
+
321
+ **Input**:
322
+
323
+ ```json
324
+ {
325
+ "screenDefinition": {
326
+ "id": "test-screen",
327
+ "shell": "shell.web.app",
328
+ "page": "page.detail",
329
+ "sections": []
330
+ },
331
+ "strictMode": false
332
+ }
333
+ ```
334
+
335
+ **Output**:
336
+
337
+ ```json
338
+ {
339
+ "success": true,
340
+ "valid": true,
341
+ "errors": [],
342
+ "warnings": ["Optional field 'meta' not provided"],
343
+ "suggestions": [
344
+ {
345
+ "field": "shell",
346
+ "message": "Shell token must match pattern",
347
+ "suggestion": "Use format: shell.{platform}.{name}"
348
+ }
349
+ ]
350
+ }
351
+ ```
352
+
353
+ ### 7. List Tokens
354
+
355
+ **Tool**: `list_tokens`
356
+
357
+ **Description**: List available layout tokens from SPEC-LAYOUT-001
358
+
359
+ **Input**:
360
+
361
+ ```json
362
+ {
363
+ "tokenType": "shell",
364
+ "filter": "dashboard"
365
+ }
366
+ ```
367
+
368
+ **Output**:
369
+
370
+ ```json
371
+ {
372
+ "success": true,
373
+ "shells": [
374
+ {
375
+ "id": "shell.web.dashboard",
376
+ "name": "Web Dashboard Shell",
377
+ "description": "Dashboard application shell with header and sidebar",
378
+ "platform": "web"
379
+ }
380
+ ],
381
+ "metadata": {
382
+ "total": 1,
383
+ "filtered": 1
384
+ }
385
+ }
386
+ ```
387
+
388
+ **Token Types**:
389
+
390
+ - `shell`: Shell layout tokens (shell.web._, shell.mobile._)
391
+ - `page`: Page layout tokens (page.dashboard, page.detail, etc.)
392
+ - `section`: Section pattern tokens (section.grid-4, section.hero, etc.)
393
+ - `all`: All token types
394
+
395
+ ## Component & Template Discovery Tools (SPEC-MCP-003)
396
+
397
+ ### 8. List Components
398
+
399
+ **Tool**: `list-components`
400
+
401
+ **Description**: List all available UI components from @tekton/ui component catalog
402
+
403
+ **Input**:
404
+
405
+ ```json
406
+ {
407
+ "category": "core",
408
+ "search": "button"
409
+ }
410
+ ```
411
+
412
+ **Parameters**:
413
+
414
+ - `category` (optional): Filter by category - `'core' | 'complex' | 'advanced' | 'all'` (default: `'all'`)
415
+ - `search` (optional): Search components by name or description
416
+
417
+ **Output**:
418
+
419
+ ```json
420
+ {
421
+ "success": true,
422
+ "components": [
423
+ {
424
+ "id": "button",
425
+ "name": "Button",
426
+ "category": "core",
427
+ "description": "Interactive button with variants",
428
+ "variantsCount": 6,
429
+ "hasSubComponents": false,
430
+ "tier": 1
431
+ }
432
+ ],
433
+ "count": 15,
434
+ "categories": {
435
+ "core": 15,
436
+ "complex": 10,
437
+ "advanced": 5
438
+ }
439
+ }
440
+ ```
441
+
442
+ **Component Categories**:
443
+
444
+ - **core** (Tier 1): Button, Input, Label, Card, Badge, Avatar, Separator, Checkbox, RadioGroup, Switch, Textarea, Skeleton, ScrollArea, Form, Select
445
+ - **complex** (Tier 2): Dialog, DropdownMenu, Table, Tabs, Toast, Tooltip, Popover, Sheet, AlertDialog, Progress
446
+ - **advanced** (Tier 3): Sidebar, NavigationMenu, Breadcrumb, Command, Calendar
447
+
448
+ **Total Components**: 30+
449
+
450
+ ### 9. Preview Component
451
+
452
+ **Tool**: `preview-component`
453
+
454
+ **Description**: Get detailed information about a specific UI component including props, variants, sub-components, and usage examples
455
+
456
+ **Input**:
457
+
458
+ ```json
459
+ {
460
+ "componentId": "button",
461
+ "includeExamples": true,
462
+ "includeDependencies": true
463
+ }
464
+ ```
465
+
466
+ **Parameters**:
467
+
468
+ - `componentId` (required): Component ID (lowercase with hyphens, e.g., `'button'`, `'card'`, `'dialog'`)
469
+ - `includeExamples` (optional): Include usage examples (default: `true`)
470
+ - `includeDependencies` (optional): Include dependency information (default: `true`)
471
+
472
+ **Output**:
473
+
474
+ ```json
475
+ {
476
+ "success": true,
477
+ "component": {
478
+ "id": "button",
479
+ "name": "Button",
480
+ "category": "core",
481
+ "description": "Interactive button with variants",
482
+ "tier": 1,
483
+ "props": [
484
+ {
485
+ "name": "variant",
486
+ "type": "'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link'",
487
+ "required": false,
488
+ "defaultValue": "'default'",
489
+ "description": "Visual style variant"
490
+ },
491
+ {
492
+ "name": "size",
493
+ "type": "'default' | 'sm' | 'lg' | 'icon'",
494
+ "required": false,
495
+ "defaultValue": "'default'",
496
+ "description": "Button size"
497
+ }
498
+ ],
499
+ "variants": [
500
+ {
501
+ "name": "variant",
502
+ "value": "default",
503
+ "description": "Default blue button"
504
+ },
505
+ {
506
+ "name": "variant",
507
+ "value": "destructive",
508
+ "description": "Red destructive action"
509
+ }
510
+ ],
511
+ "importStatement": "import { Button } from '@tekton/ui';",
512
+ "dependencies": {
513
+ "internal": [],
514
+ "external": ["@radix-ui/react-slot"]
515
+ },
516
+ "examples": [
517
+ {
518
+ "title": "Basic Usage",
519
+ "code": "import { Button } from '@tekton/ui';\n\n<Button variant=\"default\">Click me</Button>",
520
+ "description": "Simple button with default variant"
521
+ }
522
+ ],
523
+ "accessibility": "Supports keyboard navigation and ARIA attributes"
524
+ }
525
+ }
526
+ ```
527
+
528
+ **Error Handling**: When component not found, returns error with list of available components
529
+
530
+ ### 10. List Screen Templates
531
+
532
+ **Tool**: `list-screen-templates`
533
+
534
+ **Description**: List all available screen templates from the Tekton template registry
535
+
536
+ **Input**:
537
+
538
+ ```json
539
+ {
540
+ "category": "auth",
541
+ "search": "login"
542
+ }
543
+ ```
544
+
545
+ **Parameters**:
546
+
547
+ - `category` (optional): Filter by category - `'auth' | 'dashboard' | 'form' | 'marketing' | 'feedback' | 'all'` (default: `'all'`)
548
+ - `search` (optional): Search templates by name or description
549
+
550
+ **Output**:
551
+
552
+ ```json
553
+ {
554
+ "success": true,
555
+ "templates": [
556
+ {
557
+ "id": "auth.login",
558
+ "name": "Login",
559
+ "category": "auth",
560
+ "description": "User authentication login screen",
561
+ "requiredComponentsCount": 5,
562
+ "layoutType": "centered",
563
+ "version": "1.0.0",
564
+ "tags": ["authentication", "form"]
565
+ }
566
+ ],
567
+ "count": 4,
568
+ "categories": {
569
+ "auth": 4,
570
+ "dashboard": 1,
571
+ "form": 0,
572
+ "marketing": 3,
573
+ "feedback": 5
574
+ }
575
+ }
576
+ ```
577
+
578
+ **Template Categories**:
579
+
580
+ - **auth**: login, signup, forgot-password, verification
581
+ - **marketing**: landing, preferences, profile
582
+ - **feedback**: loading, error, empty, confirmation, success
583
+ - **dashboard**: overview
584
+
585
+ **Total Templates**: 13
586
+
587
+ ### 11. Preview Screen Template
588
+
589
+ **Tool**: `preview-screen-template`
590
+
591
+ **Description**: Get detailed information about a specific screen template including skeleton structure, layout configuration, and customization boundaries
592
+
593
+ **Input**:
594
+
595
+ ```json
596
+ {
597
+ "templateId": "auth.login",
598
+ "includeLayoutTokens": true
599
+ }
600
+ ```
601
+
602
+ **Parameters**:
603
+
604
+ - `templateId` (required): Template ID in format `category.name` (e.g., `'auth.login'`, `'feedback.loading'`)
605
+ - `includeLayoutTokens` (optional): Include responsive layout tokens (default: `true`)
606
+
607
+ **Output**:
608
+
609
+ ```json
610
+ {
611
+ "success": true,
612
+ "template": {
613
+ "id": "auth.login",
614
+ "name": "Login",
615
+ "category": "auth",
616
+ "description": "User authentication login screen",
617
+ "version": "1.0.0",
618
+ "skeleton": {
619
+ "shell": "centered-card",
620
+ "page": "auth-page",
621
+ "sections": [
622
+ {
623
+ "id": "header",
624
+ "name": "Header",
625
+ "slot": "logo",
626
+ "required": true
627
+ },
628
+ {
629
+ "id": "form",
630
+ "name": "Form",
631
+ "slot": "main",
632
+ "required": true
633
+ }
634
+ ]
635
+ },
636
+ "layout": {
637
+ "type": "centered",
638
+ "responsive": {
639
+ "mobile": {
640
+ "padding": "1rem",
641
+ "gap": "1rem",
642
+ "columns": 1
643
+ },
644
+ "tablet": {
645
+ "padding": "2rem",
646
+ "gap": "1.5rem",
647
+ "columns": 1
648
+ },
649
+ "desktop": {
650
+ "padding": "2rem",
651
+ "gap": "2rem",
652
+ "columns": 1
653
+ }
654
+ }
655
+ },
656
+ "customizable": {
657
+ "texts": ["title", "subtitle", "button_label"],
658
+ "optional": ["social_login", "remember_me"],
659
+ "slots": ["logo", "footer", "socialLogin"]
660
+ },
661
+ "requiredComponents": ["Input", "Button", "Card", "Form", "Label"],
662
+ "importStatement": "import { LoginTemplate } from '@tekton/ui';",
663
+ "exampleProps": {
664
+ "texts": {
665
+ "title": "Welcome Back",
666
+ "subtitle": "Sign in to your account"
667
+ },
668
+ "options": {
669
+ "social_login": true,
670
+ "remember_me": true
671
+ }
672
+ },
673
+ "created": "2026-01-15",
674
+ "updated": "2026-01-20",
675
+ "tags": ["authentication", "form"]
676
+ }
677
+ }
678
+ ```
679
+
680
+ **Error Handling**: When template not found, returns error with list of available templates
681
+
682
+ **Use Cases**:
683
+
684
+ - AI agents exploring available templates
685
+ - Template integration planning
686
+ - Understanding customization boundaries
687
+ - Component dependency analysis
688
+
689
+ ## Usage Examples
690
+
691
+ ### From Claude Code
692
+
693
+ **Blueprint & Theme Workflows**:
694
+
695
+ ```
696
+ User: "Create a user dashboard with profile card using calm-wellness theme"
697
+ → Claude Code calls generate-blueprint
698
+ → Blueprint JSON returned
699
+
700
+ User: "Show me the premium-editorial theme"
701
+ → Claude Code calls preview-theme
702
+ → Theme metadata and CSS variables returned
703
+
704
+ User: "Export that dashboard as TypeScript React"
705
+ → Claude Code calls export-screen
706
+ → TSX code returned (ready to copy/paste)
707
+ ```
708
+
709
+ **Screen Generation Workflows**:
710
+
711
+ ```
712
+ User: "Generate a dashboard screen using shell.web.dashboard and page.dashboard"
713
+ → Claude Code calls generate_screen
714
+ → Production-ready React code with CSS variables returned
715
+
716
+ User: "What layout tokens are available for sections?"
717
+ → Claude Code calls list_tokens with tokenType='section'
718
+ → List of section tokens (grid-2, grid-3, hero, etc.) returned
719
+ ```
720
+
721
+ **Component Discovery Workflows** (SPEC-MCP-003):
722
+
723
+ ```
724
+ User: "What UI components are available?"
725
+ → Claude Code calls list-components
726
+ → List of 30+ components categorized by tier returned
727
+
728
+ User: "Show me details about the Button component"
729
+ → Claude Code calls preview-component with componentId='button'
730
+ → Props, variants, examples, and dependencies returned
731
+
732
+ User: "I need a dialog component. What are the props?"
733
+ → Claude Code calls preview-component with componentId='dialog'
734
+ → Complete Dialog component specification with sub-components returned
735
+ ```
736
+
737
+ **Template Discovery Workflows** (SPEC-MCP-003):
738
+
739
+ ```
740
+ User: "What screen templates are available for authentication?"
741
+ → Claude Code calls list-screen-templates with category='auth'
742
+ → 4 auth templates (login, signup, forgot-password, verification) returned
743
+
744
+ User: "Show me the login template structure"
745
+ → Claude Code calls preview-screen-template with templateId='auth.login'
746
+ → Skeleton, layout, customization boundaries, and required components returned
747
+
748
+ User: "What can I customize in the loading template?"
749
+ → Claude Code calls preview-screen-template with templateId='feedback.loading'
750
+ → Customizable texts, slots, and optional features returned
751
+ ```
752
+
753
+ See [Claude Code Integration Guide](../../.moai/specs/SPEC-MCP-002/CLAUDE-CODE-INTEGRATION.md) for complete examples.
754
+
755
+ ## Architecture
756
+
757
+ ```
758
+ packages/mcp-server/
759
+ ├── src/
760
+ │ ├── index.ts # stdio MCP server entry point (13 tools)
761
+ │ ├── tools/ # MCP tool implementations
762
+ │ │ ├── generate-blueprint.ts # Blueprint generation
763
+ │ │ ├── preview-theme.ts # Theme preview
764
+ │ │ ├── list-themes.ts # Theme listing
765
+ │ │ ├── list-icon-libraries.ts # Icon library listing
766
+ │ │ ├── preview-icon-library.ts # Icon library preview
767
+ │ │ ├── export-screen.ts # Blueprint export
768
+ │ │ ├── generate-screen.ts # Screen code generation (SPEC-LAYOUT-002)
769
+ │ │ ├── validate-screen.ts # Screen validation (SPEC-LAYOUT-002)
770
+ │ │ ├── list-tokens.ts # Layout token listing (SPEC-LAYOUT-002)
771
+ │ │ ├── list-components.ts # Component listing (SPEC-MCP-003)
772
+ │ │ ├── preview-component.ts # Component preview (SPEC-MCP-003)
773
+ │ │ ├── list-screen-templates.ts # Template listing (SPEC-MCP-003)
774
+ │ │ └── preview-screen-template.ts # Template preview (SPEC-MCP-003)
775
+ │ ├── data/ # Static data registries (SPEC-MCP-003)
776
+ │ │ ├── component-registry.ts # Component metadata registry
777
+ │ │ └── component-metadata.json # Static component metadata
778
+ │ ├── storage/ # Blueprint storage
779
+ │ │ ├── blueprint-storage.ts
780
+ │ │ └── timestamp-manager.ts
781
+ │ ├── schemas/ # Zod validation
782
+ │ │ └── mcp-schemas.ts
783
+ │ └── utils/ # Helper functions
784
+ │ ├── error-handler.ts
785
+ │ └── logger.ts # stderr-only logging
786
+ └── __tests__/ # Test suites
787
+ ├── tools/ # Tool tests
788
+ │ ├── generate-blueprint.test.ts
789
+ │ ├── preview-theme.test.ts
790
+ │ ├── export-screen.test.ts
791
+ │ ├── screen-tools.test.ts # SPEC-LAYOUT-002 Phase 4 tests
792
+ │ ├── list-components.test.ts # SPEC-MCP-003 tests
793
+ │ ├── preview-component.test.ts # SPEC-MCP-003 tests
794
+ │ ├── list-screen-templates.test.ts # SPEC-MCP-003 tests
795
+ │ └── preview-screen-template.test.ts # SPEC-MCP-003 tests
796
+ ├── mcp-protocol/ # JSON-RPC validation
797
+ ├── storage/ # Storage tests
798
+ └── utils/ # Utility tests
799
+ ```
800
+
801
+ **Key Changes in v2.0.0**:
802
+
803
+ - ✅ stdio transport (StdioServerTransport)
804
+ - ✅ JSON-RPC 2.0 protocol
805
+ - ✅ stderr-only logging (stdout reserved for MCP messages)
806
+ - ❌ HTTP endpoints removed (moved to SPEC-PLAYGROUND-001)
807
+ - ❌ previewUrl/filePath removed from outputs
808
+
809
+ ## Built-in Themes (13 Total)
810
+
811
+ 1. `calm-wellness` - Serene wellness applications
812
+ 2. `dynamic-fitness` - Energetic fitness tracking
813
+ 3. `korean-fintech` - Professional financial services
814
+ 4. `media-streaming` - Video/audio streaming platforms
815
+ 5. `next-styled-components` - Next.js with styled-components
816
+ 6. `next-tailwind-radix` - Next.js + Tailwind + Radix UI
817
+ 7. `next-tailwind-shadcn` - Next.js + Tailwind + shadcn/ui
818
+ 8. `premium-editorial` - Sophisticated content platforms
819
+ 9. `saas-dashboard` - Modern SaaS dashboards
820
+ 10. `saas-modern` - Clean SaaS applications
821
+ 11. `tech-startup` - Tech startup vibes
822
+ 12. `vite-tailwind-shadcn` - Vite + Tailwind + shadcn/ui
823
+ 13. `warm-humanist` - Warm and inviting experiences
824
+
825
+ **CSS Format**: All color values use OKLCH format for perceptual uniformity
826
+
827
+ ## Quality Metrics (SPEC-MCP-002 v2.0.0)
828
+
829
+ | Metric | Target | Current | Status |
830
+ | ---------------------------- | ------- | ---------- | ------ |
831
+ | **Test Coverage** | ≥ 85% | **94.39%** | ✅ |
832
+ | **TypeScript Errors** | 0 | **0** | ✅ |
833
+ | **Critical Vulnerabilities** | 0 | **0** | ✅ |
834
+ | **Tool Response Time** | < 500ms | < 100ms | ✅ |
835
+ | **Server Startup** | < 1s | < 500ms | ✅ |
836
+
837
+ **Test Results**:
838
+
839
+ - 22 test files
840
+ - 214 test cases
841
+ - 100% pass rate
842
+ - Zero failures
843
+
844
+ ## Integration with @tekton/core
845
+
846
+ All MCP tools reuse `@tekton/core` functions:
847
+
848
+ **Blueprint & Theme Tools**:
849
+
850
+ - `loadTheme()` - Theme loading
851
+ - `listThemes()` - Theme enumeration
852
+ - `createBlueprint()` - Blueprint creation
853
+ - `validateBlueprint()` - Schema validation
854
+ - `generateCSSVariables()` - CSS variable extraction
855
+ - `render()` - Code generation
856
+
857
+ **Screen Generation Tools** (SPEC-LAYOUT-002):
858
+
859
+ - `validateScreenDefinition()` - Screen validation
860
+ - `resolveScreen()` - Layout and component resolution
861
+ - `generateStyledComponents()` - CSS-in-JS generation
862
+ - `generateTailwindClasses()` - Tailwind CSS generation
863
+ - `generateReactComponent()` - React component generation
864
+ - `getAllShellTokens()` - Shell token listing
865
+ - `getAllPageLayoutTokens()` - Page token listing
866
+ - `getAllSectionPatternTokens()` - Section token listing
867
+
868
+ **Component & Template Discovery** (SPEC-MCP-003):
869
+
870
+ - `templateRegistry` from `@tekton/ui` - Template metadata and search
871
+ - Component metadata registry - Static component catalog with 30+ components
872
+ - Component type definitions - TypeScript interfaces for props and variants
873
+ - Template structure definitions - Skeleton, layout, and customization schemas
874
+
875
+ **Zero code duplication** - Single source of truth maintained.
876
+
877
+ ## Documentation
878
+
879
+ ### SPEC-MCP-002 v2.0.0 Documentation
880
+
881
+ - 📋 [Specification](../../.moai/specs/SPEC-MCP-002/spec.md) - Complete requirements
882
+ - 📐 [Implementation Plan](../../.moai/specs/SPEC-MCP-002/plan.md) - Development roadmap
883
+ - ✅ [Acceptance Criteria](../../.moai/specs/SPEC-MCP-002/acceptance.md) - AC-001 ~ AC-012
884
+ - 🔄 [Handover Document](../../.moai/specs/SPEC-MCP-002/HANDOVER.md) - Implementation details
885
+
886
+ ### SPEC-MCP-003 v1.0.0 Documentation (Component & Template Discovery)
887
+
888
+ - 📋 [Specification](../../.moai/specs/SPEC-MCP-003/spec.md) - Component & template discovery requirements
889
+ - 🧩 Component Registry - 30+ UI components with metadata
890
+ - 📄 Template Registry - 13 screen templates with customization boundaries
891
+
892
+ ### Integration Guides
893
+
894
+ - 🤖 [Claude Code Integration](../../.moai/specs/SPEC-MCP-002/CLAUDE-CODE-INTEGRATION.md) - Setup and usage
895
+ - ✅ [Phase 5 Results](../../.moai/specs/SPEC-MCP-002/PHASE-5-RESULTS.md) - MCP Inspector validation
896
+ - 🎯 [Phase 6 Completion](../../.moai/specs/SPEC-MCP-002/PHASE-6-COMPLETION.md) - Integration testing
897
+
898
+ ### Quick Links
899
+
900
+ - 🧪 [Test Coverage Report](./coverage/) - 94.39% coverage
901
+ - 🎨 [Theme System](../../packages/core/src/themes/) - 13 built-in themes
902
+ - 🧩 [UI Component Library](../../packages/ui/) - 30+ production-ready components
903
+ - 📄 [Template Registry](../../packages/ui/src/templates/) - 13 screen templates
904
+ - 🔧 [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector) - Protocol testing tool
905
+
906
+ ## Development
907
+
908
+ ```bash
909
+ # Install dependencies
910
+ pnpm install
911
+
912
+ # Build (TypeScript → dist/)
913
+ pnpm build
914
+
915
+ # Run tests
916
+ pnpm test
917
+
918
+ # Test with coverage
919
+ pnpm test:coverage
920
+
921
+ # Watch mode
922
+ pnpm dev
923
+
924
+ # Lint
925
+ pnpm lint
926
+
927
+ # Start MCP server (stdio)
928
+ pnpm start
929
+
930
+ # MCP Inspector (browser-based testing)
931
+ pnpm inspect
932
+ ```
933
+
934
+ ### Validation Scripts
935
+
936
+ ```bash
937
+ # Automated MCP protocol validation
938
+ node validate-mcp.mjs
939
+
940
+ # Manual testing with MCP Inspector
941
+ pnpm inspect
942
+ ```
943
+
944
+ ## Migration from v1.0.0 (HTTP) to v2.0.0 (stdio)
945
+
946
+ **Breaking Changes**:
947
+
948
+ - ❌ HTTP endpoints removed → stdio transport only
949
+ - ❌ `previewUrl` field removed from `generate-blueprint` and `preview-theme` outputs
950
+ - ❌ `filePath` field removed from `export-screen` output
951
+ - ❌ File system writes removed from `export-screen`
952
+ - ✅ `export-screen` now accepts `blueprint` object instead of `blueprintId`
953
+
954
+ **Why?**
955
+
956
+ - **Claude Code Integration**: stdio is the standard MCP transport
957
+ - **Data-Only Philosophy**: Claude Code handles all file operations
958
+ - **Security**: No file system side effects from MCP tools
959
+
960
+ **Visual Preview**: Use [SPEC-PLAYGROUND-001](../../.moai/specs/SPEC-PLAYGROUND-001/) for React-based rendering
961
+
962
+ ## Contributing
963
+
964
+ Contributions welcome! Please ensure:
965
+
966
+ - Tests pass (`pnpm test`)
967
+ - Coverage ≥ 85% (`pnpm test:coverage`)
968
+ - TypeScript strict mode compliance (`pnpm build`)
969
+ - MCP protocol validation (`node validate-mcp.mjs`)
970
+
971
+ ## License
972
+
973
+ MIT
974
+
975
+ ---
976
+
977
+ **Version**: 3.0.0 (stdio-based MCP standard + Component & Template Discovery)
978
+ **Last Updated**: 2026-02-01
979
+ **SPEC**: SPEC-MCP-002 v2.0.0, SPEC-LAYOUT-002 Phase 4, SPEC-MCP-003 v1.0.0
980
+ **Total Tools**: 13 (9 existing + 4 new discovery tools)