igniteui-theming 25.1.0 → 25.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.
Files changed (128) hide show
  1. package/dist/index.d.ts +75 -0
  2. package/dist/index.js +12 -0
  3. package/dist/json/components/bootstrap.json +1 -0
  4. package/dist/json/components/fluent.json +1 -0
  5. package/dist/json/components/indigo.json +1 -0
  6. package/dist/json/components/material.json +1 -0
  7. package/{json → dist/json}/components/themes.json +31 -1
  8. package/dist/mcp/generators/css.d.ts +7 -4
  9. package/dist/mcp/generators/css.js +129 -104
  10. package/dist/mcp/generators/sass.js +227 -254
  11. package/dist/mcp/index.js +259 -323
  12. package/dist/mcp/knowledge/color-usage.js +524 -502
  13. package/dist/mcp/knowledge/colors.js +61 -50
  14. package/dist/mcp/knowledge/component-metadata.js +697 -598
  15. package/dist/mcp/knowledge/component-themes.js +70 -57
  16. package/dist/mcp/knowledge/custom-palettes.js +4 -9
  17. package/dist/mcp/knowledge/docs/colors/guidance.js +4 -0
  18. package/dist/mcp/knowledge/docs/colors/usage.js +4 -0
  19. package/dist/mcp/knowledge/docs/layout/functions/border-radius.js +4 -0
  20. package/dist/mcp/knowledge/docs/layout/functions/pad.js +4 -0
  21. package/dist/mcp/knowledge/docs/layout/functions/sizable.js +4 -0
  22. package/dist/mcp/knowledge/docs/layout/mixins/sizable.js +4 -0
  23. package/dist/mcp/knowledge/docs/layout/mixins/sizing.js +4 -0
  24. package/dist/mcp/knowledge/docs/layout/mixins/spacing.js +4 -0
  25. package/dist/mcp/knowledge/docs/layout/overview.js +4 -0
  26. package/dist/mcp/knowledge/docs/setup/platform.js +4 -0
  27. package/dist/mcp/knowledge/elevations.d.ts +1 -1
  28. package/dist/mcp/knowledge/elevations.js +26 -12
  29. package/dist/mcp/knowledge/index.js +23 -87
  30. package/dist/mcp/knowledge/layout-docs.d.ts +1 -1
  31. package/dist/mcp/knowledge/multipliers.js +5 -0
  32. package/dist/mcp/knowledge/palettes.js +29 -17
  33. package/dist/mcp/knowledge/platforms/angular.js +98 -120
  34. package/dist/mcp/knowledge/platforms/blazor.js +39 -34
  35. package/dist/mcp/knowledge/platforms/common.js +83 -68
  36. package/dist/mcp/knowledge/platforms/index.js +265 -242
  37. package/dist/mcp/knowledge/platforms/react.js +43 -35
  38. package/dist/mcp/knowledge/platforms/webcomponents.js +266 -292
  39. package/dist/mcp/knowledge/sass-api.js +1 -0
  40. package/dist/mcp/knowledge/typography.js +13 -5
  41. package/dist/mcp/resources/index.js +1 -0
  42. package/dist/mcp/resources/presets.js +409 -508
  43. package/dist/mcp/theming/dist/json/colors/meta/multipliers.js +50 -0
  44. package/dist/mcp/theming/dist/json/colors/presets/palettes.js +85 -0
  45. package/dist/mcp/theming/dist/json/components/themes.js +5792 -0
  46. package/dist/mcp/theming/dist/json/elevations/indigo.js +29 -0
  47. package/dist/mcp/theming/dist/json/elevations/material.js +3 -0
  48. package/dist/mcp/theming/dist/json/typography/presets/typescales.js +621 -0
  49. package/dist/mcp/tools/descriptions.js +98 -154
  50. package/dist/mcp/tools/handlers/color.js +58 -56
  51. package/dist/mcp/tools/handlers/component-theme.js +163 -225
  52. package/dist/mcp/tools/handlers/component-tokens.js +159 -219
  53. package/dist/mcp/tools/handlers/custom-palette.js +138 -179
  54. package/dist/mcp/tools/handlers/elevations.js +27 -28
  55. package/dist/mcp/tools/handlers/index.js +11 -0
  56. package/dist/mcp/tools/handlers/layout.js +125 -176
  57. package/dist/mcp/tools/handlers/palette.js +105 -120
  58. package/dist/mcp/tools/handlers/platform.js +289 -311
  59. package/dist/mcp/tools/handlers/resource.js +22 -31
  60. package/dist/mcp/tools/handlers/theme.js +86 -103
  61. package/dist/mcp/tools/handlers/typography.js +29 -30
  62. package/dist/mcp/tools/index.js +13 -0
  63. package/dist/mcp/tools/schemas.js +239 -218
  64. package/dist/mcp/utils/color.js +277 -239
  65. package/dist/mcp/utils/preprocessing.js +57 -30
  66. package/dist/mcp/utils/result.js +43 -45
  67. package/dist/mcp/utils/sass.js +271 -191
  68. package/dist/mcp/utils/theming-resolve.d.ts +19 -0
  69. package/dist/mcp/utils/theming-resolve.js +57 -0
  70. package/dist/mcp/utils/types.js +96 -53
  71. package/dist/mcp/validators/custom-palette.js +218 -243
  72. package/dist/mcp/validators/index.js +3 -0
  73. package/dist/mcp/validators/palette.js +231 -229
  74. package/dist/tailwind/utilities/bootstrap.css +1 -0
  75. package/dist/tailwind/utilities/fluent.css +1 -0
  76. package/dist/tailwind/utilities/indigo.css +1 -0
  77. package/dist/tailwind/utilities/material.css +1 -0
  78. package/package.json +45 -64
  79. package/sass/json/README.md +12 -7
  80. package/sass/themes/_mixins.scss +1 -0
  81. package/sass/themes/components/button-group/_button-group-theme.scss +42 -0
  82. package/sass/themes/components/grid/_grid-theme.scss +1 -1
  83. package/sass/themes/schemas/components/dark/_button-group.scss +173 -50
  84. package/sass/themes/schemas/components/dark/_grid.scss +0 -16
  85. package/sass/themes/schemas/components/light/_button-group.scss +221 -99
  86. package/sass/themes/schemas/components/light/_grid.scss +14 -20
  87. package/LICENSE +0 -21
  88. package/README.md +0 -391
  89. package/dist/mcp/json/colors/presets/palettes.json.js +0 -13
  90. package/dist/mcp/json/components/themes.json.js +0 -143
  91. package/dist/mcp/json/elevations/indigo.json.js +0 -8
  92. package/dist/mcp/json/elevations/material.json.js +0 -8
  93. package/dist/mcp/json/typography/presets/typescales.json.js +0 -17
  94. package/dist/mcp/knowledge/docs/colors/guidance.md.js +0 -4
  95. package/dist/mcp/knowledge/docs/colors/usage.md.js +0 -4
  96. package/dist/mcp/knowledge/docs/layout/functions/border-radius.md.js +0 -4
  97. package/dist/mcp/knowledge/docs/layout/functions/pad.md.js +0 -4
  98. package/dist/mcp/knowledge/docs/layout/functions/sizable.md.js +0 -4
  99. package/dist/mcp/knowledge/docs/layout/mixins/sizable.md.js +0 -4
  100. package/dist/mcp/knowledge/docs/layout/mixins/sizing.md.js +0 -4
  101. package/dist/mcp/knowledge/docs/layout/mixins/spacing.md.js +0 -4
  102. package/dist/mcp/knowledge/docs/layout/overview.md.js +0 -4
  103. package/dist/mcp/knowledge/docs/setup/platform.md.js +0 -4
  104. package/dist/mcp/vite-env.d.ts +0 -18
  105. package/index.js +0 -5
  106. package/json/components/bootstrap.json +0 -1
  107. package/json/components/fluent.json +0 -1
  108. package/json/components/indigo.json +0 -1
  109. package/json/components/material.json +0 -1
  110. package/tailwind/utilities/bootstrap.css +0 -1
  111. package/tailwind/utilities/fluent.css +0 -1
  112. package/tailwind/utilities/indigo.css +0 -1
  113. package/tailwind/utilities/material.css +0 -1
  114. /package/{json → dist/json}/colors/meta/multipliers.json +0 -0
  115. /package/{json → dist/json}/colors/meta/palette.json +0 -0
  116. /package/{json → dist/json}/colors/presets/palettes.json +0 -0
  117. /package/{json → dist/json}/elevations/indigo.json +0 -0
  118. /package/{json → dist/json}/elevations/material.json +0 -0
  119. /package/{json → dist/json}/typography/presets/typescales.json +0 -0
  120. /package/{tailwind → dist/tailwind}/themes/base.css +0 -0
  121. /package/{tailwind → dist/tailwind}/themes/dark/bootstrap.css +0 -0
  122. /package/{tailwind → dist/tailwind}/themes/dark/fluent.css +0 -0
  123. /package/{tailwind → dist/tailwind}/themes/dark/indigo.css +0 -0
  124. /package/{tailwind → dist/tailwind}/themes/dark/material.css +0 -0
  125. /package/{tailwind → dist/tailwind}/themes/light/bootstrap.css +0 -0
  126. /package/{tailwind → dist/tailwind}/themes/light/fluent.css +0 -0
  127. /package/{tailwind → dist/tailwind}/themes/light/indigo.css +0 -0
  128. /package/{tailwind → dist/tailwind}/themes/light/material.css +0 -0
package/dist/mcp/index.js CHANGED
@@ -1,349 +1,285 @@
1
1
  #!/usr/bin/env node
2
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
- import { z } from "zod";
2
+ import { ACCENT_SHADE_LEVELS, PALETTE_COLOR_GROUPS, SHADE_LEVELS } from "./utils/types.js";
5
3
  import { RESOURCE_DEFINITIONS, getResourceContent } from "./resources/presets.js";
4
+ import "./resources/index.js";
6
5
  import { TOOL_DESCRIPTIONS } from "./tools/descriptions.js";
7
6
  import { handleGetColor } from "./tools/handlers/color.js";
8
7
  import { handleCreateComponentTheme } from "./tools/handlers/component-theme.js";
9
8
  import { handleGetComponentDesignTokens } from "./tools/handlers/component-tokens.js";
10
9
  import { handleCreateCustomPalette } from "./tools/handlers/custom-palette.js";
11
10
  import { handleCreateElevations } from "./tools/handlers/elevations.js";
12
- import { handleSetSize, handleSetSpacing, handleSetRoundness } from "./tools/handlers/layout.js";
11
+ import { handleSetRoundness, handleSetSize, handleSetSpacing } from "./tools/handlers/layout.js";
13
12
  import { handleCreatePalette } from "./tools/handlers/palette.js";
14
13
  import { handleDetectPlatform } from "./tools/handlers/platform.js";
15
14
  import { handleReadResource } from "./tools/handlers/resource.js";
16
15
  import { handleCreateTheme } from "./tools/handlers/theme.js";
17
16
  import { handleCreateTypography } from "./tools/handlers/typography.js";
18
- import { detectPlatformSchema, createPaletteSchema, createCustomPaletteSchema, createTypographySchema, createElevationsSchema, createThemeSchema, setSizeSchema, setSpacingInputSchema, setSpacingSchema, setRoundnessSchema, getComponentDesignTokensSchema, createComponentThemeSchema, getColorSchema, readResourceSchema } from "./tools/schemas.js";
17
+ import { createComponentThemeSchema, createCustomPaletteSchema, createElevationsSchema, createPaletteSchema, createThemeSchema, createTypographySchema, detectPlatformSchema, getColorSchema, getComponentDesignTokensSchema, readResourceSchema, setRoundnessSchema, setSizeSchema, setSpacingInputSchema, setSpacingSchema } from "./tools/schemas.js";
18
+ import "./tools/index.js";
19
19
  import { withPreprocessing } from "./utils/preprocessing.js";
20
- import { SHADE_LEVELS, ACCENT_SHADE_LEVELS, PALETTE_COLOR_GROUPS } from "./utils/types.js";
20
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
21
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
22
+ import { z } from "zod";
23
+ //#region src/index.ts
24
+ /**
25
+ * Ignite UI Theming MCP Server
26
+ *
27
+ * A Model Context Protocol server for generating Ignite UI theming code.
28
+ * Provides tools for creating palettes, typography, elevations, and complete themes.
29
+ */
30
+ /**
31
+ * Create and configure the MCP server.
32
+ */
21
33
  function createServer() {
22
- const server = new McpServer({
23
- name: "igniteui-theming",
24
- version: "v25.1.0",
25
- description: "Generate Sass theming code for Ignite UI components - create palettes, typography, elevations, and complete themes"
26
- });
27
- registerTools(server);
28
- registerResources(server);
29
- return server;
34
+ const server = new McpServer({
35
+ name: "igniteui-theming",
36
+ version: "v25.2.0",
37
+ description: "Generate Sass theming code for Ignite UI components - create palettes, typography, elevations, and complete themes"
38
+ });
39
+ registerTools(server);
40
+ registerResources(server);
41
+ return server;
30
42
  }
43
+ /**
44
+ * Register all theming tools.
45
+ */
31
46
  function registerTools(server) {
32
- server.registerTool(
33
- "detect_platform",
34
- {
35
- title: "Detect Target Platform",
36
- description: TOOL_DESCRIPTIONS.detect_platform,
37
- inputSchema: {
38
- packageJsonPath: detectPlatformSchema.shape.packageJsonPath
39
- }
40
- },
41
- async (params) => {
42
- const validated = detectPlatformSchema.parse(params);
43
- return handleDetectPlatform(validated);
44
- }
45
- );
46
- server.registerTool(
47
- "create_palette",
48
- {
49
- title: "Create Color Palette",
50
- description: TOOL_DESCRIPTIONS.create_palette,
51
- inputSchema: {
52
- platform: createPaletteSchema.shape.platform,
53
- licensed: createPaletteSchema.shape.licensed,
54
- variant: createPaletteSchema.shape.variant,
55
- name: createPaletteSchema.shape.name,
56
- output: createPaletteSchema.shape.output,
57
- primary: createPaletteSchema.shape.primary,
58
- secondary: createPaletteSchema.shape.secondary,
59
- surface: createPaletteSchema.shape.surface,
60
- gray: createPaletteSchema.shape.gray,
61
- info: createPaletteSchema.shape.info,
62
- success: createPaletteSchema.shape.success,
63
- warn: createPaletteSchema.shape.warn,
64
- error: createPaletteSchema.shape.error
65
- }
66
- },
67
- async (params) => {
68
- const validated = createPaletteSchema.parse(params);
69
- return await handleCreatePalette(validated);
70
- }
71
- );
72
- server.registerTool(
73
- "create_custom_palette",
74
- {
75
- title: "Create Custom Handmade Palette",
76
- description: TOOL_DESCRIPTIONS.create_custom_palette,
77
- inputSchema: {
78
- platform: createCustomPaletteSchema.shape.platform,
79
- licensed: createCustomPaletteSchema.shape.licensed,
80
- variant: createCustomPaletteSchema.shape.variant,
81
- designSystem: createCustomPaletteSchema.shape.designSystem,
82
- name: createCustomPaletteSchema.shape.name,
83
- output: createCustomPaletteSchema.shape.output,
84
- primary: createCustomPaletteSchema.shape.primary,
85
- secondary: createCustomPaletteSchema.shape.secondary,
86
- surface: createCustomPaletteSchema.shape.surface,
87
- gray: createCustomPaletteSchema.shape.gray,
88
- info: createCustomPaletteSchema.shape.info,
89
- success: createCustomPaletteSchema.shape.success,
90
- warn: createCustomPaletteSchema.shape.warn,
91
- error: createCustomPaletteSchema.shape.error
92
- }
93
- },
94
- withPreprocessing(createCustomPaletteSchema, handleCreateCustomPalette)
95
- );
96
- server.registerTool(
97
- "create_typography",
98
- {
99
- title: "Create Typography",
100
- description: TOOL_DESCRIPTIONS.create_typography,
101
- inputSchema: {
102
- platform: createTypographySchema.shape.platform,
103
- licensed: createTypographySchema.shape.licensed,
104
- fontFamily: createTypographySchema.shape.fontFamily,
105
- designSystem: createTypographySchema.shape.designSystem,
106
- customScale: createTypographySchema.shape.customScale,
107
- name: createTypographySchema.shape.name
108
- }
109
- },
110
- withPreprocessing(createTypographySchema, handleCreateTypography)
111
- );
112
- server.registerTool(
113
- "create_elevations",
114
- {
115
- title: "Create Elevations",
116
- description: TOOL_DESCRIPTIONS.create_elevations,
117
- inputSchema: {
118
- platform: createElevationsSchema.shape.platform,
119
- licensed: createElevationsSchema.shape.licensed,
120
- designSystem: createElevationsSchema.shape.designSystem,
121
- name: createElevationsSchema.shape.name
122
- }
123
- },
124
- async (params) => {
125
- const validated = createElevationsSchema.parse(params);
126
- return handleCreateElevations(validated);
127
- }
128
- );
129
- server.registerTool(
130
- "create_theme",
131
- {
132
- title: "Create Complete Theme",
133
- description: TOOL_DESCRIPTIONS.create_theme,
134
- inputSchema: {
135
- platform: createThemeSchema.shape.platform,
136
- licensed: createThemeSchema.shape.licensed,
137
- designSystem: createThemeSchema.shape.designSystem,
138
- primaryColor: createThemeSchema.shape.primaryColor,
139
- secondaryColor: createThemeSchema.shape.secondaryColor,
140
- surfaceColor: createThemeSchema.shape.surfaceColor,
141
- variant: createThemeSchema.shape.variant,
142
- name: createThemeSchema.shape.name,
143
- fontFamily: createThemeSchema.shape.fontFamily,
144
- includeTypography: createThemeSchema.shape.includeTypography,
145
- includeElevations: createThemeSchema.shape.includeElevations,
146
- includeSpacing: createThemeSchema.shape.includeSpacing
147
- }
148
- },
149
- async (params) => {
150
- const validated = createThemeSchema.parse(params);
151
- return await handleCreateTheme(validated);
152
- }
153
- );
154
- server.registerTool(
155
- "set_size",
156
- {
157
- title: "Set Size Scale",
158
- description: TOOL_DESCRIPTIONS.set_size,
159
- inputSchema: {
160
- platform: setSizeSchema.shape.platform,
161
- component: setSizeSchema.shape.component,
162
- scope: setSizeSchema.shape.scope,
163
- size: setSizeSchema.shape.size,
164
- output: setSizeSchema.shape.output
165
- }
166
- },
167
- async (params) => {
168
- const validated = setSizeSchema.parse(params);
169
- return handleSetSize(validated);
170
- }
171
- );
172
- server.registerTool(
173
- "set_spacing",
174
- {
175
- title: "Set Spacing Scale",
176
- description: TOOL_DESCRIPTIONS.set_spacing,
177
- inputSchema: {
178
- platform: setSpacingInputSchema.shape.platform,
179
- component: setSpacingInputSchema.shape.component,
180
- scope: setSpacingInputSchema.shape.scope,
181
- spacing: setSpacingInputSchema.shape.spacing,
182
- inline: setSpacingInputSchema.shape.inline,
183
- block: setSpacingInputSchema.shape.block,
184
- output: setSpacingInputSchema.shape.output
185
- }
186
- },
187
- async (params) => {
188
- const validated = setSpacingSchema.parse(params);
189
- return handleSetSpacing(validated);
190
- }
191
- );
192
- server.registerTool(
193
- "set_roundness",
194
- {
195
- title: "Set Roundness Scale",
196
- description: TOOL_DESCRIPTIONS.set_roundness,
197
- inputSchema: {
198
- platform: setRoundnessSchema.shape.platform,
199
- component: setRoundnessSchema.shape.component,
200
- scope: setRoundnessSchema.shape.scope,
201
- radiusFactor: setRoundnessSchema.shape.radiusFactor,
202
- output: setRoundnessSchema.shape.output
203
- }
204
- },
205
- async (params) => {
206
- const validated = setRoundnessSchema.parse(params);
207
- return handleSetRoundness(validated);
208
- }
209
- );
210
- server.registerTool(
211
- "get_component_design_tokens",
212
- {
213
- title: "Get Component Design Tokens",
214
- description: TOOL_DESCRIPTIONS.get_component_design_tokens,
215
- inputSchema: {
216
- component: getComponentDesignTokensSchema.shape.component
217
- }
218
- },
219
- async (params) => {
220
- const validated = getComponentDesignTokensSchema.parse(params);
221
- return await handleGetComponentDesignTokens(validated);
222
- }
223
- );
224
- server.registerTool(
225
- "create_component_theme",
226
- {
227
- title: "Create Component Theme",
228
- description: TOOL_DESCRIPTIONS.create_component_theme,
229
- inputSchema: {
230
- platform: createComponentThemeSchema.shape.platform,
231
- licensed: createComponentThemeSchema.shape.licensed,
232
- designSystem: createComponentThemeSchema.shape.designSystem,
233
- variant: createComponentThemeSchema.shape.variant,
234
- component: createComponentThemeSchema.shape.component,
235
- tokens: createComponentThemeSchema.shape.tokens,
236
- selector: createComponentThemeSchema.shape.selector,
237
- name: createComponentThemeSchema.shape.name,
238
- output: createComponentThemeSchema.shape.output
239
- }
240
- },
241
- withPreprocessing(createComponentThemeSchema, handleCreateComponentTheme)
242
- );
243
- server.registerTool(
244
- "get_color",
245
- {
246
- title: "Get Palette Color",
247
- description: TOOL_DESCRIPTIONS.get_color,
248
- inputSchema: {
249
- color: z.enum(PALETTE_COLOR_GROUPS),
250
- variant: z.enum([...SHADE_LEVELS, ...ACCENT_SHADE_LEVELS]).optional(),
251
- contrast: z.boolean().optional(),
252
- opacity: z.number().min(0).max(1).optional()
253
- }
254
- },
255
- async (params) => {
256
- const validated = getColorSchema.parse(params);
257
- return handleGetColor(validated);
258
- }
259
- );
260
- server.registerTool(
261
- "read_resource",
262
- {
263
- title: "Read Theming Resource",
264
- description: buildReadResourceDescription(),
265
- inputSchema: {
266
- uri: readResourceSchema.shape.uri
267
- }
268
- },
269
- async (params) => {
270
- const validated = readResourceSchema.parse(params);
271
- return handleReadResource(validated);
272
- }
273
- );
47
+ server.registerTool("detect_platform", {
48
+ title: "Detect Target Platform",
49
+ description: TOOL_DESCRIPTIONS.detect_platform,
50
+ inputSchema: { packageJsonPath: detectPlatformSchema.shape.packageJsonPath }
51
+ }, async (params) => {
52
+ return handleDetectPlatform(detectPlatformSchema.parse(params));
53
+ });
54
+ server.registerTool("create_palette", {
55
+ title: "Create Color Palette",
56
+ description: TOOL_DESCRIPTIONS.create_palette,
57
+ inputSchema: {
58
+ platform: createPaletteSchema.shape.platform,
59
+ licensed: createPaletteSchema.shape.licensed,
60
+ variant: createPaletteSchema.shape.variant,
61
+ name: createPaletteSchema.shape.name,
62
+ output: createPaletteSchema.shape.output,
63
+ primary: createPaletteSchema.shape.primary,
64
+ secondary: createPaletteSchema.shape.secondary,
65
+ surface: createPaletteSchema.shape.surface,
66
+ gray: createPaletteSchema.shape.gray,
67
+ info: createPaletteSchema.shape.info,
68
+ success: createPaletteSchema.shape.success,
69
+ warn: createPaletteSchema.shape.warn,
70
+ error: createPaletteSchema.shape.error
71
+ }
72
+ }, async (params) => {
73
+ return await handleCreatePalette(createPaletteSchema.parse(params));
74
+ });
75
+ server.registerTool("create_custom_palette", {
76
+ title: "Create Custom Handmade Palette",
77
+ description: TOOL_DESCRIPTIONS.create_custom_palette,
78
+ inputSchema: {
79
+ platform: createCustomPaletteSchema.shape.platform,
80
+ licensed: createCustomPaletteSchema.shape.licensed,
81
+ variant: createCustomPaletteSchema.shape.variant,
82
+ designSystem: createCustomPaletteSchema.shape.designSystem,
83
+ name: createCustomPaletteSchema.shape.name,
84
+ output: createCustomPaletteSchema.shape.output,
85
+ primary: createCustomPaletteSchema.shape.primary,
86
+ secondary: createCustomPaletteSchema.shape.secondary,
87
+ surface: createCustomPaletteSchema.shape.surface,
88
+ gray: createCustomPaletteSchema.shape.gray,
89
+ info: createCustomPaletteSchema.shape.info,
90
+ success: createCustomPaletteSchema.shape.success,
91
+ warn: createCustomPaletteSchema.shape.warn,
92
+ error: createCustomPaletteSchema.shape.error
93
+ }
94
+ }, withPreprocessing(createCustomPaletteSchema, handleCreateCustomPalette));
95
+ server.registerTool("create_typography", {
96
+ title: "Create Typography",
97
+ description: TOOL_DESCRIPTIONS.create_typography,
98
+ inputSchema: {
99
+ platform: createTypographySchema.shape.platform,
100
+ licensed: createTypographySchema.shape.licensed,
101
+ fontFamily: createTypographySchema.shape.fontFamily,
102
+ designSystem: createTypographySchema.shape.designSystem,
103
+ customScale: createTypographySchema.shape.customScale,
104
+ name: createTypographySchema.shape.name
105
+ }
106
+ }, withPreprocessing(createTypographySchema, handleCreateTypography));
107
+ server.registerTool("create_elevations", {
108
+ title: "Create Elevations",
109
+ description: TOOL_DESCRIPTIONS.create_elevations,
110
+ inputSchema: {
111
+ platform: createElevationsSchema.shape.platform,
112
+ licensed: createElevationsSchema.shape.licensed,
113
+ designSystem: createElevationsSchema.shape.designSystem,
114
+ name: createElevationsSchema.shape.name
115
+ }
116
+ }, async (params) => {
117
+ return handleCreateElevations(createElevationsSchema.parse(params));
118
+ });
119
+ server.registerTool("create_theme", {
120
+ title: "Create Complete Theme",
121
+ description: TOOL_DESCRIPTIONS.create_theme,
122
+ inputSchema: {
123
+ platform: createThemeSchema.shape.platform,
124
+ licensed: createThemeSchema.shape.licensed,
125
+ designSystem: createThemeSchema.shape.designSystem,
126
+ primaryColor: createThemeSchema.shape.primaryColor,
127
+ secondaryColor: createThemeSchema.shape.secondaryColor,
128
+ surfaceColor: createThemeSchema.shape.surfaceColor,
129
+ variant: createThemeSchema.shape.variant,
130
+ name: createThemeSchema.shape.name,
131
+ fontFamily: createThemeSchema.shape.fontFamily,
132
+ includeTypography: createThemeSchema.shape.includeTypography,
133
+ includeElevations: createThemeSchema.shape.includeElevations,
134
+ includeSpacing: createThemeSchema.shape.includeSpacing
135
+ }
136
+ }, async (params) => {
137
+ return await handleCreateTheme(createThemeSchema.parse(params));
138
+ });
139
+ server.registerTool("set_size", {
140
+ title: "Set Size Scale",
141
+ description: TOOL_DESCRIPTIONS.set_size,
142
+ inputSchema: {
143
+ platform: setSizeSchema.shape.platform,
144
+ component: setSizeSchema.shape.component,
145
+ scope: setSizeSchema.shape.scope,
146
+ size: setSizeSchema.shape.size,
147
+ output: setSizeSchema.shape.output
148
+ }
149
+ }, async (params) => {
150
+ return handleSetSize(setSizeSchema.parse(params));
151
+ });
152
+ server.registerTool("set_spacing", {
153
+ title: "Set Spacing Scale",
154
+ description: TOOL_DESCRIPTIONS.set_spacing,
155
+ inputSchema: {
156
+ platform: setSpacingInputSchema.shape.platform,
157
+ component: setSpacingInputSchema.shape.component,
158
+ scope: setSpacingInputSchema.shape.scope,
159
+ spacing: setSpacingInputSchema.shape.spacing,
160
+ inline: setSpacingInputSchema.shape.inline,
161
+ block: setSpacingInputSchema.shape.block,
162
+ output: setSpacingInputSchema.shape.output
163
+ }
164
+ }, async (params) => {
165
+ return handleSetSpacing(setSpacingSchema.parse(params));
166
+ });
167
+ server.registerTool("set_roundness", {
168
+ title: "Set Roundness Scale",
169
+ description: TOOL_DESCRIPTIONS.set_roundness,
170
+ inputSchema: {
171
+ platform: setRoundnessSchema.shape.platform,
172
+ component: setRoundnessSchema.shape.component,
173
+ scope: setRoundnessSchema.shape.scope,
174
+ radiusFactor: setRoundnessSchema.shape.radiusFactor,
175
+ output: setRoundnessSchema.shape.output
176
+ }
177
+ }, async (params) => {
178
+ return handleSetRoundness(setRoundnessSchema.parse(params));
179
+ });
180
+ server.registerTool("get_component_design_tokens", {
181
+ title: "Get Component Design Tokens",
182
+ description: TOOL_DESCRIPTIONS.get_component_design_tokens,
183
+ inputSchema: { component: getComponentDesignTokensSchema.shape.component }
184
+ }, async (params) => {
185
+ return await handleGetComponentDesignTokens(getComponentDesignTokensSchema.parse(params));
186
+ });
187
+ server.registerTool("create_component_theme", {
188
+ title: "Create Component Theme",
189
+ description: TOOL_DESCRIPTIONS.create_component_theme,
190
+ inputSchema: {
191
+ platform: createComponentThemeSchema.shape.platform,
192
+ licensed: createComponentThemeSchema.shape.licensed,
193
+ designSystem: createComponentThemeSchema.shape.designSystem,
194
+ variant: createComponentThemeSchema.shape.variant,
195
+ component: createComponentThemeSchema.shape.component,
196
+ tokens: createComponentThemeSchema.shape.tokens,
197
+ selector: createComponentThemeSchema.shape.selector,
198
+ name: createComponentThemeSchema.shape.name,
199
+ output: createComponentThemeSchema.shape.output
200
+ }
201
+ }, withPreprocessing(createComponentThemeSchema, handleCreateComponentTheme));
202
+ server.registerTool("get_color", {
203
+ title: "Get Palette Color",
204
+ description: TOOL_DESCRIPTIONS.get_color,
205
+ inputSchema: {
206
+ color: z.enum(PALETTE_COLOR_GROUPS),
207
+ variant: z.enum([...SHADE_LEVELS, ...ACCENT_SHADE_LEVELS]).optional(),
208
+ contrast: z.boolean().optional(),
209
+ opacity: z.number().min(0).max(1).optional()
210
+ }
211
+ }, async (params) => {
212
+ return handleGetColor(getColorSchema.parse(params));
213
+ });
214
+ server.registerTool("read_resource", {
215
+ title: "Read Theming Resource",
216
+ description: buildReadResourceDescription(),
217
+ inputSchema: { uri: readResourceSchema.shape.uri }
218
+ }, async (params) => {
219
+ return handleReadResource(readResourceSchema.parse(params));
220
+ });
274
221
  }
222
+ /**
223
+ * Build the read_resource tool description dynamically from RESOURCE_DEFINITIONS.
224
+ * Groups resources by URI path prefix and appends the catalog to the static description.
225
+ */
275
226
  function buildReadResourceDescription() {
276
- const groups = {
277
- Platforms: [],
278
- Presets: [],
279
- Guidance: [],
280
- "Layout Docs": []
281
- };
282
- for (const r of RESOURCE_DEFINITIONS) {
283
- if (r.uri.includes("://platforms")) {
284
- groups.Platforms.push(r);
285
- } else if (r.uri.includes("://presets/")) {
286
- groups.Presets.push(r);
287
- } else if (r.uri.includes("://guidance/")) {
288
- groups.Guidance.push(r);
289
- } else if (r.uri.includes("://docs/")) {
290
- groups["Layout Docs"].push(r);
291
- }
292
- }
293
- const lines = [
294
- TOOL_DESCRIPTIONS.read_resource,
295
- "",
296
- "<available_resources>"
297
- ];
298
- for (const [groupName, resources] of Object.entries(groups)) {
299
- if (resources.length === 0) continue;
300
- lines.push(` ${groupName}:`);
301
- for (const r of resources) {
302
- lines.push(` - "${r.uri}" — ${r.name}`);
303
- }
304
- }
305
- lines.push("</available_resources>");
306
- return lines.join("\n");
227
+ const groups = {
228
+ Platforms: [],
229
+ Presets: [],
230
+ Guidance: [],
231
+ "Layout Docs": []
232
+ };
233
+ for (const r of RESOURCE_DEFINITIONS) if (r.uri.includes("://platforms")) groups.Platforms.push(r);
234
+ else if (r.uri.includes("://presets/")) groups.Presets.push(r);
235
+ else if (r.uri.includes("://guidance/")) groups.Guidance.push(r);
236
+ else if (r.uri.includes("://docs/")) groups["Layout Docs"].push(r);
237
+ const lines = [
238
+ TOOL_DESCRIPTIONS.read_resource,
239
+ "",
240
+ "<available_resources>"
241
+ ];
242
+ for (const [groupName, resources] of Object.entries(groups)) {
243
+ if (resources.length === 0) continue;
244
+ lines.push(` ${groupName}:`);
245
+ for (const r of resources) lines.push(` - "${r.uri}" — ${r.name}`);
246
+ }
247
+ lines.push("</available_resources>");
248
+ return lines.join("\n");
307
249
  }
250
+ /**
251
+ * Register all theming resources.
252
+ */
308
253
  function registerResources(server) {
309
- for (const resource of RESOURCE_DEFINITIONS) {
310
- server.registerResource(
311
- resource.name.toLowerCase().replace(/\s+/g, "-"),
312
- resource.uri,
313
- {
314
- title: resource.name,
315
- description: resource.description,
316
- mimeType: resource.mimeType
317
- },
318
- async (uri) => {
319
- const content = getResourceContent(uri.href);
320
- if (!content) {
321
- throw new Error(`Resource not found: ${uri.href}`);
322
- }
323
- return {
324
- contents: [
325
- {
326
- uri: uri.href,
327
- mimeType: content.mimeType,
328
- text: content.content
329
- }
330
- ]
331
- };
332
- }
333
- );
334
- }
254
+ for (const resource of RESOURCE_DEFINITIONS) server.registerResource(resource.name.toLowerCase().replace(/\s+/g, "-"), resource.uri, {
255
+ title: resource.name,
256
+ description: resource.description,
257
+ mimeType: resource.mimeType
258
+ }, async (uri) => {
259
+ const content = getResourceContent(uri.href);
260
+ if (!content) throw new Error(`Resource not found: ${uri.href}`);
261
+ return { contents: [{
262
+ uri: uri.href,
263
+ mimeType: content.mimeType,
264
+ text: content.content
265
+ }] };
266
+ });
335
267
  }
268
+ /**
269
+ * Main entry point - start the MCP server with STDIO transport.
270
+ */
336
271
  async function main() {
337
- const server = createServer();
338
- const transport = new StdioServerTransport();
339
- await server.connect(transport);
340
- const shutdown = async () => {
341
- await server.close();
342
- process.exit(0);
343
- };
344
- process.on("SIGINT", shutdown);
345
- process.on("SIGTERM", shutdown);
272
+ const server = createServer();
273
+ const transport = new StdioServerTransport();
274
+ await server.connect(transport);
275
+ const shutdown = async () => {
276
+ await server.close();
277
+ process.exit(0);
278
+ };
279
+ process.on("SIGINT", shutdown);
280
+ process.on("SIGTERM", shutdown);
346
281
  }
347
282
  main().catch((_error) => {
348
- process.exit(1);
283
+ process.exit(1);
349
284
  });
285
+ //#endregion