mozaic-mcp-server 2.1.0 → 2.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/README.md +11 -7
- package/SKILLS.md +53 -5
- package/bin/install-skills.js +1 -0
- package/data/mozaic.db +0 -0
- package/dist/__tests__/tools.integration.test.js +85 -0
- package/dist/__tests__/tools.integration.test.js.map +1 -1
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -1
- package/dist/parsers/web-components-parser.d.ts +3 -0
- package/dist/parsers/web-components-parser.d.ts.map +1 -0
- package/dist/parsers/web-components-parser.js +491 -0
- package/dist/parsers/web-components-parser.js.map +1 -0
- package/dist/tools/generate-webcomponent.d.ts +38 -0
- package/dist/tools/generate-webcomponent.d.ts.map +1 -0
- package/dist/tools/generate-webcomponent.js +83 -0
- package/dist/tools/generate-webcomponent.js.map +1 -0
- package/dist/tools/get-component-info.d.ts +1 -1
- package/dist/tools/get-component-info.d.ts.map +1 -1
- package/dist/tools/get-component-info.js +5 -1
- package/dist/tools/get-component-info.js.map +1 -1
- package/dist/tools/get-webcomponent-info.d.ts +52 -0
- package/dist/tools/get-webcomponent-info.d.ts.map +1 -0
- package/dist/tools/get-webcomponent-info.js +170 -0
- package/dist/tools/get-webcomponent-info.js.map +1 -0
- package/dist/tools/list-webcomponents.d.ts +32 -0
- package/dist/tools/list-webcomponents.d.ts.map +1 -0
- package/dist/tools/list-webcomponents.js +110 -0
- package/dist/tools/list-webcomponents.js.map +1 -0
- package/package.json +1 -1
- package/skills/mozaic-webcomponents-builder/scripts/generate-component.sh +67 -0
- package/skills/mozaic-webcomponents-builder/scripts/get-component.sh +105 -0
- package/skills/mozaic-webcomponents-builder/scripts/list-components.sh +42 -0
- package/skills/mozaic-webcomponents-builder/scripts/search-components.sh +34 -0
- package/skills/mozaic-webcomponents-builder/skill.md +292 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Search Web Components by name or description
|
|
3
|
+
# Usage: ./search-components.sh <query>
|
|
4
|
+
|
|
5
|
+
QUERY="$1"
|
|
6
|
+
DB_PATH="${MOZAIC_DB_PATH:-${HOME}/.claude/mozaic.db}"
|
|
7
|
+
|
|
8
|
+
if [ -z "$QUERY" ]; then
|
|
9
|
+
echo "Error: Search query required"
|
|
10
|
+
echo "Usage: $0 <query>"
|
|
11
|
+
echo "Example: $0 button"
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
if [ ! -f "$DB_PATH" ]; then
|
|
16
|
+
echo "Error: Database not found at $DB_PATH"
|
|
17
|
+
echo "Please run: npx -p mozaic-mcp-server@latest adeo-mozaic-install-tools skills"
|
|
18
|
+
exit 1
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
sqlite3 "$DB_PATH" <<EOF
|
|
22
|
+
.mode json
|
|
23
|
+
SELECT name, slug, category, description
|
|
24
|
+
FROM components
|
|
25
|
+
WHERE frameworks LIKE '%webcomponents%'
|
|
26
|
+
AND (
|
|
27
|
+
name LIKE '%$QUERY%'
|
|
28
|
+
OR slug LIKE '%$QUERY%'
|
|
29
|
+
OR description LIKE '%$QUERY%'
|
|
30
|
+
OR category LIKE '%$QUERY%'
|
|
31
|
+
)
|
|
32
|
+
ORDER BY name
|
|
33
|
+
LIMIT 20;
|
|
34
|
+
EOF
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mozaic-webcomponents-builder
|
|
3
|
+
description: Interactive Web Components generator with Mozaic Design System. Helps discover, configure, and generate production-ready native web components with proper imports and usage patterns.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Bash
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Mozaic Web Components Builder
|
|
10
|
+
|
|
11
|
+
An interactive assistant for building framework-agnostic applications with Mozaic Design System Web Components by ADEO. This skill helps you discover components, understand their attributes and events, generate ready-to-use HTML/JavaScript code, and set up installation properly.
|
|
12
|
+
|
|
13
|
+
## What This Skill Does
|
|
14
|
+
|
|
15
|
+
1. **Discover Web Components**: Browse Mozaic web components by category (forms, navigation, feedback, etc.)
|
|
16
|
+
2. **Interactive Selection**: Propose component combinations based on your needs
|
|
17
|
+
3. **Generate Code**: Create complete HTML with JavaScript imports and proper attribute usage
|
|
18
|
+
4. **Installation Guidance**: Provide npm/yarn commands and import strategies (module vs script tag)
|
|
19
|
+
5. **Attributes & Events**: Help configure component attributes and set up event listeners
|
|
20
|
+
6. **Slots & CSS Properties**: Guide on using slots for content projection and CSS custom properties for theming
|
|
21
|
+
|
|
22
|
+
## Shell Scripts Used
|
|
23
|
+
|
|
24
|
+
This skill uses shell scripts to query the local Mozaic database:
|
|
25
|
+
- `list-components.sh` - Browse available web components by category
|
|
26
|
+
- `get-component.sh` - Get detailed component information (attributes, slots, events, CSS properties)
|
|
27
|
+
- `search-components.sh` - Search components by name or description
|
|
28
|
+
- `generate-component.sh` - Generate web component usage code
|
|
29
|
+
|
|
30
|
+
Database location: `~/.claude/mozaic.db`
|
|
31
|
+
|
|
32
|
+
## When to Use This Skill
|
|
33
|
+
|
|
34
|
+
Use this skill when you:
|
|
35
|
+
- Need framework-agnostic UI components (vanilla JS, server-rendered apps, micro-frontends)
|
|
36
|
+
- Want to build with native Web Components (Custom Elements v1)
|
|
37
|
+
- Need components that work across frameworks (React, Vue, Angular, Svelte)
|
|
38
|
+
- Are building progressive enhancement layers
|
|
39
|
+
- Want to explore available Mozaic web components
|
|
40
|
+
- Need help with component attributes, events, and slots
|
|
41
|
+
- Want installation and import guidance for web components
|
|
42
|
+
|
|
43
|
+
## Interactive Workflow
|
|
44
|
+
|
|
45
|
+
### Step 1: Understanding Your Needs
|
|
46
|
+
|
|
47
|
+
When you activate this skill, I'll ask:
|
|
48
|
+
|
|
49
|
+
**"What type of web component do you need to build?"**
|
|
50
|
+
|
|
51
|
+
Common options:
|
|
52
|
+
- A) Form (inputs, selects, checkboxes, validation)
|
|
53
|
+
- B) Navigation (tabs, breadcrumb, pagination, menu)
|
|
54
|
+
- C) Modal/Dialog (overlay, confirmation, alert)
|
|
55
|
+
- D) Button/Action (primary, secondary, with icons)
|
|
56
|
+
- E) Layout (cards, containers, dividers)
|
|
57
|
+
- F) Data Display (tables, lists, badges, tags)
|
|
58
|
+
- G) Feedback (notifications, loaders, progress bars)
|
|
59
|
+
- H) Other (describe your needs)
|
|
60
|
+
|
|
61
|
+
### Step 2: Browse Available Components
|
|
62
|
+
|
|
63
|
+
Based on your answer, I'll use the `list-components.sh` script to show relevant web components.
|
|
64
|
+
|
|
65
|
+
**Example**:
|
|
66
|
+
```
|
|
67
|
+
For forms, Mozaic offers these web components:
|
|
68
|
+
- mozaic-input (text, email, password fields)
|
|
69
|
+
- mozaic-select (dropdowns with single/multiple selection)
|
|
70
|
+
- mozaic-checkbox (checkbox with label)
|
|
71
|
+
- mozaic-radio (radio button)
|
|
72
|
+
- mozaic-toggle (switch control)
|
|
73
|
+
- mozaic-textarea (multi-line text input)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Step 3: Component Details
|
|
77
|
+
|
|
78
|
+
I'll use the `get-component.sh` script to show:
|
|
79
|
+
- Available attributes (HTML attributes and properties)
|
|
80
|
+
- Slots for content projection
|
|
81
|
+
- Custom events you can listen to
|
|
82
|
+
- CSS custom properties for theming
|
|
83
|
+
- Usage examples
|
|
84
|
+
|
|
85
|
+
**Example**:
|
|
86
|
+
```html
|
|
87
|
+
<!-- mozaic-button Attributes -->
|
|
88
|
+
<mozaic-button
|
|
89
|
+
theme="primary" <!-- Theme: primary, secondary, tertiary -->
|
|
90
|
+
size="m" <!-- Size: s, m, l -->
|
|
91
|
+
disabled="false" <!-- Disabled state -->
|
|
92
|
+
icon-left="arrow" <!-- Icon on left -->
|
|
93
|
+
full-width="false" <!-- Full width button -->
|
|
94
|
+
>
|
|
95
|
+
Click me
|
|
96
|
+
</mozaic-button>
|
|
97
|
+
|
|
98
|
+
<!-- Events -->
|
|
99
|
+
button.addEventListener('mozaic-click', (e) => {
|
|
100
|
+
console.log('Button clicked!', e.detail);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
<!-- CSS Custom Properties -->
|
|
104
|
+
:root {
|
|
105
|
+
--mozaic-button-bg: #007bff;
|
|
106
|
+
--mozaic-button-text: #fff;
|
|
107
|
+
--mozaic-button-padding: 12px 24px;
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Step 4: Propose Component Combinations
|
|
112
|
+
|
|
113
|
+
I'll suggest 2-3 combinations that work well together:
|
|
114
|
+
|
|
115
|
+
**Example for "Login Form"**:
|
|
116
|
+
|
|
117
|
+
**Option 1: Simple Login Form**
|
|
118
|
+
```html
|
|
119
|
+
<!-- Import components -->
|
|
120
|
+
<script type="module">
|
|
121
|
+
import '@adeo/mozaic-web-components/input.js';
|
|
122
|
+
import '@adeo/mozaic-web-components/button.js';
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
<!-- Usage -->
|
|
126
|
+
<form id="login-form">
|
|
127
|
+
<mozaic-input
|
|
128
|
+
label="Email"
|
|
129
|
+
type="email"
|
|
130
|
+
name="email"
|
|
131
|
+
required="true"
|
|
132
|
+
></mozaic-input>
|
|
133
|
+
|
|
134
|
+
<mozaic-input
|
|
135
|
+
label="Password"
|
|
136
|
+
type="password"
|
|
137
|
+
name="password"
|
|
138
|
+
required="true"
|
|
139
|
+
></mozaic-input>
|
|
140
|
+
|
|
141
|
+
<mozaic-button theme="primary" type="submit">
|
|
142
|
+
Login
|
|
143
|
+
</mozaic-button>
|
|
144
|
+
</form>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Option 2: Enhanced Login with Validation & Events**
|
|
148
|
+
```html
|
|
149
|
+
<!-- Import components -->
|
|
150
|
+
<script type="module">
|
|
151
|
+
import '@adeo/mozaic-web-components/input.js';
|
|
152
|
+
import '@adeo/mozaic-web-components/button.js';
|
|
153
|
+
import '@adeo/mozaic-web-components/checkbox.js';
|
|
154
|
+
</script>
|
|
155
|
+
|
|
156
|
+
<!-- Usage -->
|
|
157
|
+
<form id="login-form">
|
|
158
|
+
<mozaic-input
|
|
159
|
+
id="email-input"
|
|
160
|
+
label="Email"
|
|
161
|
+
type="email"
|
|
162
|
+
name="email"
|
|
163
|
+
required="true"
|
|
164
|
+
error-message=""
|
|
165
|
+
></mozaic-input>
|
|
166
|
+
|
|
167
|
+
<mozaic-input
|
|
168
|
+
id="password-input"
|
|
169
|
+
label="Password"
|
|
170
|
+
type="password"
|
|
171
|
+
name="password"
|
|
172
|
+
required="true"
|
|
173
|
+
error-message=""
|
|
174
|
+
></mozaic-input>
|
|
175
|
+
|
|
176
|
+
<mozaic-checkbox
|
|
177
|
+
name="remember"
|
|
178
|
+
label="Remember me"
|
|
179
|
+
></mozaic-checkbox>
|
|
180
|
+
|
|
181
|
+
<mozaic-button id="login-btn" theme="primary" type="submit">
|
|
182
|
+
Login
|
|
183
|
+
</mozaic-button>
|
|
184
|
+
</form>
|
|
185
|
+
|
|
186
|
+
<script>
|
|
187
|
+
const form = document.getElementById('login-form');
|
|
188
|
+
const emailInput = document.getElementById('email-input');
|
|
189
|
+
const passwordInput = document.getElementById('password-input');
|
|
190
|
+
const loginBtn = document.getElementById('login-btn');
|
|
191
|
+
|
|
192
|
+
// Listen to input changes
|
|
193
|
+
emailInput.addEventListener('mozaic-change', (e) => {
|
|
194
|
+
validateEmail(e.detail.value);
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
passwordInput.addEventListener('mozaic-change', (e) => {
|
|
198
|
+
validatePassword(e.detail.value);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
// Form submission
|
|
202
|
+
form.addEventListener('submit', async (e) => {
|
|
203
|
+
e.preventDefault();
|
|
204
|
+
loginBtn.setAttribute('loading', 'true');
|
|
205
|
+
|
|
206
|
+
// Perform login
|
|
207
|
+
try {
|
|
208
|
+
await login(emailInput.value, passwordInput.value);
|
|
209
|
+
} finally {
|
|
210
|
+
loginBtn.setAttribute('loading', 'false');
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
function validateEmail(email) {
|
|
215
|
+
if (!email.includes('@')) {
|
|
216
|
+
emailInput.setAttribute('error-message', 'Invalid email format');
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
emailInput.removeAttribute('error-message');
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function validatePassword(password) {
|
|
224
|
+
if (password.length < 8) {
|
|
225
|
+
passwordInput.setAttribute('error-message', 'Password must be at least 8 characters');
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
passwordInput.removeAttribute('error-message');
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
</script>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Option 3: Server-Side Rendered with Progressive Enhancement**
|
|
235
|
+
```html
|
|
236
|
+
<!-- SSR-friendly - works without JavaScript, enhanced with JS -->
|
|
237
|
+
<form id="login-form" action="/login" method="POST">
|
|
238
|
+
<div class="form-field">
|
|
239
|
+
<label for="email">Email</label>
|
|
240
|
+
<input type="email" name="email" id="email" required>
|
|
241
|
+
</div>
|
|
242
|
+
|
|
243
|
+
<div class="form-field">
|
|
244
|
+
<label for="password">Password</label>
|
|
245
|
+
<input type="password" name="password" id="password" required>
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
<button type="submit">Login</button>
|
|
249
|
+
</form>
|
|
250
|
+
|
|
251
|
+
<!-- Progressive enhancement with web components -->
|
|
252
|
+
<script type="module">
|
|
253
|
+
import '@adeo/mozaic-web-components/input.js';
|
|
254
|
+
import '@adeo/mozaic-web-components/button.js';
|
|
255
|
+
|
|
256
|
+
// Enhance form when components are loaded
|
|
257
|
+
customElements.whenDefined('mozaic-input').then(() => {
|
|
258
|
+
enhanceForm();
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
function enhanceForm() {
|
|
262
|
+
const form = document.getElementById('login-form');
|
|
263
|
+
// Replace native inputs with web components
|
|
264
|
+
// Web components will read existing values
|
|
265
|
+
}
|
|
266
|
+
</script>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Step 5: Refinement & Configuration
|
|
270
|
+
|
|
271
|
+
You can:
|
|
272
|
+
- Choose an option: "I like Option 2"
|
|
273
|
+
- Customize: "Add a forgot password link"
|
|
274
|
+
- Combine: "Use Option 1 but add event handling from Option 2"
|
|
275
|
+
- Request changes: "Make the button full width"
|
|
276
|
+
- Ask about features: "How do I add an icon to the button?"
|
|
277
|
+
|
|
278
|
+
### Step 6: Generate Final Code
|
|
279
|
+
|
|
280
|
+
I'll use the `generate-component.sh` script to create complete code with:
|
|
281
|
+
- Import statements (ES modules or script tags)
|
|
282
|
+
- Component usage with proper attributes
|
|
283
|
+
- Event listener setup
|
|
284
|
+
- CSS custom property theming
|
|
285
|
+
- Accessibility attributes
|
|
286
|
+
|
|
287
|
+
## Common Use Cases
|
|
288
|
+
|
|
289
|
+
### 1. Creating a Contact Form
|
|
290
|
+
|
|
291
|
+
```markdown
|
|
292
|
+
User: "I need a contact form with name, email, and message fields"
|