@nysds/mcp-server 1.15.1 → 1.16.0-alpha5

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 (39) hide show
  1. package/README.md +40 -44
  2. package/data/guides/fonts.md +77 -0
  3. package/data/guides/form-validation.md +169 -0
  4. package/data/guides/frameworks/angular.md +71 -0
  5. package/data/guides/frameworks/dotnet.md +42 -0
  6. package/data/guides/frameworks/drupal.md +39 -0
  7. package/data/guides/frameworks/react.md +45 -0
  8. package/data/guides/frameworks/vanilla.md +45 -0
  9. package/data/guides/installation.md +73 -0
  10. package/data/guides/page-structure.md +160 -0
  11. package/data/guides/styles.md +48 -0
  12. package/dist/lib/cem-parser.d.ts +6 -0
  13. package/dist/lib/cem-parser.d.ts.map +1 -1
  14. package/dist/lib/cem-parser.js +18 -9
  15. package/dist/lib/format.d.ts +22 -0
  16. package/dist/lib/format.d.ts.map +1 -0
  17. package/dist/lib/format.js +33 -0
  18. package/dist/prompts/nysds-mode.d.ts.map +1 -1
  19. package/dist/prompts/nysds-mode.js +17 -8
  20. package/dist/resources/guides.d.ts.map +1 -1
  21. package/dist/resources/guides.js +22 -26
  22. package/dist/tools/component-tools.d.ts +3 -5
  23. package/dist/tools/component-tools.d.ts.map +1 -1
  24. package/dist/tools/component-tools.js +51 -85
  25. package/dist/tools/guide-tools.d.ts +9 -0
  26. package/dist/tools/guide-tools.d.ts.map +1 -0
  27. package/dist/tools/guide-tools.js +78 -0
  28. package/dist/tools/index.d.ts.map +1 -1
  29. package/dist/tools/index.js +4 -0
  30. package/dist/tools/token-tools.d.ts +2 -5
  31. package/dist/tools/token-tools.d.ts.map +1 -1
  32. package/dist/tools/token-tools.js +88 -108
  33. package/dist/tools/utility-tools.d.ts +8 -0
  34. package/dist/tools/utility-tools.d.ts.map +1 -0
  35. package/dist/tools/utility-tools.js +282 -0
  36. package/dist/tools/validation-tools.d.ts +1 -2
  37. package/dist/tools/validation-tools.d.ts.map +1 -1
  38. package/dist/tools/validation-tools.js +1 -163
  39. package/package.json +3 -2
@@ -0,0 +1,282 @@
1
+ /**
2
+ * Utility Tools
3
+ *
4
+ * MCP tools for NYSDS utility classes.
5
+ */
6
+ import { z } from "zod";
7
+ const UTILITY_DOCS = {
8
+ grid: `## Grid System
9
+
10
+ NYSDS provides a 12-column responsive grid system.
11
+
12
+ ### Structure
13
+ \`\`\`html
14
+ <div class="nys-grid-container">
15
+ <div class="nys-grid-row">
16
+ <div class="nys-grid-col-6">Half width</div>
17
+ <div class="nys-grid-col-6">Half width</div>
18
+ </div>
19
+ </div>
20
+ \`\`\`
21
+
22
+ ### Column Classes
23
+ - \`nys-grid-col-[1-12]\` - Fixed column widths (1-12 columns)
24
+ - \`nys-grid-col\` - Equal width columns (auto-distributes)
25
+ - \`nys-grid-col-auto\` - Column sized to content
26
+ - \`nys-grid-col-fill\` - Column fills remaining space
27
+
28
+ ### Gap Classes
29
+ - \`nys-grid-gap\` - Default gap between columns
30
+ - \`nys-grid-gap-sm\` - Small gap
31
+ - \`nys-grid-gap-lg\` - Large gap
32
+
33
+ ### Offset Classes
34
+ - \`nys-grid-offset-[1-12]\` - Offset column by 1-12 columns
35
+
36
+ ### Example: Form with Sidebar
37
+ \`\`\`html
38
+ <div class="nys-grid-container">
39
+ <div class="nys-grid-row">
40
+ <div class="nys-grid-col-12 nys-desktop:nys-grid-col-4">
41
+ <!-- Sidebar content (stepper, navigation) -->
42
+ </div>
43
+ <div class="nys-grid-col-12 nys-desktop:nys-grid-col-8">
44
+ <!-- Main content (form) -->
45
+ </div>
46
+ </div>
47
+ </div>
48
+ \`\`\``,
49
+ flex: `## Flexbox Utilities
50
+
51
+ ### Display
52
+ - \`nys-display-flex\` - Sets display: flex
53
+
54
+ ### Direction
55
+ - \`nys-flex-row\` - Row direction (default)
56
+ - \`nys-flex-column\` - Column direction
57
+
58
+ ### Wrapping
59
+ - \`nys-flex-wrap\` - Allow items to wrap
60
+ - \`nys-flex-no-wrap\` - Prevent wrapping
61
+
62
+ ### Alignment (Cross Axis)
63
+ - \`nys-flex-align-start\` - Align items to start
64
+ - \`nys-flex-align-center\` - Align items to center
65
+ - \`nys-flex-align-end\` - Align items to end
66
+ - \`nys-flex-align-stretch\` - Stretch items to fill
67
+
68
+ ### Justification (Main Axis)
69
+ - \`nys-flex-justify-start\` - Justify to start
70
+ - \`nys-flex-justify-center\` - Justify to center
71
+ - \`nys-flex-justify-end\` - Justify to end
72
+
73
+ ### Flex Sizing
74
+ - \`nys-flex-[1-12]\` - Flex grow/shrink values
75
+ - \`nys-flex-auto\` - flex: auto (grow and shrink)
76
+ - \`nys-flex-fill\` - Fill available space
77
+
78
+ ### Example: Button Group
79
+ \`\`\`html
80
+ <div class="nys-display-flex nys-flex-justify-end nys-flex-gap-200">
81
+ <nys-button label="Cancel" variant="outline"></nys-button>
82
+ <nys-button label="Submit"></nys-button>
83
+ </div>
84
+ \`\`\``,
85
+ spacing: `## Spacing Utilities
86
+
87
+ Pattern: \`nys-{property}-{direction}-{value}\`
88
+
89
+ ### Properties
90
+ - \`margin\` - External spacing
91
+ - \`padding\` - Internal spacing
92
+
93
+ ### Directions
94
+ - \`t\` - Top
95
+ - \`r\` - Right
96
+ - \`b\` - Bottom
97
+ - \`l\` - Left
98
+ - \`x\` - Horizontal (left + right)
99
+ - \`y\` - Vertical (top + bottom)
100
+ - (none) - All sides
101
+
102
+ ### Values
103
+ - \`0\` - 0
104
+ - \`1px\` - 1px
105
+ - \`2px\` - 2px
106
+ - \`50\` - var(--nys-space-50) = 0.125rem (2px)
107
+ - \`100\` - var(--nys-space-100) = 0.25rem (4px)
108
+ - \`150\` - var(--nys-space-150) = 0.375rem (6px)
109
+ - \`200\` - var(--nys-space-200) = 0.5rem (8px)
110
+ - \`250\` - var(--nys-space-250) = 0.625rem (10px)
111
+ - \`300\` - var(--nys-space-300) = 0.75rem (12px)
112
+ - \`400\` - var(--nys-space-400) = 1rem (16px)
113
+ - \`500\` - var(--nys-space-500) = 1.25rem (20px)
114
+ - \`600\` - var(--nys-space-600) = 1.5rem (24px)
115
+ - \`700\` - var(--nys-space-700) = 2rem (32px)
116
+ - \`800\` - var(--nys-space-800) = 2.5rem (40px)
117
+ - \`1200\` - var(--nys-space-1200) = 4rem (64px)
118
+
119
+ ### Examples
120
+ \`\`\`html
121
+ <!-- Add bottom margin to an alert -->
122
+ <nys-alert class="nys-margin-b-300">...</nys-alert>
123
+
124
+ <!-- Add padding to a container -->
125
+ <div class="nys-padding-400">...</div>
126
+
127
+ <!-- Horizontal margin -->
128
+ <div class="nys-margin-x-200">...</div>
129
+ \`\`\``,
130
+ display: `## Display Utilities
131
+
132
+ - \`nys-display-none\` - Hide element
133
+ - \`nys-display-block\` - Block display
134
+ - \`nys-display-inline\` - Inline display
135
+ - \`nys-display-inline-block\` - Inline-block display
136
+ - \`nys-display-flex\` - Flex display
137
+
138
+ ### Example: Hide on Mobile
139
+ \`\`\`html
140
+ <div class="nys-display-none nys-tablet:nys-display-block">
141
+ Only visible on tablet and larger
142
+ </div>
143
+ \`\`\``,
144
+ opacity: `## Opacity Utilities
145
+
146
+ - \`nys-opacity-0\` - Fully transparent
147
+ - \`nys-opacity-25\` - 25% opacity
148
+ - \`nys-opacity-50\` - 50% opacity
149
+ - \`nys-opacity-75\` - 75% opacity
150
+ - \`nys-opacity-100\` - Fully opaque`,
151
+ zindex: `## Z-Index Utilities
152
+
153
+ - \`nys-z-0\` - z-index: 0
154
+ - \`nys-z-10\` - z-index: 10
155
+ - \`nys-z-20\` - z-index: 20
156
+ - \`nys-z-30\` - z-index: 30
157
+ - \`nys-z-40\` - z-index: 40
158
+ - \`nys-z-50\` - z-index: 50
159
+ - \`nys-z-auto\` - z-index: auto`,
160
+ typography: `## Typography Utilities
161
+
162
+ ### Text Alignment
163
+ - \`nys-text-left\` - Left align text
164
+ - \`nys-text-center\` - Center align text
165
+ - \`nys-text-right\` - Right align text
166
+
167
+ ### Font Weight
168
+ - \`nys-font-normal\` - Normal weight
169
+ - \`nys-font-medium\` - Medium weight
170
+ - \`nys-font-semibold\` - Semibold weight
171
+ - \`nys-font-bold\` - Bold weight
172
+
173
+ ### Text Transform
174
+ - \`nys-text-uppercase\` - Uppercase text
175
+ - \`nys-text-lowercase\` - Lowercase text
176
+ - \`nys-text-capitalize\` - Capitalize text`,
177
+ responsive: `## Responsive Breakpoints
178
+
179
+ NYSDS utility classes support responsive prefixes.
180
+
181
+ ### Breakpoints
182
+ - (no prefix) - All screen sizes (mobile-first)
183
+ - \`nys-mobile-lg:\` - 30em (480px) and up
184
+ - \`nys-tablet:\` - 40em (640px) and up
185
+ - \`nys-desktop:\` - 64em (1024px) and up
186
+
187
+ ### Pattern
188
+ \`nys-{breakpoint}:nys-{class}\`
189
+
190
+ ### Examples
191
+ \`\`\`html
192
+ <!-- Full width on mobile, half on tablet, third on desktop -->
193
+ <div class="nys-grid-col-12 nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-4">
194
+ Responsive column
195
+ </div>
196
+
197
+ <!-- Stack on mobile, row on tablet -->
198
+ <div class="nys-display-flex nys-flex-column nys-tablet:nys-flex-row">
199
+ Responsive flex direction
200
+ </div>
201
+
202
+ <!-- Hide on mobile, show on desktop -->
203
+ <div class="nys-display-none nys-desktop:nys-display-block">
204
+ Desktop only content
205
+ </div>
206
+ \`\`\``,
207
+ componentSpacing: `## Component Spacing
208
+
209
+ When adding spacing around NYSDS components, use utility classes rather than wrapper elements.
210
+
211
+ ### Examples
212
+ \`\`\`html
213
+ <!-- Add bottom margin to an alert -->
214
+ <nys-alert class="nys-margin-b-300" type="info">
215
+ This alert has bottom margin.
216
+ </nys-alert>
217
+
218
+ <!-- Add top margin to a button -->
219
+ <nys-button class="nys-margin-t-400" label="Submit"></nys-button>
220
+
221
+ <!-- Stack form fields with consistent spacing -->
222
+ <nys-textinput class="nys-margin-b-300" label="First Name"></nys-textinput>
223
+ <nys-textinput class="nys-margin-b-300" label="Last Name"></nys-textinput>
224
+ <nys-textinput class="nys-margin-b-400" label="Email"></nys-textinput>
225
+ <nys-button label="Submit"></nys-button>
226
+ \`\`\``,
227
+ };
228
+ export function registerUtilityTools(server) {
229
+ // get_utility_classes - Comprehensive utility class reference
230
+ server.tool("get_utility_classes", "Get NYSDS utility class reference for layout, spacing, and styling", {
231
+ category: z
232
+ .enum([
233
+ "grid",
234
+ "flex",
235
+ "spacing",
236
+ "display",
237
+ "opacity",
238
+ "zindex",
239
+ "typography",
240
+ "responsive",
241
+ "all",
242
+ ])
243
+ .optional()
244
+ .describe("Category of utility classes to retrieve. Defaults to 'all'."),
245
+ }, async ({ category = "all" }) => {
246
+ let content;
247
+ if (category === "all") {
248
+ content = `# NYSDS Utility Classes
249
+
250
+ ${UTILITY_DOCS.grid}
251
+
252
+ ${UTILITY_DOCS.flex}
253
+
254
+ ${UTILITY_DOCS.spacing}
255
+
256
+ ${UTILITY_DOCS.display}
257
+
258
+ ${UTILITY_DOCS.opacity}
259
+
260
+ ${UTILITY_DOCS.zindex}
261
+
262
+ ${UTILITY_DOCS.typography}
263
+
264
+ ${UTILITY_DOCS.responsive}
265
+
266
+ ${UTILITY_DOCS.componentSpacing}`;
267
+ }
268
+ else {
269
+ content =
270
+ UTILITY_DOCS[category] ||
271
+ `Unknown category: ${category}`;
272
+ }
273
+ return {
274
+ content: [
275
+ {
276
+ type: "text",
277
+ text: content,
278
+ },
279
+ ],
280
+ };
281
+ });
282
+ }
@@ -3,9 +3,8 @@
3
3
  *
4
4
  * MCP tools for validating NYSDS component usage.
5
5
  *
6
- * P1 Tools:
6
+ * Tools:
7
7
  * - validate_component_api: Validate prop/attribute usage
8
- * - setup_framework: Framework-specific guides
9
8
  */
10
9
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
11
10
  export declare function registerValidationTools(server: McpServer): void;
@@ -1 +1 @@
1
- {"version":3,"file":"validation-tools.d.ts","sourceRoot":"","sources":["../../src/tools/validation-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAyO/D"}
1
+ {"version":3,"file":"validation-tools.d.ts","sourceRoot":"","sources":["../../src/tools/validation-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAgE/D"}
@@ -3,9 +3,8 @@
3
3
  *
4
4
  * MCP tools for validating NYSDS component usage.
5
5
  *
6
- * P1 Tools:
6
+ * Tools:
7
7
  * - validate_component_api: Validate prop/attribute usage
8
- * - setup_framework: Framework-specific guides
9
8
  */
10
9
  import { z } from "zod";
11
10
  import { getComponent } from "../lib/cem-parser.js";
@@ -58,165 +57,4 @@ export function registerValidationTools(server) {
58
57
  ],
59
58
  };
60
59
  });
61
- // setup_framework - Framework-specific guides
62
- server.tool("setup_framework", "Get framework-specific setup guide for using NYSDS components", {
63
- framework: z
64
- .enum(["angular", "react", "vue", "dotnet", "drupal", "vanilla"])
65
- .describe("The framework to get setup instructions for"),
66
- }, async ({ framework }) => {
67
- // TODO: Load from data/guides/ directory
68
- const guides = {
69
- vanilla: `# NYSDS with Vanilla JavaScript
70
-
71
- ## Installation
72
-
73
- \`\`\`bash
74
- npm install @nysds/components
75
- \`\`\`
76
-
77
- ## Usage
78
-
79
- \`\`\`html
80
- <script type="module">
81
- import '@nysds/components';
82
- </script>
83
-
84
- <nys-button label="Click me"></nys-button>
85
- \`\`\`
86
- `,
87
- react: `# NYSDS with React
88
-
89
- ## Installation
90
-
91
- \`\`\`bash
92
- npm install @nysds/components
93
- \`\`\`
94
-
95
- ## Usage
96
-
97
- \`\`\`jsx
98
- import '@nysds/components/nys-button';
99
-
100
- function App() {
101
- return <nys-button label="Click me" />;
102
- }
103
- \`\`\`
104
-
105
- Note: Web components work in React but require property binding for complex types.
106
- `,
107
- angular: `# NYSDS with Angular
108
-
109
- ## Installation
110
-
111
- \`\`\`bash
112
- npm install @nysds/components
113
- \`\`\`
114
-
115
- ## Configuration
116
-
117
- Add CUSTOM_ELEMENTS_SCHEMA to your module:
118
-
119
- \`\`\`typescript
120
- import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
121
-
122
- @NgModule({
123
- schemas: [CUSTOM_ELEMENTS_SCHEMA]
124
- })
125
- export class AppModule {}
126
- \`\`\`
127
-
128
- ## Usage
129
-
130
- \`\`\`typescript
131
- import '@nysds/components/nys-button';
132
- \`\`\`
133
-
134
- \`\`\`html
135
- <nys-button label="Click me"></nys-button>
136
- \`\`\`
137
- `,
138
- vue: `# NYSDS with Vue
139
-
140
- ## Installation
141
-
142
- \`\`\`bash
143
- npm install @nysds/components
144
- \`\`\`
145
-
146
- ## Configuration
147
-
148
- Configure Vue to recognize custom elements:
149
-
150
- \`\`\`javascript
151
- // vite.config.js
152
- export default {
153
- plugins: [
154
- vue({
155
- template: {
156
- compilerOptions: {
157
- isCustomElement: (tag) => tag.startsWith('nys-')
158
- }
159
- }
160
- })
161
- ]
162
- }
163
- \`\`\`
164
-
165
- ## Usage
166
-
167
- \`\`\`vue
168
- <script setup>
169
- import '@nysds/components/nys-button';
170
- </script>
171
-
172
- <template>
173
- <nys-button label="Click me" />
174
- </template>
175
- \`\`\`
176
- `,
177
- dotnet: `# NYSDS with .NET / Blazor
178
-
179
- ## Installation
180
-
181
- Add the package via npm or include from CDN:
182
-
183
- \`\`\`html
184
- <script type="module" src="https://cdn.jsdelivr.net/npm/@nysds/components"></script>
185
- \`\`\`
186
-
187
- ## Usage in Razor
188
-
189
- \`\`\`razor
190
- <nys-button label="Click me"></nys-button>
191
- \`\`\`
192
- `,
193
- drupal: `# NYSDS with Drupal
194
-
195
- ## Installation
196
-
197
- Add the library to your theme's libraries.yml:
198
-
199
- \`\`\`yaml
200
- nysds:
201
- js:
202
- https://cdn.jsdelivr.net/npm/@nysds/components: { type: external, minified: true }
203
- \`\`\`
204
-
205
- ## Usage in Twig
206
-
207
- \`\`\`twig
208
- <nys-button label="{{ 'Click me'|t }}"></nys-button>
209
- \`\`\`
210
- `,
211
- };
212
- const guide = guides[framework] || `No guide available for ${framework}`;
213
- return {
214
- content: [
215
- {
216
- type: "text",
217
- text: guide,
218
- },
219
- ],
220
- };
221
- });
222
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nysds/mcp-server",
3
- "version": "1.15.1",
3
+ "version": "1.16.0-alpha5",
4
4
  "description": "MCP server for the New York State Design System. Exposes components, tokens, and documentation to AI assistants.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,7 +25,8 @@
25
25
  "inspect": "npx @modelcontextprotocol/inspector node dist/index.js"
26
26
  },
27
27
  "dependencies": {
28
- "@modelcontextprotocol/sdk": "^1.0.0"
28
+ "@modelcontextprotocol/sdk": "^1.26.0",
29
+ "zod": "^3.25"
29
30
  },
30
31
  "devDependencies": {
31
32
  "@types/node": "^22.0.0",