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.
- package/dist/index.d.ts +75 -0
- package/dist/index.js +12 -0
- package/dist/json/components/bootstrap.json +1 -0
- package/dist/json/components/fluent.json +1 -0
- package/dist/json/components/indigo.json +1 -0
- package/dist/json/components/material.json +1 -0
- package/{json → dist/json}/components/themes.json +31 -1
- package/dist/mcp/generators/css.d.ts +7 -4
- package/dist/mcp/generators/css.js +129 -104
- package/dist/mcp/generators/sass.js +227 -254
- package/dist/mcp/index.js +259 -323
- package/dist/mcp/knowledge/color-usage.js +524 -502
- package/dist/mcp/knowledge/colors.js +61 -50
- package/dist/mcp/knowledge/component-metadata.js +697 -598
- package/dist/mcp/knowledge/component-themes.js +70 -57
- package/dist/mcp/knowledge/custom-palettes.js +4 -9
- package/dist/mcp/knowledge/docs/colors/guidance.js +4 -0
- package/dist/mcp/knowledge/docs/colors/usage.js +4 -0
- package/dist/mcp/knowledge/docs/layout/functions/border-radius.js +4 -0
- package/dist/mcp/knowledge/docs/layout/functions/pad.js +4 -0
- package/dist/mcp/knowledge/docs/layout/functions/sizable.js +4 -0
- package/dist/mcp/knowledge/docs/layout/mixins/sizable.js +4 -0
- package/dist/mcp/knowledge/docs/layout/mixins/sizing.js +4 -0
- package/dist/mcp/knowledge/docs/layout/mixins/spacing.js +4 -0
- package/dist/mcp/knowledge/docs/layout/overview.js +4 -0
- package/dist/mcp/knowledge/docs/setup/platform.js +4 -0
- package/dist/mcp/knowledge/elevations.d.ts +1 -1
- package/dist/mcp/knowledge/elevations.js +26 -12
- package/dist/mcp/knowledge/index.js +23 -87
- package/dist/mcp/knowledge/layout-docs.d.ts +1 -1
- package/dist/mcp/knowledge/multipliers.js +5 -0
- package/dist/mcp/knowledge/palettes.js +29 -17
- package/dist/mcp/knowledge/platforms/angular.js +98 -120
- package/dist/mcp/knowledge/platforms/blazor.js +39 -34
- package/dist/mcp/knowledge/platforms/common.js +83 -68
- package/dist/mcp/knowledge/platforms/index.js +265 -242
- package/dist/mcp/knowledge/platforms/react.js +43 -35
- package/dist/mcp/knowledge/platforms/webcomponents.js +266 -292
- package/dist/mcp/knowledge/sass-api.js +1 -0
- package/dist/mcp/knowledge/typography.js +13 -5
- package/dist/mcp/resources/index.js +1 -0
- package/dist/mcp/resources/presets.js +409 -508
- package/dist/mcp/theming/dist/json/colors/meta/multipliers.js +50 -0
- package/dist/mcp/theming/dist/json/colors/presets/palettes.js +85 -0
- package/dist/mcp/theming/dist/json/components/themes.js +5792 -0
- package/dist/mcp/theming/dist/json/elevations/indigo.js +29 -0
- package/dist/mcp/theming/dist/json/elevations/material.js +3 -0
- package/dist/mcp/theming/dist/json/typography/presets/typescales.js +621 -0
- package/dist/mcp/tools/descriptions.js +98 -154
- package/dist/mcp/tools/handlers/color.js +58 -56
- package/dist/mcp/tools/handlers/component-theme.js +163 -225
- package/dist/mcp/tools/handlers/component-tokens.js +159 -219
- package/dist/mcp/tools/handlers/custom-palette.js +138 -179
- package/dist/mcp/tools/handlers/elevations.js +27 -28
- package/dist/mcp/tools/handlers/index.js +11 -0
- package/dist/mcp/tools/handlers/layout.js +125 -176
- package/dist/mcp/tools/handlers/palette.js +105 -120
- package/dist/mcp/tools/handlers/platform.js +289 -311
- package/dist/mcp/tools/handlers/resource.js +22 -31
- package/dist/mcp/tools/handlers/theme.js +86 -103
- package/dist/mcp/tools/handlers/typography.js +29 -30
- package/dist/mcp/tools/index.js +13 -0
- package/dist/mcp/tools/schemas.js +239 -218
- package/dist/mcp/utils/color.js +277 -239
- package/dist/mcp/utils/preprocessing.js +57 -30
- package/dist/mcp/utils/result.js +43 -45
- package/dist/mcp/utils/sass.js +271 -191
- package/dist/mcp/utils/theming-resolve.d.ts +19 -0
- package/dist/mcp/utils/theming-resolve.js +57 -0
- package/dist/mcp/utils/types.js +96 -53
- package/dist/mcp/validators/custom-palette.js +218 -243
- package/dist/mcp/validators/index.js +3 -0
- package/dist/mcp/validators/palette.js +231 -229
- package/dist/tailwind/utilities/bootstrap.css +1 -0
- package/dist/tailwind/utilities/fluent.css +1 -0
- package/dist/tailwind/utilities/indigo.css +1 -0
- package/dist/tailwind/utilities/material.css +1 -0
- package/package.json +45 -64
- package/sass/json/README.md +12 -7
- package/sass/themes/_mixins.scss +1 -0
- package/sass/themes/components/button-group/_button-group-theme.scss +42 -0
- package/sass/themes/components/grid/_grid-theme.scss +1 -1
- package/sass/themes/schemas/components/dark/_button-group.scss +173 -50
- package/sass/themes/schemas/components/dark/_grid.scss +0 -16
- package/sass/themes/schemas/components/light/_button-group.scss +221 -99
- package/sass/themes/schemas/components/light/_grid.scss +14 -20
- package/LICENSE +0 -21
- package/README.md +0 -391
- package/dist/mcp/json/colors/presets/palettes.json.js +0 -13
- package/dist/mcp/json/components/themes.json.js +0 -143
- package/dist/mcp/json/elevations/indigo.json.js +0 -8
- package/dist/mcp/json/elevations/material.json.js +0 -8
- package/dist/mcp/json/typography/presets/typescales.json.js +0 -17
- package/dist/mcp/knowledge/docs/colors/guidance.md.js +0 -4
- package/dist/mcp/knowledge/docs/colors/usage.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/functions/border-radius.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/functions/pad.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/functions/sizable.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/mixins/sizable.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/mixins/sizing.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/mixins/spacing.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/overview.md.js +0 -4
- package/dist/mcp/knowledge/docs/setup/platform.md.js +0 -4
- package/dist/mcp/vite-env.d.ts +0 -18
- package/index.js +0 -5
- package/json/components/bootstrap.json +0 -1
- package/json/components/fluent.json +0 -1
- package/json/components/indigo.json +0 -1
- package/json/components/material.json +0 -1
- package/tailwind/utilities/bootstrap.css +0 -1
- package/tailwind/utilities/fluent.css +0 -1
- package/tailwind/utilities/indigo.css +0 -1
- package/tailwind/utilities/material.css +0 -1
- /package/{json → dist/json}/colors/meta/multipliers.json +0 -0
- /package/{json → dist/json}/colors/meta/palette.json +0 -0
- /package/{json → dist/json}/colors/presets/palettes.json +0 -0
- /package/{json → dist/json}/elevations/indigo.json +0 -0
- /package/{json → dist/json}/elevations/material.json +0 -0
- /package/{json → dist/json}/typography/presets/typescales.json +0 -0
- /package/{tailwind → dist/tailwind}/themes/base.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/dark/bootstrap.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/dark/fluent.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/dark/indigo.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/dark/material.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/light/bootstrap.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/light/fluent.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/light/indigo.css +0 -0
- /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 {
|
|
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
|
|
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 {
|
|
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 {
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
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
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
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
|
-
|
|
283
|
+
process.exit(1);
|
|
349
284
|
});
|
|
285
|
+
//#endregion
|