multisite-cms-mcp 1.2.1 → 1.2.2
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 +83 -35
- package/dist/index.js +2 -2
- package/dist/tools/validate-template.d.ts.map +1 -1
- package/dist/tools/validate-template.js +80 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,9 +100,23 @@ Ask your AI assistant:
|
|
|
100
100
|
|
|
101
101
|
The AI will use validation tools to create a proper package structure.
|
|
102
102
|
|
|
103
|
-
### 2.
|
|
103
|
+
### 2. Validate & Create Schema (Important!)
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
Before deploying, validate your templates against the project schema:
|
|
106
|
+
|
|
107
|
+
> "Validate my templates against my Fast Mode project and create any missing fields or collections"
|
|
108
|
+
|
|
109
|
+
**The AI will automatically:**
|
|
110
|
+
1. Check each template for fields that don't exist
|
|
111
|
+
2. Call `get_field_types` to see available types
|
|
112
|
+
3. Call `sync_schema` to create missing collections and fields
|
|
113
|
+
4. Confirm everything is ready for deployment
|
|
114
|
+
|
|
115
|
+
⚠️ **This step is critical!** Templates won't render correctly if the fields don't exist.
|
|
116
|
+
|
|
117
|
+
### 3. Deploy to Fast Mode
|
|
118
|
+
|
|
119
|
+
Once your schema is synced:
|
|
106
120
|
|
|
107
121
|
> "Deploy this to Fast Mode"
|
|
108
122
|
|
|
@@ -111,36 +125,55 @@ The AI will:
|
|
|
111
125
|
2. Show your existing projects or create a new one
|
|
112
126
|
3. Upload and deploy your site
|
|
113
127
|
|
|
114
|
-
###
|
|
128
|
+
### 4. Your Site is Live!
|
|
115
129
|
|
|
116
130
|
Your site will be available at `https://your-site.fastmode.ai` and you can manage content at [app.fastmode.ai](https://app.fastmode.ai).
|
|
117
131
|
|
|
118
132
|
---
|
|
119
133
|
|
|
120
|
-
## Schema Sync (
|
|
134
|
+
## Schema Sync (Critical for Custom Fields)
|
|
135
|
+
|
|
136
|
+
When your templates use custom fields (fields beyond the built-in ones), you **must** create them in the CMS before deploying. The MCP server handles this automatically.
|
|
121
137
|
|
|
122
|
-
|
|
138
|
+
### Recommended Workflow
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
1. "Convert my website to Fast Mode format"
|
|
142
|
+
2. "Validate all templates against my project and create any missing fields"
|
|
143
|
+
3. "Deploy to Fast Mode"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The AI will:
|
|
147
|
+
- Use `validate_template` with your project ID to find missing fields
|
|
148
|
+
- Use `get_field_types` to determine the correct field type for each
|
|
149
|
+
- Use `sync_schema` to create fields/collections before deploying
|
|
123
150
|
|
|
124
|
-
###
|
|
151
|
+
### What Happens During Validation
|
|
125
152
|
|
|
126
|
-
|
|
127
|
-
```
|
|
128
|
-
"Validate my blog_post.html template against my Fast Mode project"
|
|
129
|
-
```
|
|
130
|
-
If fields are missing, the tool provides instructions.
|
|
153
|
+
When you validate a template with a project ID, the tool will:
|
|
131
154
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
```
|
|
136
|
-
Returns: text, richText, number, boolean, date, datetime, image, url, email, select, multiSelect, relation
|
|
155
|
+
1. **✅ All fields exist** → Schema validation passed, ready to deploy
|
|
156
|
+
2. **🚨 Missing fields** → Provides exact `sync_schema` call to create them
|
|
157
|
+
3. **🚨 Missing collection** → Provides exact `sync_schema` call to create collection with fields
|
|
137
158
|
|
|
138
|
-
|
|
139
|
-
```
|
|
140
|
-
"Add a heroImage (image) and category (select) field to my blogs collection"
|
|
141
|
-
```
|
|
159
|
+
### Available Field Types
|
|
142
160
|
|
|
143
|
-
|
|
161
|
+
| Type | Use For |
|
|
162
|
+
|------|---------|
|
|
163
|
+
| `text` | Short text (titles, names, single lines) |
|
|
164
|
+
| `richText` | Long formatted content with HTML (blog bodies, bios) |
|
|
165
|
+
| `number` | Numeric values (prices, counts, order) |
|
|
166
|
+
| `boolean` | True/false toggles (featured, published) |
|
|
167
|
+
| `date` | Date picker (publishedAt, eventDate) |
|
|
168
|
+
| `datetime` | Date + time picker |
|
|
169
|
+
| `image` | Image uploads (heroImage, thumbnail, photo) |
|
|
170
|
+
| `url` | Links (website, social profiles) |
|
|
171
|
+
| `email` | Email addresses |
|
|
172
|
+
| `select` | Single dropdown choice (category, status) |
|
|
173
|
+
| `multiSelect` | Multiple dropdown choices (tags) |
|
|
174
|
+
| `relation` | Link to another collection (author → authors) |
|
|
175
|
+
|
|
176
|
+
### Example: Adding Custom Fields to Built-in Collection
|
|
144
177
|
|
|
145
178
|
```json
|
|
146
179
|
{
|
|
@@ -180,32 +213,47 @@ The MCP server can automatically create collections and fields in your Fast Mode
|
|
|
180
213
|
|
|
181
214
|
**Features:**
|
|
182
215
|
- ✅ Validates all field types before creating
|
|
183
|
-
- ✅ Skips duplicates automatically
|
|
216
|
+
- ✅ Skips duplicates automatically (safe to re-run)
|
|
184
217
|
- ✅ Works with both builtin and custom collections
|
|
185
218
|
- ✅ Reports detailed results (created/skipped)
|
|
186
219
|
|
|
187
220
|
---
|
|
188
221
|
|
|
189
|
-
## Example
|
|
222
|
+
## Example Prompts
|
|
223
|
+
|
|
224
|
+
### Complete Workflow (Recommended)
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
"Convert this website to Fast Mode, validate against my project, create any missing fields, and deploy"
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Step by Step
|
|
190
231
|
|
|
191
232
|
```
|
|
192
|
-
# Convert
|
|
193
|
-
"
|
|
233
|
+
# 1. Convert website
|
|
234
|
+
"Convert this website to Fast Mode format"
|
|
235
|
+
|
|
236
|
+
# 2. Validate and sync schema (IMPORTANT - don't skip!)
|
|
237
|
+
"Validate my templates against my Fast Mode project and create any missing fields or collections"
|
|
194
238
|
|
|
195
|
-
#
|
|
196
|
-
"
|
|
239
|
+
# 3. Deploy
|
|
240
|
+
"Deploy to my Fast Mode project"
|
|
241
|
+
```
|
|
197
242
|
|
|
198
|
-
|
|
199
|
-
|
|
243
|
+
### Individual Operations
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
# Check what fields you can create
|
|
247
|
+
"What field types are available in Fast Mode?"
|
|
200
248
|
|
|
201
|
-
#
|
|
202
|
-
"Add a heroImage field (image type) to the blogs collection
|
|
249
|
+
# Add a specific field
|
|
250
|
+
"Add a heroImage field (image type) to the blogs collection"
|
|
203
251
|
|
|
204
|
-
#
|
|
205
|
-
"
|
|
252
|
+
# Create a new custom collection
|
|
253
|
+
"Create a 'testimonials' collection with name (text), quote (richText), and photo (image) fields"
|
|
206
254
|
|
|
207
|
-
#
|
|
208
|
-
"
|
|
255
|
+
# Validate a single template
|
|
256
|
+
"Validate my blog_post.html template against my project"
|
|
209
257
|
```
|
|
210
258
|
|
|
211
259
|
---
|
package/dist/index.js
CHANGED
|
@@ -51,7 +51,7 @@ const TOOLS = [
|
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
name: 'validate_template',
|
|
54
|
-
description: 'Validate an HTML template for correct CMS token usage. Checks
|
|
54
|
+
description: 'Validate an HTML template for correct CMS token usage. Checks {{token}} syntax, field names, and triple braces for rich text. IMPORTANT: When projectId is provided, validates tokens against the project schema and reports missing fields/collections that MUST be created with sync_schema before deploying.',
|
|
55
55
|
inputSchema: {
|
|
56
56
|
type: 'object',
|
|
57
57
|
properties: {
|
|
@@ -223,7 +223,7 @@ const TOOLS = [
|
|
|
223
223
|
},
|
|
224
224
|
{
|
|
225
225
|
name: 'sync_schema',
|
|
226
|
-
description: 'Create collections and/or add fields to
|
|
226
|
+
description: 'IMPORTANT: Create new collections and/or add custom fields to collections. Call this BEFORE deploying when validate_template reports missing fields or collections. Requires authentication. All fields must have a type specified - call get_field_types first to see available types. Skips duplicates automatically. Without calling this tool, templates with custom fields will not render correctly.',
|
|
227
227
|
inputSchema: {
|
|
228
228
|
type: 'object',
|
|
229
229
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-template.d.ts","sourceRoot":"","sources":["../../src/tools/validate-template.ts"],"names":[],"mappings":"AAMA,KAAK,YAAY,GAAG,YAAY,GAAG,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,eAAe,GAAG,eAAe,GAAG,cAAc,GAAG,eAAe,GAAG,aAAa,CAAC;AA6O7J;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,YAAY,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"validate-template.d.ts","sourceRoot":"","sources":["../../src/tools/validate-template.ts"],"names":[],"mappings":"AAMA,KAAK,YAAY,GAAG,YAAY,GAAG,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,eAAe,GAAG,eAAe,GAAG,cAAc,GAAG,eAAe,GAAG,aAAa,CAAC;AA6O7J;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,YAAY,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CA4ZjB"}
|
|
@@ -383,18 +383,76 @@ async function validateTemplate(html, templateType, collectionSlug, projectId) {
|
|
|
383
383
|
if (targetCollection && templateType !== 'static_page') {
|
|
384
384
|
// Extract fields used in template
|
|
385
385
|
const usedFields = extractTokenFieldNames(html);
|
|
386
|
-
//
|
|
387
|
-
const
|
|
388
|
-
if (
|
|
386
|
+
// Check if custom collection exists
|
|
387
|
+
const collectionExists = isBuiltin || schema.collections.some(c => c.slug === targetCollection);
|
|
388
|
+
if (!isBuiltin && !collectionExists) {
|
|
389
|
+
// Collection doesn't exist - need to create it
|
|
389
390
|
schemaValidation = `
|
|
390
391
|
|
|
391
|
-
##
|
|
392
|
+
## 🚨 ACTION REQUIRED: Collection Does Not Exist
|
|
392
393
|
|
|
393
|
-
The
|
|
394
|
+
The collection "${targetCollection}" does **not exist** in this project.
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
### ⚡ YOU MUST CREATE THIS COLLECTION
|
|
399
|
+
|
|
400
|
+
Use the \`sync_schema\` tool to create the collection and its fields before deploying.
|
|
401
|
+
|
|
402
|
+
**Step 1:** First, call \`get_field_types\` to see available field types.
|
|
403
|
+
|
|
404
|
+
**Step 2:** Then call \`sync_schema\` to create the collection with its fields:
|
|
405
|
+
|
|
406
|
+
\`\`\`json
|
|
407
|
+
{
|
|
408
|
+
"projectId": "${resolved.tenantId}",
|
|
409
|
+
"collections": [
|
|
410
|
+
{
|
|
411
|
+
"slug": "${targetCollection}",
|
|
412
|
+
"name": "${targetCollection.charAt(0).toUpperCase() + targetCollection.slice(1)}",
|
|
413
|
+
"nameSingular": "${targetCollection.endsWith('s') ? targetCollection.slice(0, -1).charAt(0).toUpperCase() + targetCollection.slice(0, -1).slice(1) : targetCollection.charAt(0).toUpperCase() + targetCollection.slice(1)}",
|
|
414
|
+
"fields": [
|
|
415
|
+
${usedFields.filter(f => !['name', 'slug', 'publishedAt'].includes(f)).map(f => ` { "slug": "${f}", "name": "${f.charAt(0).toUpperCase() + f.slice(1).replace(/([A-Z])/g, ' $1').trim()}", "type": "YOUR_TYPE" }`).join(',\n')}
|
|
416
|
+
]
|
|
417
|
+
}
|
|
418
|
+
]
|
|
419
|
+
}
|
|
420
|
+
\`\`\`
|
|
421
|
+
|
|
422
|
+
**Common field types:**
|
|
423
|
+
- \`text\` - Short text (titles, names)
|
|
424
|
+
- \`richText\` - Long formatted content with HTML
|
|
425
|
+
- \`image\` - Image upload
|
|
426
|
+
- \`url\` - Links
|
|
427
|
+
- \`boolean\` - True/false toggles
|
|
428
|
+
- \`date\` - Date picker
|
|
429
|
+
- \`number\` - Numeric values
|
|
430
|
+
- \`select\` - Dropdown (requires \`options\` parameter)
|
|
431
|
+
|
|
432
|
+
**DO NOT SKIP THIS STEP** - Templates will not render without the collection.
|
|
433
|
+
`;
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
// Find missing fields
|
|
437
|
+
const missingFields = findMissingFields(usedFields, targetCollection, isBuiltin, schema);
|
|
438
|
+
if (missingFields.length > 0) {
|
|
439
|
+
schemaValidation = `
|
|
440
|
+
|
|
441
|
+
## 🚨 ACTION REQUIRED: Missing Fields
|
|
442
|
+
|
|
443
|
+
The following fields are used in the template but **do not exist** in the "${targetCollection}" collection:
|
|
394
444
|
|
|
395
445
|
${missingFields.map(f => `- \`${f}\``).join('\n')}
|
|
396
446
|
|
|
397
|
-
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
### ⚡ YOU MUST CREATE THESE FIELDS
|
|
450
|
+
|
|
451
|
+
Use the \`sync_schema\` tool to create the missing fields before deploying. This is required for your template to work correctly.
|
|
452
|
+
|
|
453
|
+
**Step 1:** First, call \`get_field_types\` to see available field types.
|
|
454
|
+
|
|
455
|
+
**Step 2:** Then call \`sync_schema\` with the following structure (replace YOUR_TYPE with actual field types):
|
|
398
456
|
|
|
399
457
|
\`\`\`json
|
|
400
458
|
{
|
|
@@ -404,24 +462,34 @@ ${missingFields.map(f => `- \`${f}\``).join('\n')}
|
|
|
404
462
|
"collectionSlug": "${targetCollection}",
|
|
405
463
|
"isBuiltin": ${isBuiltin},
|
|
406
464
|
"fields": [
|
|
407
|
-
${missingFields.map(f => ` { "slug": "${f}", "name": "${f.charAt(0).toUpperCase() + f.slice(1).replace(/([A-Z])/g, ' $1')}", "type": "
|
|
465
|
+
${missingFields.map(f => ` { "slug": "${f}", "name": "${f.charAt(0).toUpperCase() + f.slice(1).replace(/([A-Z])/g, ' $1').trim()}", "type": "YOUR_TYPE" }`).join(',\n')}
|
|
408
466
|
]
|
|
409
467
|
}
|
|
410
468
|
]
|
|
411
469
|
}
|
|
412
470
|
\`\`\`
|
|
413
471
|
|
|
414
|
-
**
|
|
415
|
-
|
|
472
|
+
**Common field types:**
|
|
473
|
+
- \`text\` - Short text (titles, names)
|
|
474
|
+
- \`richText\` - Long formatted content with HTML
|
|
475
|
+
- \`image\` - Image upload
|
|
476
|
+
- \`url\` - Links
|
|
477
|
+
- \`boolean\` - True/false toggles
|
|
478
|
+
- \`date\` - Date picker
|
|
479
|
+
- \`number\` - Numeric values
|
|
480
|
+
- \`select\` - Dropdown (requires \`options\` parameter)
|
|
481
|
+
|
|
482
|
+
**DO NOT SKIP THIS STEP** - Templates will not render correctly without these fields.
|
|
416
483
|
`;
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
schemaValidation = `
|
|
420
487
|
|
|
421
488
|
## ✅ Schema Validation Passed
|
|
422
489
|
|
|
423
490
|
All fields used in this template exist in the "${targetCollection}" collection.
|
|
424
491
|
`;
|
|
492
|
+
}
|
|
425
493
|
}
|
|
426
494
|
}
|
|
427
495
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "multisite-cms-mcp",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "MCP server for Fast Mode CMS. Convert websites, validate packages, and deploy directly to Fast Mode. Includes authentication, project creation, schema sync, and one-click deployment.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|