multisite-cms-mcp 1.2.0 → 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 +138 -13
- 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
|
@@ -35,8 +35,9 @@ These tools work without authentication — perfect for converting and validatin
|
|
|
35
35
|
| Tool | Description |
|
|
36
36
|
|------|-------------|
|
|
37
37
|
| `get_schema` | Get the complete CMS schema with all collections and fields |
|
|
38
|
+
| `get_field_types` | Get available field types for creating custom fields |
|
|
38
39
|
| `validate_manifest` | Validate your manifest.json file |
|
|
39
|
-
| `validate_template` | Check HTML templates for correct token usage |
|
|
40
|
+
| `validate_template` | Check HTML templates for correct token usage (with optional schema validation) |
|
|
40
41
|
| `validate_package` | Validate complete package structure |
|
|
41
42
|
| `get_example` | Get example code for common patterns |
|
|
42
43
|
| `get_conversion_guide` | Step-by-step website conversion guide |
|
|
@@ -51,6 +52,7 @@ These tools require a Fast Mode account. The MCP server will automatically open
|
|
|
51
52
|
| `get_tenant_schema` | Get schema for a specific project (including custom fields) |
|
|
52
53
|
| `create_site` | Create a new Fast Mode project |
|
|
53
54
|
| `deploy_package` | Deploy a website package to Fast Mode |
|
|
55
|
+
| `sync_schema` | Create collections and fields in your project |
|
|
54
56
|
|
|
55
57
|
---
|
|
56
58
|
|
|
@@ -98,9 +100,23 @@ Ask your AI assistant:
|
|
|
98
100
|
|
|
99
101
|
The AI will use validation tools to create a proper package structure.
|
|
100
102
|
|
|
101
|
-
### 2.
|
|
103
|
+
### 2. Validate & Create Schema (Important!)
|
|
102
104
|
|
|
103
|
-
|
|
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:
|
|
104
120
|
|
|
105
121
|
> "Deploy this to Fast Mode"
|
|
106
122
|
|
|
@@ -109,26 +125,135 @@ The AI will:
|
|
|
109
125
|
2. Show your existing projects or create a new one
|
|
110
126
|
3. Upload and deploy your site
|
|
111
127
|
|
|
112
|
-
###
|
|
128
|
+
### 4. Your Site is Live!
|
|
113
129
|
|
|
114
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).
|
|
115
131
|
|
|
116
132
|
---
|
|
117
133
|
|
|
118
|
-
##
|
|
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.
|
|
137
|
+
|
|
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
|
|
150
|
+
|
|
151
|
+
### What Happens During Validation
|
|
152
|
+
|
|
153
|
+
When you validate a template with a project ID, the tool will:
|
|
154
|
+
|
|
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
|
|
158
|
+
|
|
159
|
+
### Available Field Types
|
|
160
|
+
|
|
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
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"projectId": "my-project",
|
|
181
|
+
"fieldsToAdd": [
|
|
182
|
+
{
|
|
183
|
+
"collectionSlug": "blogs",
|
|
184
|
+
"isBuiltin": true,
|
|
185
|
+
"fields": [
|
|
186
|
+
{ "slug": "heroImage", "name": "Hero Image", "type": "image" },
|
|
187
|
+
{ "slug": "category", "name": "Category", "type": "select", "options": "Tech,Business,Lifestyle" }
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Example: Creating a Custom Collection
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"projectId": "my-project",
|
|
199
|
+
"collections": [
|
|
200
|
+
{
|
|
201
|
+
"slug": "products",
|
|
202
|
+
"name": "Products",
|
|
203
|
+
"nameSingular": "Product",
|
|
204
|
+
"fields": [
|
|
205
|
+
{ "slug": "price", "name": "Price", "type": "number" },
|
|
206
|
+
{ "slug": "description", "name": "Description", "type": "richText" },
|
|
207
|
+
{ "slug": "image", "name": "Product Image", "type": "image" }
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Features:**
|
|
215
|
+
- ✅ Validates all field types before creating
|
|
216
|
+
- ✅ Skips duplicates automatically (safe to re-run)
|
|
217
|
+
- ✅ Works with both builtin and custom collections
|
|
218
|
+
- ✅ Reports detailed results (created/skipped)
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
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
|
|
231
|
+
|
|
232
|
+
```
|
|
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"
|
|
238
|
+
|
|
239
|
+
# 3. Deploy
|
|
240
|
+
"Deploy to my Fast Mode project"
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Individual Operations
|
|
119
244
|
|
|
120
245
|
```
|
|
121
|
-
#
|
|
122
|
-
"
|
|
246
|
+
# Check what fields you can create
|
|
247
|
+
"What field types are available in Fast Mode?"
|
|
123
248
|
|
|
124
|
-
#
|
|
125
|
-
"
|
|
249
|
+
# Add a specific field
|
|
250
|
+
"Add a heroImage field (image type) to the blogs collection"
|
|
126
251
|
|
|
127
|
-
#
|
|
128
|
-
"
|
|
252
|
+
# Create a new custom collection
|
|
253
|
+
"Create a 'testimonials' collection with name (text), quote (richText), and photo (image) fields"
|
|
129
254
|
|
|
130
|
-
#
|
|
131
|
-
"
|
|
255
|
+
# Validate a single template
|
|
256
|
+
"Validate my blog_post.html template against my project"
|
|
132
257
|
```
|
|
133
258
|
|
|
134
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": {
|