@csszyx/mcp-server 0.11.4 → 0.11.6

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.mts CHANGED
@@ -1 +1,204 @@
1
1
 
2
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
+
4
+ /**
5
+ * @csszyx/mcp-server — Model Context Protocol server for csszyx.
6
+ *
7
+ * Enables AI agents (Cursor, Windsurf, Claude Desktop, Cline) to natively
8
+ * understand and generate csszyx sz props.
9
+ *
10
+ * Architecture follows Tier-1 Proxy patterns:
11
+ * - 7 Stateless Sandbox tools (no destructive edits)
12
+ * - 3 Reference Data Endpoints
13
+ * - Unified Single Source of Truth via @csszyx/compiler and @csszyx/unplugin
14
+ *
15
+ * @module
16
+ */
17
+
18
+ declare const server: Server<{
19
+ method: string;
20
+ params?: {
21
+ [x: string]: unknown;
22
+ _meta?: {
23
+ [x: string]: unknown;
24
+ progressToken?: string | number | undefined;
25
+ "io.modelcontextprotocol/related-task"?: {
26
+ taskId: string;
27
+ } | undefined;
28
+ } | undefined;
29
+ } | undefined;
30
+ }, {
31
+ method: string;
32
+ params?: {
33
+ [x: string]: unknown;
34
+ _meta?: {
35
+ [x: string]: unknown;
36
+ progressToken?: string | number | undefined;
37
+ "io.modelcontextprotocol/related-task"?: {
38
+ taskId: string;
39
+ } | undefined;
40
+ } | undefined;
41
+ } | undefined;
42
+ }, {
43
+ [x: string]: unknown;
44
+ _meta?: {
45
+ [x: string]: unknown;
46
+ progressToken?: string | number | undefined;
47
+ "io.modelcontextprotocol/related-task"?: {
48
+ taskId: string;
49
+ } | undefined;
50
+ } | undefined;
51
+ }>;
52
+ declare const TOOLS: ({
53
+ name: string;
54
+ description: string;
55
+ inputSchema: {
56
+ type: "object";
57
+ properties: {
58
+ sz: {
59
+ type: "object";
60
+ description: string;
61
+ };
62
+ classes?: undefined;
63
+ query?: undefined;
64
+ code?: undefined;
65
+ customMap?: undefined;
66
+ injectTodos?: undefined;
67
+ items?: undefined;
68
+ css?: undefined;
69
+ };
70
+ required: string[];
71
+ };
72
+ } | {
73
+ name: string;
74
+ description: string;
75
+ inputSchema: {
76
+ type: "object";
77
+ properties: {
78
+ classes: {
79
+ type: "string";
80
+ description: string;
81
+ };
82
+ sz?: undefined;
83
+ query?: undefined;
84
+ code?: undefined;
85
+ customMap?: undefined;
86
+ injectTodos?: undefined;
87
+ items?: undefined;
88
+ css?: undefined;
89
+ };
90
+ required: string[];
91
+ };
92
+ } | {
93
+ name: string;
94
+ description: string;
95
+ inputSchema: {
96
+ type: "object";
97
+ properties: {
98
+ query: {
99
+ type: "string";
100
+ description: string;
101
+ };
102
+ sz?: undefined;
103
+ classes?: undefined;
104
+ code?: undefined;
105
+ customMap?: undefined;
106
+ injectTodos?: undefined;
107
+ items?: undefined;
108
+ css?: undefined;
109
+ };
110
+ required: string[];
111
+ };
112
+ } | {
113
+ name: string;
114
+ description: string;
115
+ inputSchema: {
116
+ type: "object";
117
+ properties: {
118
+ code: {
119
+ type: "string";
120
+ description: string;
121
+ };
122
+ customMap: {
123
+ type: "object";
124
+ description: string;
125
+ };
126
+ injectTodos: {
127
+ type: "boolean";
128
+ description: string;
129
+ };
130
+ sz?: undefined;
131
+ classes?: undefined;
132
+ query?: undefined;
133
+ items?: undefined;
134
+ css?: undefined;
135
+ };
136
+ required: string[];
137
+ };
138
+ } | {
139
+ name: string;
140
+ description: string;
141
+ inputSchema: {
142
+ type: "object";
143
+ properties: {
144
+ items: {
145
+ type: "array";
146
+ items: {
147
+ type: "object";
148
+ };
149
+ description: string;
150
+ };
151
+ sz?: undefined;
152
+ classes?: undefined;
153
+ query?: undefined;
154
+ code?: undefined;
155
+ customMap?: undefined;
156
+ injectTodos?: undefined;
157
+ css?: undefined;
158
+ };
159
+ required: string[];
160
+ };
161
+ } | {
162
+ name: string;
163
+ description: string;
164
+ inputSchema: {
165
+ type: "object";
166
+ properties: {
167
+ css: {
168
+ type: "string";
169
+ description: string;
170
+ };
171
+ sz?: undefined;
172
+ classes?: undefined;
173
+ query?: undefined;
174
+ code?: undefined;
175
+ customMap?: undefined;
176
+ injectTodos?: undefined;
177
+ items?: undefined;
178
+ };
179
+ required: string[];
180
+ };
181
+ })[];
182
+ /**
183
+ *
184
+ */
185
+ /**
186
+ * Handle conventional `--version` / `--help` flags by printing diagnostics to
187
+ * stdout and exiting, WITHOUT starting the stdio server. Lets a host or a human
188
+ * separate a server/package failure from an MCP attachment failure without having
189
+ * to speak JSON-RPC. Returns true when a flag was handled (caller should not start
190
+ * the server).
191
+ *
192
+ * @param argv - process arguments (`process.argv.slice(2)`).
193
+ * @returns whether a flag was handled.
194
+ */
195
+ declare function handleCliFlags(argv: string[]): boolean;
196
+ /**
197
+ * Only start the stdio server when this module is the process entry point, not
198
+ * when a test imports it to exercise the handlers in-process. realpath so the
199
+ * bin symlink (node_modules/.bin/csszyx-mcp) still resolves to this module.
200
+ * @returns Whether this module was run directly.
201
+ */
202
+ declare function isEntrypoint(): boolean;
203
+
204
+ export { TOOLS, handleCliFlags, isEntrypoint, server };
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
+ import fs, { realpathSync } from 'node:fs';
2
3
  import { createRequire } from 'node:module';
3
4
  import path from 'node:path';
4
5
  import { fileURLToPath } from 'node:url';
5
6
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
6
7
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
7
8
  import { ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema } from '@modelcontextprotocol/sdk/types.js';
8
- import fs from 'node:fs';
9
9
  import { sortStrings, SPECIAL_VARIANTS, KNOWN_VARIANTS, PROPERTY_MAP, transform, SUGGESTION_MAP, BOOLEAN_SHORTHANDS, REMOVED_BOOLEAN_SUGAR } from '@csszyx/compiler';
10
10
  import { z } from 'zod';
11
11
  import { migrateSource, classNameToSzObject } from '@csszyx/cli';
@@ -306,8 +306,7 @@ function handleBatch(input) {
306
306
  const result = transform(sz);
307
307
  return {
308
308
  index,
309
- className: result.className,
310
- attributes: Object.keys(result.attributes).length > 0 ? result.attributes : void 0
309
+ className: result.className
311
310
  };
312
311
  } catch (err) {
313
312
  return {
@@ -348,7 +347,6 @@ function handleExpand(input) {
348
347
  text: JSON.stringify(
349
348
  {
350
349
  className: result.className,
351
- attributes: result.attributes,
352
350
  classCount: result.className.split(/\s+/).filter(Boolean).length
353
351
  },
354
352
  null,
@@ -613,10 +611,18 @@ function handleValidate(input) {
613
611
  }
614
612
  let transformResult = null;
615
613
  let transformError = null;
614
+ const originalWarn = console.warn;
615
+ console.warn = (...args) => {
616
+ warnings.push(
617
+ args.map((arg) => typeof arg === "string" ? arg : JSON.stringify(arg)).join(" ")
618
+ );
619
+ };
616
620
  try {
617
621
  transformResult = transform(input.sz);
618
622
  } catch (err) {
619
623
  transformError = err instanceof Error ? err.message : String(err);
624
+ } finally {
625
+ console.warn = originalWarn;
620
626
  }
621
627
  return {
622
628
  content: [
@@ -861,7 +867,20 @@ async function main() {
861
867
  ` Tools: ${TOOLS.length} | Resources: ${listResources().length} | Prompts: ${listPrompts().length}`
862
868
  );
863
869
  }
864
- main().catch((error) => {
865
- console.error("Server error:", error);
866
- process.exit(1);
867
- });
870
+ function isEntrypoint() {
871
+ const invoked = process.argv[1];
872
+ if (!invoked) return false;
873
+ try {
874
+ return realpathSync(invoked) === fileURLToPath(import.meta.url);
875
+ } catch {
876
+ return false;
877
+ }
878
+ }
879
+ if (isEntrypoint()) {
880
+ main().catch((error) => {
881
+ console.error("Server error:", error);
882
+ process.exit(1);
883
+ });
884
+ }
885
+
886
+ export { TOOLS, handleCliFlags, isEntrypoint, server };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/mcp-server",
3
- "version": "0.11.4",
3
+ "version": "0.11.6",
4
4
  "description": "Model Context Protocol (MCP) server for csszyx — enables AI agents to understand and generate sz props",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,9 +30,9 @@
30
30
  "dependencies": {
31
31
  "@modelcontextprotocol/sdk": "^1.29.0",
32
32
  "zod": "^3.23.8",
33
- "@csszyx/compiler": "0.11.4",
34
- "@csszyx/cli": "0.11.4",
35
- "@csszyx/unplugin": "0.11.4"
33
+ "@csszyx/compiler": "0.11.6",
34
+ "@csszyx/cli": "0.11.6",
35
+ "@csszyx/unplugin": "0.11.6"
36
36
  },
37
37
  "devDependencies": {
38
38
  "typescript": "^6.0.3",