mozaic-mcp-server 1.0.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 (161) hide show
  1. package/INSTALLATION.md +232 -0
  2. package/README.md +262 -0
  3. package/SKILLS.md +411 -0
  4. package/bin/install-skills.js +171 -0
  5. package/data/mozaic.db +0 -0
  6. package/data/mozaic.db-shm +0 -0
  7. package/data/mozaic.db-wal +0 -0
  8. package/dist/__tests__/sanity-check.test.d.ts +2 -0
  9. package/dist/__tests__/sanity-check.test.d.ts.map +1 -0
  10. package/dist/__tests__/sanity-check.test.js +167 -0
  11. package/dist/__tests__/sanity-check.test.js.map +1 -0
  12. package/dist/__tests__/tools.integration.test.d.ts +2 -0
  13. package/dist/__tests__/tools.integration.test.d.ts.map +1 -0
  14. package/dist/__tests__/tools.integration.test.js +220 -0
  15. package/dist/__tests__/tools.integration.test.js.map +1 -0
  16. package/dist/db/queries.d.ts +144 -0
  17. package/dist/db/queries.d.ts.map +1 -0
  18. package/dist/db/queries.js +536 -0
  19. package/dist/db/queries.js.map +1 -0
  20. package/dist/db/schema.d.ts +4 -0
  21. package/dist/db/schema.d.ts.map +1 -0
  22. package/dist/db/schema.js +253 -0
  23. package/dist/db/schema.js.map +1 -0
  24. package/dist/index.d.ts +3 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +416 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/parsers/__tests__/docs-parser.test.d.ts +2 -0
  29. package/dist/parsers/__tests__/docs-parser.test.d.ts.map +1 -0
  30. package/dist/parsers/__tests__/docs-parser.test.js +251 -0
  31. package/dist/parsers/__tests__/docs-parser.test.js.map +1 -0
  32. package/dist/parsers/__tests__/icons-parser.test.d.ts +2 -0
  33. package/dist/parsers/__tests__/icons-parser.test.d.ts.map +1 -0
  34. package/dist/parsers/__tests__/icons-parser.test.js +169 -0
  35. package/dist/parsers/__tests__/icons-parser.test.js.map +1 -0
  36. package/dist/parsers/__tests__/react-parser.test.d.ts +2 -0
  37. package/dist/parsers/__tests__/react-parser.test.d.ts.map +1 -0
  38. package/dist/parsers/__tests__/react-parser.test.js +274 -0
  39. package/dist/parsers/__tests__/react-parser.test.js.map +1 -0
  40. package/dist/parsers/__tests__/scss-parser.test.d.ts +2 -0
  41. package/dist/parsers/__tests__/scss-parser.test.d.ts.map +1 -0
  42. package/dist/parsers/__tests__/scss-parser.test.js +364 -0
  43. package/dist/parsers/__tests__/scss-parser.test.js.map +1 -0
  44. package/dist/parsers/__tests__/tokens-parser.test.d.ts +2 -0
  45. package/dist/parsers/__tests__/tokens-parser.test.d.ts.map +1 -0
  46. package/dist/parsers/__tests__/tokens-parser.test.js +172 -0
  47. package/dist/parsers/__tests__/tokens-parser.test.js.map +1 -0
  48. package/dist/parsers/__tests__/vue-parser.test.d.ts +2 -0
  49. package/dist/parsers/__tests__/vue-parser.test.d.ts.map +1 -0
  50. package/dist/parsers/__tests__/vue-parser.test.js +207 -0
  51. package/dist/parsers/__tests__/vue-parser.test.js.map +1 -0
  52. package/dist/parsers/docs-parser.d.ts +4 -0
  53. package/dist/parsers/docs-parser.d.ts.map +1 -0
  54. package/dist/parsers/docs-parser.js +237 -0
  55. package/dist/parsers/docs-parser.js.map +1 -0
  56. package/dist/parsers/icons-parser.d.ts +33 -0
  57. package/dist/parsers/icons-parser.d.ts.map +1 -0
  58. package/dist/parsers/icons-parser.js +125 -0
  59. package/dist/parsers/icons-parser.js.map +1 -0
  60. package/dist/parsers/react-parser.d.ts +3 -0
  61. package/dist/parsers/react-parser.d.ts.map +1 -0
  62. package/dist/parsers/react-parser.js +406 -0
  63. package/dist/parsers/react-parser.js.map +1 -0
  64. package/dist/parsers/scss-parser.d.ts +9 -0
  65. package/dist/parsers/scss-parser.d.ts.map +1 -0
  66. package/dist/parsers/scss-parser.js +351 -0
  67. package/dist/parsers/scss-parser.js.map +1 -0
  68. package/dist/parsers/tokens/border-parser.d.ts +3 -0
  69. package/dist/parsers/tokens/border-parser.d.ts.map +1 -0
  70. package/dist/parsers/tokens/border-parser.js +83 -0
  71. package/dist/parsers/tokens/border-parser.js.map +1 -0
  72. package/dist/parsers/tokens/color-parser.d.ts +3 -0
  73. package/dist/parsers/tokens/color-parser.d.ts.map +1 -0
  74. package/dist/parsers/tokens/color-parser.js +88 -0
  75. package/dist/parsers/tokens/color-parser.js.map +1 -0
  76. package/dist/parsers/tokens/grid-parser.d.ts +3 -0
  77. package/dist/parsers/tokens/grid-parser.d.ts.map +1 -0
  78. package/dist/parsers/tokens/grid-parser.js +97 -0
  79. package/dist/parsers/tokens/grid-parser.js.map +1 -0
  80. package/dist/parsers/tokens/index.d.ts +9 -0
  81. package/dist/parsers/tokens/index.d.ts.map +1 -0
  82. package/dist/parsers/tokens/index.js +10 -0
  83. package/dist/parsers/tokens/index.js.map +1 -0
  84. package/dist/parsers/tokens/screen-parser.d.ts +3 -0
  85. package/dist/parsers/tokens/screen-parser.d.ts.map +1 -0
  86. package/dist/parsers/tokens/screen-parser.js +54 -0
  87. package/dist/parsers/tokens/screen-parser.js.map +1 -0
  88. package/dist/parsers/tokens/shadow-parser.d.ts +3 -0
  89. package/dist/parsers/tokens/shadow-parser.d.ts.map +1 -0
  90. package/dist/parsers/tokens/shadow-parser.js +62 -0
  91. package/dist/parsers/tokens/shadow-parser.js.map +1 -0
  92. package/dist/parsers/tokens/spacing-parser.d.ts +4 -0
  93. package/dist/parsers/tokens/spacing-parser.d.ts.map +1 -0
  94. package/dist/parsers/tokens/spacing-parser.js +85 -0
  95. package/dist/parsers/tokens/spacing-parser.js.map +1 -0
  96. package/dist/parsers/tokens/types.d.ts +33 -0
  97. package/dist/parsers/tokens/types.d.ts.map +1 -0
  98. package/dist/parsers/tokens/types.js +42 -0
  99. package/dist/parsers/tokens/types.js.map +1 -0
  100. package/dist/parsers/tokens/typography-parser.d.ts +3 -0
  101. package/dist/parsers/tokens/typography-parser.d.ts.map +1 -0
  102. package/dist/parsers/tokens/typography-parser.js +76 -0
  103. package/dist/parsers/tokens/typography-parser.js.map +1 -0
  104. package/dist/parsers/tokens-parser.d.ts +18 -0
  105. package/dist/parsers/tokens-parser.d.ts.map +1 -0
  106. package/dist/parsers/tokens-parser.js +57 -0
  107. package/dist/parsers/tokens-parser.js.map +1 -0
  108. package/dist/parsers/vue-parser.d.ts +3 -0
  109. package/dist/parsers/vue-parser.d.ts.map +1 -0
  110. package/dist/parsers/vue-parser.js +343 -0
  111. package/dist/parsers/vue-parser.js.map +1 -0
  112. package/dist/tools/generate-react-component.d.ts +35 -0
  113. package/dist/tools/generate-react-component.d.ts.map +1 -0
  114. package/dist/tools/generate-react-component.js +81 -0
  115. package/dist/tools/generate-react-component.js.map +1 -0
  116. package/dist/tools/generate-vue-component.d.ts +35 -0
  117. package/dist/tools/generate-vue-component.d.ts.map +1 -0
  118. package/dist/tools/generate-vue-component.js +81 -0
  119. package/dist/tools/generate-vue-component.js.map +1 -0
  120. package/dist/tools/get-component-info.d.ts +52 -0
  121. package/dist/tools/get-component-info.d.ts.map +1 -0
  122. package/dist/tools/get-component-info.js +94 -0
  123. package/dist/tools/get-component-info.js.map +1 -0
  124. package/dist/tools/get-css-utility.d.ts +41 -0
  125. package/dist/tools/get-css-utility.d.ts.map +1 -0
  126. package/dist/tools/get-css-utility.js +57 -0
  127. package/dist/tools/get-css-utility.js.map +1 -0
  128. package/dist/tools/get-design-tokens.d.ts +44 -0
  129. package/dist/tools/get-design-tokens.d.ts.map +1 -0
  130. package/dist/tools/get-design-tokens.js +124 -0
  131. package/dist/tools/get-design-tokens.js.map +1 -0
  132. package/dist/tools/get-icon.d.ts +32 -0
  133. package/dist/tools/get-icon.d.ts.map +1 -0
  134. package/dist/tools/get-icon.js +108 -0
  135. package/dist/tools/get-icon.js.map +1 -0
  136. package/dist/tools/get-install-info.d.ts +39 -0
  137. package/dist/tools/get-install-info.d.ts.map +1 -0
  138. package/dist/tools/get-install-info.js +160 -0
  139. package/dist/tools/get-install-info.js.map +1 -0
  140. package/dist/tools/list-components.d.ts +32 -0
  141. package/dist/tools/list-components.d.ts.map +1 -0
  142. package/dist/tools/list-components.js +62 -0
  143. package/dist/tools/list-components.js.map +1 -0
  144. package/dist/tools/list-css-utilities.d.ts +27 -0
  145. package/dist/tools/list-css-utilities.d.ts.map +1 -0
  146. package/dist/tools/list-css-utilities.js +48 -0
  147. package/dist/tools/list-css-utilities.js.map +1 -0
  148. package/dist/tools/search-documentation.d.ts +37 -0
  149. package/dist/tools/search-documentation.d.ts.map +1 -0
  150. package/dist/tools/search-documentation.js +120 -0
  151. package/dist/tools/search-documentation.js.map +1 -0
  152. package/dist/tools/search-icons.d.ts +41 -0
  153. package/dist/tools/search-icons.d.ts.map +1 -0
  154. package/dist/tools/search-icons.js +134 -0
  155. package/dist/tools/search-icons.js.map +1 -0
  156. package/package.json +98 -0
  157. package/skills/mozaic-css-utilities/skill.md +633 -0
  158. package/skills/mozaic-design-tokens/skill.md +621 -0
  159. package/skills/mozaic-icons/skill.md +624 -0
  160. package/skills/mozaic-react-builder/skill.md +652 -0
  161. package/skills/mozaic-vue-builder/skill.md +491 -0
@@ -0,0 +1,253 @@
1
+ export const SCHEMA = `
2
+ -- Design Tokens (enhanced schema)
3
+ CREATE TABLE IF NOT EXISTS tokens (
4
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
5
+ category TEXT NOT NULL, -- 'color', 'spacing', 'shadow', 'border', 'radius', 'screen', 'typography'
6
+ subcategory TEXT, -- 'primary', 'grey', 'font', 'line', etc.
7
+ name TEXT NOT NULL, -- 'primary-01-100', 'mu100', 's'
8
+ path TEXT NOT NULL UNIQUE, -- Full path: 'color.primary-01.100'
9
+ css_variable TEXT, -- '--color-primary-01-100'
10
+ scss_variable TEXT, -- '$color-primary-01-100' or '$mu100'
11
+
12
+ -- Values (multiple formats)
13
+ value_raw TEXT NOT NULL, -- Original value as-is
14
+ value_number REAL, -- Numeric value (if applicable)
15
+ value_unit TEXT, -- 'px', 'rem', '%', 'hex', etc.
16
+ value_computed TEXT, -- Computed value (e.g., '16px' for 1rem)
17
+
18
+ -- Metadata
19
+ description TEXT,
20
+ platform TEXT DEFAULT 'all',
21
+ source_file TEXT -- Where it came from
22
+ );
23
+
24
+ -- For composite tokens like shadows
25
+ CREATE TABLE IF NOT EXISTS token_properties (
26
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
27
+ token_id INTEGER NOT NULL REFERENCES tokens(id) ON DELETE CASCADE,
28
+ property TEXT NOT NULL, -- 'x', 'y', 'blur', 'spread', 'opacity'
29
+ value TEXT NOT NULL,
30
+ value_number REAL,
31
+ value_unit TEXT
32
+ );
33
+
34
+ CREATE INDEX IF NOT EXISTS idx_token_properties_token ON token_properties(token_id);
35
+
36
+ -- Token indexes for fast queries
37
+ CREATE INDEX IF NOT EXISTS idx_tokens_category ON tokens(category);
38
+ CREATE INDEX IF NOT EXISTS idx_tokens_subcategory ON tokens(category, subcategory);
39
+ CREATE INDEX IF NOT EXISTS idx_tokens_path ON tokens(path);
40
+ CREATE INDEX IF NOT EXISTS idx_tokens_css_var ON tokens(css_variable);
41
+ CREATE INDEX IF NOT EXISTS idx_tokens_scss_var ON tokens(scss_variable);
42
+
43
+ -- Full-text search on tokens
44
+ CREATE VIRTUAL TABLE IF NOT EXISTS tokens_fts USING fts5(
45
+ name,
46
+ path,
47
+ description,
48
+ css_variable,
49
+ scss_variable,
50
+ content=tokens,
51
+ content_rowid=id
52
+ );
53
+
54
+ -- Triggers to keep tokens FTS index in sync
55
+ CREATE TRIGGER IF NOT EXISTS tokens_ai AFTER INSERT ON tokens BEGIN
56
+ INSERT INTO tokens_fts(rowid, name, path, description, css_variable, scss_variable)
57
+ VALUES (new.id, new.name, new.path, new.description, new.css_variable, new.scss_variable);
58
+ END;
59
+
60
+ CREATE TRIGGER IF NOT EXISTS tokens_ad AFTER DELETE ON tokens BEGIN
61
+ INSERT INTO tokens_fts(tokens_fts, rowid, name, path, description, css_variable, scss_variable)
62
+ VALUES('delete', old.id, old.name, old.path, old.description, old.css_variable, old.scss_variable);
63
+ END;
64
+
65
+ CREATE TRIGGER IF NOT EXISTS tokens_au AFTER UPDATE ON tokens BEGIN
66
+ INSERT INTO tokens_fts(tokens_fts, rowid, name, path, description, css_variable, scss_variable)
67
+ VALUES('delete', old.id, old.name, old.path, old.description, old.css_variable, old.scss_variable);
68
+ INSERT INTO tokens_fts(rowid, name, path, description, css_variable, scss_variable)
69
+ VALUES (new.id, new.name, new.path, new.description, new.css_variable, new.scss_variable);
70
+ END;
71
+
72
+ -- Components
73
+ CREATE TABLE IF NOT EXISTS components (
74
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
75
+ name TEXT NOT NULL UNIQUE,
76
+ slug TEXT NOT NULL,
77
+ category TEXT,
78
+ description TEXT,
79
+ frameworks TEXT
80
+ );
81
+
82
+ CREATE INDEX IF NOT EXISTS idx_components_category ON components(category);
83
+ CREATE INDEX IF NOT EXISTS idx_components_slug ON components(slug);
84
+
85
+ -- Component Props
86
+ CREATE TABLE IF NOT EXISTS component_props (
87
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
88
+ component_id INTEGER REFERENCES components(id) ON DELETE CASCADE,
89
+ name TEXT NOT NULL,
90
+ type TEXT,
91
+ default_value TEXT,
92
+ required INTEGER DEFAULT 0,
93
+ options TEXT,
94
+ description TEXT
95
+ );
96
+
97
+ CREATE INDEX IF NOT EXISTS idx_component_props_component ON component_props(component_id);
98
+
99
+ -- Component Slots
100
+ CREATE TABLE IF NOT EXISTS component_slots (
101
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
102
+ component_id INTEGER REFERENCES components(id) ON DELETE CASCADE,
103
+ name TEXT NOT NULL,
104
+ description TEXT
105
+ );
106
+
107
+ -- Component Events
108
+ CREATE TABLE IF NOT EXISTS component_events (
109
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
110
+ component_id INTEGER REFERENCES components(id) ON DELETE CASCADE,
111
+ name TEXT NOT NULL,
112
+ payload TEXT,
113
+ description TEXT
114
+ );
115
+
116
+ -- Component Examples
117
+ CREATE TABLE IF NOT EXISTS component_examples (
118
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
119
+ component_id INTEGER REFERENCES components(id) ON DELETE CASCADE,
120
+ framework TEXT NOT NULL,
121
+ title TEXT,
122
+ code TEXT NOT NULL,
123
+ description TEXT
124
+ );
125
+
126
+ CREATE INDEX IF NOT EXISTS idx_component_examples_component ON component_examples(component_id);
127
+ CREATE INDEX IF NOT EXISTS idx_component_examples_framework ON component_examples(framework);
128
+
129
+ -- CSS Classes (for framework components)
130
+ CREATE TABLE IF NOT EXISTS component_css_classes (
131
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
132
+ component_id INTEGER REFERENCES components(id) ON DELETE CASCADE,
133
+ class_name TEXT NOT NULL,
134
+ description TEXT
135
+ );
136
+
137
+ -- CSS Utilities (layouts & spacing - separate from framework components)
138
+ CREATE TABLE IF NOT EXISTS css_utilities (
139
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
140
+ name TEXT NOT NULL UNIQUE,
141
+ slug TEXT NOT NULL,
142
+ category TEXT NOT NULL,
143
+ description TEXT
144
+ );
145
+
146
+ CREATE INDEX IF NOT EXISTS idx_css_utilities_category ON css_utilities(category);
147
+ CREATE INDEX IF NOT EXISTS idx_css_utilities_slug ON css_utilities(slug);
148
+
149
+ -- CSS Utility Classes
150
+ CREATE TABLE IF NOT EXISTS css_utility_classes (
151
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
152
+ utility_id INTEGER REFERENCES css_utilities(id) ON DELETE CASCADE,
153
+ class_name TEXT NOT NULL
154
+ );
155
+
156
+ CREATE INDEX IF NOT EXISTS idx_css_utility_classes_utility ON css_utility_classes(utility_id);
157
+
158
+ -- CSS Utility Examples
159
+ CREATE TABLE IF NOT EXISTS css_utility_examples (
160
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
161
+ utility_id INTEGER REFERENCES css_utilities(id) ON DELETE CASCADE,
162
+ title TEXT,
163
+ code TEXT NOT NULL
164
+ );
165
+
166
+ CREATE INDEX IF NOT EXISTS idx_css_utility_examples_utility ON css_utility_examples(utility_id);
167
+
168
+ -- Documentation
169
+ CREATE TABLE IF NOT EXISTS documentation (
170
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
171
+ title TEXT NOT NULL,
172
+ path TEXT NOT NULL,
173
+ content TEXT NOT NULL,
174
+ category TEXT,
175
+ keywords TEXT
176
+ );
177
+
178
+ CREATE INDEX IF NOT EXISTS idx_documentation_category ON documentation(category);
179
+ CREATE INDEX IF NOT EXISTS idx_documentation_path ON documentation(path);
180
+
181
+ -- Full-text search for documentation
182
+ CREATE VIRTUAL TABLE IF NOT EXISTS docs_fts USING fts5(
183
+ title,
184
+ content,
185
+ keywords,
186
+ content=documentation,
187
+ content_rowid=id
188
+ );
189
+
190
+ -- Triggers to keep FTS index in sync
191
+ CREATE TRIGGER IF NOT EXISTS docs_ai AFTER INSERT ON documentation BEGIN
192
+ INSERT INTO docs_fts(rowid, title, content, keywords)
193
+ VALUES (new.id, new.title, new.content, new.keywords);
194
+ END;
195
+
196
+ CREATE TRIGGER IF NOT EXISTS docs_ad AFTER DELETE ON documentation BEGIN
197
+ INSERT INTO docs_fts(docs_fts, rowid, title, content, keywords)
198
+ VALUES('delete', old.id, old.title, old.content, old.keywords);
199
+ END;
200
+
201
+ CREATE TRIGGER IF NOT EXISTS docs_au AFTER UPDATE ON documentation BEGIN
202
+ INSERT INTO docs_fts(docs_fts, rowid, title, content, keywords)
203
+ VALUES('delete', old.id, old.title, old.content, old.keywords);
204
+ INSERT INTO docs_fts(rowid, title, content, keywords)
205
+ VALUES (new.id, new.title, new.content, new.keywords);
206
+ END;
207
+
208
+ -- Icons
209
+ CREATE TABLE IF NOT EXISTS icons (
210
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
211
+ name TEXT NOT NULL UNIQUE, -- 'ArrowArrowBottom16'
212
+ icon_name TEXT NOT NULL, -- 'ArrowArrowBottom' (without size)
213
+ type TEXT NOT NULL, -- 'navigation', 'media', 'action', etc.
214
+ size INTEGER NOT NULL, -- 16, 24, 32, 48, 64
215
+ view_box TEXT NOT NULL, -- '0 0 16 16'
216
+ paths TEXT NOT NULL -- JSON array of SVG paths
217
+ );
218
+
219
+ CREATE INDEX IF NOT EXISTS idx_icons_type ON icons(type);
220
+ CREATE INDEX IF NOT EXISTS idx_icons_size ON icons(size);
221
+ CREATE INDEX IF NOT EXISTS idx_icons_name ON icons(icon_name);
222
+
223
+ -- Full-text search for icons
224
+ CREATE VIRTUAL TABLE IF NOT EXISTS icons_fts USING fts5(
225
+ name,
226
+ icon_name,
227
+ type,
228
+ content=icons,
229
+ content_rowid=id
230
+ );
231
+
232
+ -- Triggers to keep icons FTS index in sync
233
+ CREATE TRIGGER IF NOT EXISTS icons_ai AFTER INSERT ON icons BEGIN
234
+ INSERT INTO icons_fts(rowid, name, icon_name, type)
235
+ VALUES (new.id, new.name, new.icon_name, new.type);
236
+ END;
237
+
238
+ CREATE TRIGGER IF NOT EXISTS icons_ad AFTER DELETE ON icons BEGIN
239
+ INSERT INTO icons_fts(icons_fts, rowid, name, icon_name, type)
240
+ VALUES('delete', old.id, old.name, old.icon_name, old.type);
241
+ END;
242
+
243
+ CREATE TRIGGER IF NOT EXISTS icons_au AFTER UPDATE ON icons BEGIN
244
+ INSERT INTO icons_fts(icons_fts, rowid, name, icon_name, type)
245
+ VALUES('delete', old.id, old.name, old.icon_name, old.type);
246
+ INSERT INTO icons_fts(rowid, name, icon_name, type)
247
+ VALUES (new.id, new.name, new.icon_name, new.type);
248
+ END;
249
+ `;
250
+ export function initSchema(db) {
251
+ db.exec(SCHEMA);
252
+ }
253
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwPrB,CAAC;AAEF,MAAM,UAAU,UAAU,CAAC,EAAqB;IAC9C,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,416 @@
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 Database from "better-sqlite3";
5
+ import { appendFileSync, existsSync, readFileSync, readdirSync, mkdirSync, copyFileSync } from "fs";
6
+ import { dirname, join } from "path";
7
+ import { fileURLToPath } from "url";
8
+ import { z } from "zod";
9
+ // Debug mode - enable with --debug flag
10
+ const DEBUG = process.argv.includes("--debug");
11
+ const LOG_FILE = join(dirname(fileURLToPath(import.meta.url)), "..", "mcp-server.log");
12
+ function log(message, data) {
13
+ if (!DEBUG)
14
+ return;
15
+ const timestamp = new Date().toISOString();
16
+ const logMessage = data
17
+ ? `[${timestamp}] ${message}: ${JSON.stringify(data, null, 2)}\n`
18
+ : `[${timestamp}] ${message}\n`;
19
+ appendFileSync(LOG_FILE, logMessage);
20
+ }
21
+ // Import tool handlers
22
+ import { handleGenerateReactComponent, } from "./tools/generate-react-component.js";
23
+ import { handleGenerateVueComponent, } from "./tools/generate-vue-component.js";
24
+ import { handleGetComponentInfo } from "./tools/get-component-info.js";
25
+ import { handleGetCssUtility } from "./tools/get-css-utility.js";
26
+ import { handleGetDesignTokens } from "./tools/get-design-tokens.js";
27
+ import { handleListComponents } from "./tools/list-components.js";
28
+ import { handleListCssUtilities } from "./tools/list-css-utilities.js";
29
+ import { handleSearchDocumentation, } from "./tools/search-documentation.js";
30
+ import { handleSearchIcons } from "./tools/search-icons.js";
31
+ import { handleGetIcon } from "./tools/get-icon.js";
32
+ import { handleGetInstallInfo } from "./tools/get-install-info.js";
33
+ // Get database path
34
+ const __filename = fileURLToPath(import.meta.url);
35
+ const __dirname = dirname(__filename);
36
+ const dbPath = join(__dirname, "..", "data", "mozaic.db");
37
+ // Initialize database
38
+ let db;
39
+ function initializeDatabase() {
40
+ log("Initializing database", { path: dbPath });
41
+ if (!existsSync(dbPath)) {
42
+ const error = `Database not found at ${dbPath}. Run 'npm run build' to build the database first.`;
43
+ log("Database error", { error });
44
+ throw new Error(error);
45
+ }
46
+ const database = new Database(dbPath, { readonly: true });
47
+ database.pragma("journal_mode = WAL");
48
+ log("Database initialized successfully");
49
+ return database;
50
+ }
51
+ // Create MCP server
52
+ const server = new McpServer({
53
+ name: "mozaic-design-system",
54
+ version: "1.0.0",
55
+ });
56
+ // Register tools using the new McpServer API
57
+ log("Registering MCP tools");
58
+ server.registerTool("get_design_tokens", {
59
+ description: "Get Mozaic design tokens with CSS/SCSS variables. Categories: colors (brand, semantic, component), typography (font sizes, weights, line heights), spacing (magic unit scale), shadows, borders, screens (breakpoints), grid (gutters).",
60
+ inputSchema: {
61
+ category: z
62
+ .enum(["colors", "typography", "spacing", "shadows", "borders", "screens", "grid", "all"])
63
+ .describe("Token category: colors, typography, spacing, shadows, borders, screens, grid, or all"),
64
+ format: z
65
+ .enum(["json", "scss", "css", "js"])
66
+ .default("json")
67
+ .describe("Output format: json (structured), scss ($variables), css (--custom-properties), js (constants)"),
68
+ },
69
+ }, async (args) => {
70
+ log("Tool called: get_design_tokens", args);
71
+ if (!db)
72
+ db = initializeDatabase();
73
+ const result = handleGetDesignTokens(db, args);
74
+ log("Tool result: get_design_tokens", { contentLength: result.content.length });
75
+ return result;
76
+ });
77
+ server.registerTool("get_component_info", {
78
+ description: "Get Vue/React component details: props (types, defaults, required), slots, events, and code examples. For CSS-only utilities (Flexy, Margin, Padding), use get_css_utility instead.",
79
+ inputSchema: {
80
+ component: z
81
+ .string()
82
+ .describe("Component name (e.g., 'button', 'modal', 'accordion', 'text-input')"),
83
+ framework: z
84
+ .enum(["vue", "react"])
85
+ .default("vue")
86
+ .describe("Framework for code examples: vue (@mozaic-ds/vue-3) or react (@mozaic-ds/react)"),
87
+ },
88
+ }, async (args) => {
89
+ log("Tool called: get_component_info", args);
90
+ if (!db)
91
+ db = initializeDatabase();
92
+ const result = handleGetComponentInfo(db, args);
93
+ log("Tool result: get_component_info", { contentLength: result.content.length });
94
+ return result;
95
+ });
96
+ server.registerTool("list_components", {
97
+ description: "List Mozaic Vue/React components by category. Returns component names you can use with get_component_info. For CSS utilities (Flexy, Margin), use list_css_utilities instead.",
98
+ inputSchema: {
99
+ category: z
100
+ .enum(["form", "navigation", "feedback", "layout", "data-display", "action", "all"])
101
+ .default("all")
102
+ .describe("Filter: form (inputs, selects), navigation (tabs, breadcrumb), feedback (modal, toast), layout, data-display, action (buttons), or all"),
103
+ },
104
+ }, async (args) => {
105
+ log("Tool called: list_components", args);
106
+ if (!db)
107
+ db = initializeDatabase();
108
+ const result = handleListComponents(db, args);
109
+ log("Tool result: list_components", { contentLength: result.content.length });
110
+ return result;
111
+ });
112
+ server.registerTool("generate_vue_component", {
113
+ description: "Generate ready-to-use Vue 3 code with Mozaic components (@mozaic-ds/vue-3). Returns <template> with proper imports. Use get_component_info first to see available props.",
114
+ inputSchema: {
115
+ component: z
116
+ .string()
117
+ .describe("Component to generate (e.g., 'button', 'text-input', 'modal', 'select')"),
118
+ props: z
119
+ .record(z.unknown())
120
+ .optional()
121
+ .describe("Props to apply (e.g., {theme: 'primary', size: 'm'})"),
122
+ children: z.string().optional().describe("Slot content (text or HTML)"),
123
+ },
124
+ }, async (args) => {
125
+ log("Tool called: generate_vue_component", args);
126
+ if (!db)
127
+ db = initializeDatabase();
128
+ const result = handleGenerateVueComponent(db, args);
129
+ log("Tool result: generate_vue_component", { contentLength: result.content.length });
130
+ return result;
131
+ });
132
+ server.registerTool("generate_react_component", {
133
+ description: "Generate ready-to-use React/TSX code with Mozaic components (@mozaic-ds/react). Returns JSX with proper imports. Use get_component_info first to see available props.",
134
+ inputSchema: {
135
+ component: z
136
+ .string()
137
+ .describe("Component to generate (e.g., 'Button', 'TextInput', 'Modal', 'Select')"),
138
+ props: z
139
+ .record(z.unknown())
140
+ .optional()
141
+ .describe("Props to apply (e.g., {theme: 'primary', size: 'm'})"),
142
+ children: z.string().optional().describe("Children content (text or JSX)"),
143
+ },
144
+ }, async (args) => {
145
+ log("Tool called: generate_react_component", args);
146
+ if (!db)
147
+ db = initializeDatabase();
148
+ const result = handleGenerateReactComponent(db, args);
149
+ log("Tool result: generate_react_component", { contentLength: result.content.length });
150
+ return result;
151
+ });
152
+ server.registerTool("search_documentation", {
153
+ description: "Search Mozaic Design System documentation for installation guides, component usage, configuration, styling, tokens, patterns, and best practices. Use this for any question about how to use Mozaic.",
154
+ inputSchema: {
155
+ query: z
156
+ .string()
157
+ .describe("Search query (e.g., 'installation', 'vue setup', 'button props', 'color tokens')"),
158
+ limit: z.number().default(5).describe("Maximum number of results"),
159
+ },
160
+ }, async (args) => {
161
+ log("Tool called: search_documentation", args);
162
+ if (!db)
163
+ db = initializeDatabase();
164
+ const result = handleSearchDocumentation(db, args);
165
+ log("Tool result: search_documentation", {
166
+ contentLength: result.content.length,
167
+ resultText: result.content[0]?.text?.substring(0, 500),
168
+ });
169
+ return result;
170
+ });
171
+ server.registerTool("get_css_utility", {
172
+ description: "Get CSS utility classes and examples for Mozaic layout and spacing utilities. These are CSS-only utilities (no framework component needed). Available: Flexy (flexbox grid), Container, Margin, Padding, Ratio, Scroll.",
173
+ inputSchema: {
174
+ name: z.string().describe("Utility name (e.g., 'flexy', 'margin', 'padding', 'container')"),
175
+ includeClasses: z
176
+ .boolean()
177
+ .default(true)
178
+ .describe("Include all CSS class names in the response"),
179
+ },
180
+ }, async (args) => {
181
+ log("Tool called: get_css_utility", args);
182
+ if (!db)
183
+ db = initializeDatabase();
184
+ const result = handleGetCssUtility(db, args);
185
+ log("Tool result: get_css_utility", { contentLength: result.content.length });
186
+ return result;
187
+ });
188
+ server.registerTool("list_css_utilities", {
189
+ description: "List Mozaic CSS-only utilities (no framework needed). Returns utility names to use with get_css_utility. Layout: Flexy (grid), Container. Utility: Margin, Padding, Ratio, Scroll.",
190
+ inputSchema: {
191
+ category: z
192
+ .enum(["layout", "utility", "all"])
193
+ .default("all")
194
+ .describe("Filter: 'layout' (Flexy, Container) or 'utility' (Margin, Padding, Ratio, Scroll)"),
195
+ },
196
+ }, async (args) => {
197
+ log("Tool called: list_css_utilities", args);
198
+ if (!db)
199
+ db = initializeDatabase();
200
+ const result = handleListCssUtilities(db, args);
201
+ log("Tool result: list_css_utilities", { contentLength: result.content.length });
202
+ return result;
203
+ });
204
+ server.registerTool("search_icons", {
205
+ description: "Search Mozaic Design System icons by name or type. Returns icon names, types (navigation, media, social, payment), and available sizes (16, 24, 32, 48, 64). Use get_icon for detailed SVG/code output.",
206
+ inputSchema: {
207
+ query: z
208
+ .string()
209
+ .describe('Search query for icon name (e.g., "arrow", "cart", "user", "check")'),
210
+ type: z
211
+ .string()
212
+ .optional()
213
+ .describe('Filter by icon type/category (e.g., "navigation", "media", "social")'),
214
+ size: z.number().optional().describe("Filter by icon size in pixels (16, 24, 32, 48, or 64)"),
215
+ limit: z.number().default(20).describe("Maximum number of results"),
216
+ },
217
+ }, async (args) => {
218
+ log("Tool called: search_icons", args);
219
+ if (!db)
220
+ db = initializeDatabase();
221
+ const result = handleSearchIcons(db, args);
222
+ log("Tool result: search_icons", { contentLength: result.content.length });
223
+ return result;
224
+ });
225
+ server.registerTool("get_icon", {
226
+ description: "Get a specific Mozaic icon by name with SVG markup and ready-to-use code for React/Vue. Use search_icons first to find icon names.",
227
+ inputSchema: {
228
+ name: z.string().describe('The icon name (e.g., "ArrowArrowBottom16", "Cart24", "User32")'),
229
+ format: z
230
+ .enum(["svg", "react", "vue", "all"])
231
+ .default("all")
232
+ .describe("Output format: svg (raw SVG), react (import code), vue (component code), or all"),
233
+ },
234
+ }, async (args) => {
235
+ log("Tool called: get_icon", args);
236
+ if (!db)
237
+ db = initializeDatabase();
238
+ const result = handleGetIcon(db, args);
239
+ log("Tool result: get_icon", { contentLength: result.content.length });
240
+ return result;
241
+ });
242
+ server.registerTool("get_install_info", {
243
+ description: "Get installation commands and import statements for a Mozaic component. Returns package name, install command (npm/yarn/pnpm), import statements, peer dependencies, and quick start code.",
244
+ inputSchema: {
245
+ component: z.string().describe('Component name (e.g., "button", "modal", "text-input")'),
246
+ framework: z
247
+ .enum(["vue", "react"])
248
+ .default("vue")
249
+ .describe("Target framework: vue (@mozaic-ds/vue-3) or react (@mozaic-ds/react)"),
250
+ packageManager: z
251
+ .enum(["npm", "yarn", "pnpm"])
252
+ .default("npm")
253
+ .describe("Package manager for install commands"),
254
+ },
255
+ }, async (args) => {
256
+ log("Tool called: get_install_info", args);
257
+ if (!db)
258
+ db = initializeDatabase();
259
+ const result = handleGetInstallInfo(db, args);
260
+ log("Tool result: get_install_info", { contentLength: result.content.length });
261
+ return result;
262
+ });
263
+ // CLI helper functions
264
+ function showVersion() {
265
+ const packageJson = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
266
+ console.log(`mozaic-mcp-server v${packageJson.version}`);
267
+ }
268
+ function showHelp() {
269
+ console.log(`
270
+ Mozaic MCP Server - Model Context Protocol server for Mozaic Design System
271
+
272
+ USAGE:
273
+ mozaic-mcp-server [OPTIONS]
274
+
275
+ OPTIONS:
276
+ --skills Install skills to .claude/skills/ in current directory
277
+ --skills --force Reinstall skills (overwrite existing files)
278
+ --list-skills Show available skills without installing
279
+ --version Show version number
280
+ --help Show this help message
281
+ --debug Enable debug logging to mcp-server.log
282
+
283
+ EXAMPLES:
284
+ # Start MCP server (default)
285
+ mozaic-mcp-server
286
+
287
+ # Install skills locally
288
+ mozaic-mcp-server --skills
289
+
290
+ # Force reinstall skills
291
+ mozaic-mcp-server --skills --force
292
+
293
+ # List available skills
294
+ mozaic-mcp-server --list-skills
295
+
296
+ For more information: https://github.com/MerzoukeMansouri/adeo-mozaic-mcp
297
+ `);
298
+ }
299
+ function listSkills() {
300
+ const skillsDir = join(__dirname, "..", "skills");
301
+ if (!existsSync(skillsDir)) {
302
+ console.log("āŒ Skills directory not found. Ensure the package is properly installed.");
303
+ process.exit(1);
304
+ }
305
+ const skillFiles = readdirSync(skillsDir).filter((f) => f.endsWith(".md"));
306
+ console.log("\nšŸ“š Available Mozaic Skills:\n");
307
+ for (const file of skillFiles) {
308
+ const skillPath = join(skillsDir, file);
309
+ const content = readFileSync(skillPath, "utf-8");
310
+ const titleMatch = content.match(/^# (.+)$/m);
311
+ const descMatch = content.match(/^This skill (.+)$/m);
312
+ const name = file.replace(".md", "");
313
+ const title = titleMatch ? titleMatch[1] : name;
314
+ const description = descMatch ? descMatch[1] : "No description available";
315
+ console.log(` • ${title}`);
316
+ console.log(` ${description}`);
317
+ console.log();
318
+ }
319
+ console.log(`To install: npx mozaic-mcp-server --skills\n`);
320
+ }
321
+ function installSkills(force = false) {
322
+ const cwd = process.cwd();
323
+ const targetDir = join(cwd, ".claude", "skills");
324
+ const skillsSourceDir = join(__dirname, "..", "skills");
325
+ // Check if source directory exists
326
+ if (!existsSync(skillsSourceDir)) {
327
+ console.log("āŒ Skills directory not found in package.");
328
+ console.log(" This might be a development environment. Build the project first: pnpm build");
329
+ process.exit(1);
330
+ }
331
+ // Create target directory
332
+ if (!existsSync(targetDir)) {
333
+ mkdirSync(targetDir, { recursive: true });
334
+ console.log(`āœ… Created directory: ${targetDir}`);
335
+ }
336
+ // Copy skill files
337
+ const skillFiles = readdirSync(skillsSourceDir).filter((f) => f.endsWith(".md"));
338
+ let installed = 0;
339
+ let skipped = 0;
340
+ let overwritten = 0;
341
+ console.log("\nšŸ“¦ Installing Mozaic skills...\n");
342
+ for (const file of skillFiles) {
343
+ const source = join(skillsSourceDir, file);
344
+ const target = join(targetDir, file);
345
+ if (existsSync(target) && !force) {
346
+ console.log(`āš ļø Skipped ${file} (already exists, use --force to overwrite)`);
347
+ skipped++;
348
+ }
349
+ else {
350
+ const wasExisting = existsSync(target);
351
+ copyFileSync(source, target);
352
+ if (wasExisting && force) {
353
+ console.log(`ā™»ļø Overwritten ${file}`);
354
+ overwritten++;
355
+ }
356
+ else {
357
+ console.log(`āœ… Installed ${file}`);
358
+ installed++;
359
+ }
360
+ }
361
+ }
362
+ console.log(`\nšŸŽ‰ Skill installation complete!`);
363
+ console.log(` Installed: ${installed}`);
364
+ if (overwritten > 0)
365
+ console.log(` Overwritten: ${overwritten}`);
366
+ if (skipped > 0)
367
+ console.log(` Skipped: ${skipped}`);
368
+ console.log(`\nšŸ“‚ Location: ${targetDir}`);
369
+ console.log(`\nšŸ’” Usage in Claude Code:`);
370
+ console.log(` • Skills are auto-detected in .claude/skills/`);
371
+ console.log(` • Use them naturally in conversation`);
372
+ console.log(` • Skills orchestrate Mozaic MCP tools automatically\n`);
373
+ }
374
+ // Parse CLI arguments
375
+ const args = process.argv.slice(2);
376
+ // Handle CLI commands
377
+ if (args.includes("--help") || args.includes("-h")) {
378
+ showHelp();
379
+ process.exit(0);
380
+ }
381
+ if (args.includes("--version") || args.includes("-v")) {
382
+ showVersion();
383
+ process.exit(0);
384
+ }
385
+ if (args.includes("--list-skills")) {
386
+ listSkills();
387
+ process.exit(0);
388
+ }
389
+ if (args.includes("--skills")) {
390
+ const force = args.includes("--force") || args.includes("-f");
391
+ installSkills(force);
392
+ process.exit(0);
393
+ }
394
+ // Start server
395
+ async function main() {
396
+ log("=== MCP Server Starting ===");
397
+ log("Debug mode enabled", { DEBUG, argv: process.argv });
398
+ log("Database path", { dbPath });
399
+ // Initialize database on startup
400
+ try {
401
+ db = initializeDatabase();
402
+ }
403
+ catch (error) {
404
+ log("Failed to initialize database on startup", { error: String(error) });
405
+ // Continue anyway - will fail gracefully on tool calls
406
+ }
407
+ log("Connecting to stdio transport");
408
+ const transport = new StdioServerTransport();
409
+ await server.connect(transport);
410
+ log("Server connected and ready");
411
+ }
412
+ main().catch((error) => {
413
+ log("Fatal error", { error: String(error) });
414
+ process.exit(1);
415
+ });
416
+ //# sourceMappingURL=index.js.map