@content-island/mcp 0.1.1 → 0.1.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/dist/index.js +59 -51
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { z as
|
|
2
|
-
import { McpServer as
|
|
3
|
-
import { createClient as
|
|
4
|
-
import { StdioServerTransport as
|
|
5
|
-
const
|
|
1
|
+
import { z as o } from "zod";
|
|
2
|
+
import { McpServer as l } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { createClient as p } from "@content-island/api-client";
|
|
4
|
+
import { StdioServerTransport as d } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
const r = {
|
|
6
6
|
CONTENT_ISLAND_ACCESS_TOKEN: process.env.CONTENT_ISLAND_ACCESS_TOKEN,
|
|
7
7
|
CONTENT_ISLAND_DOMAIN: process.env.CONTENT_ISLAND_DOMAIN,
|
|
8
8
|
CONTENT_ISLAND_SECURE_PROTOCOL: process.env.CONTENT_ISLAND_SECURE_PROTOCOL !== "false",
|
|
9
9
|
CONTENT_ISLAND_API_VERSION: process.env.CONTENT_ISLAND_API_VERSION
|
|
10
|
-
},
|
|
11
|
-
version:
|
|
12
|
-
},
|
|
10
|
+
}, u = "0.1.2", g = {
|
|
11
|
+
version: u
|
|
12
|
+
}, s = new l({
|
|
13
13
|
name: "Content Island",
|
|
14
|
-
version:
|
|
14
|
+
version: g.version
|
|
15
15
|
}), m = () => {
|
|
16
|
-
|
|
16
|
+
s.prompt(
|
|
17
17
|
"create-content-island-project",
|
|
18
18
|
"Professional MCP Server prompt for creating modern frontend projects integrated with Content Island CMS",
|
|
19
19
|
{
|
|
20
|
-
framework:
|
|
21
|
-
pages:
|
|
22
|
-
location:
|
|
23
|
-
styling:
|
|
24
|
-
design:
|
|
20
|
+
framework: o.string().describe("Framework choice (Next.js, Astro, Nuxt, etc.)"),
|
|
21
|
+
pages: o.string().describe("Pages needed (Homepage, Blog, Contact, etc.)"),
|
|
22
|
+
location: o.string().describe("Project location (root directory or subfolder name)"),
|
|
23
|
+
styling: o.string().describe("Styling preference (Tailwind CSS or custom)"),
|
|
24
|
+
design: o.string().describe("Design assets (mockups, wireframes, or none)")
|
|
25
25
|
},
|
|
26
|
-
async (
|
|
27
|
-
const { framework: e, pages:
|
|
28
|
-
return e &&
|
|
26
|
+
async (c) => {
|
|
27
|
+
const { framework: e, pages: i, location: t, styling: n, design: a } = c;
|
|
28
|
+
return e && i && t && n && a ? {
|
|
29
29
|
description: "Content Island project generator",
|
|
30
30
|
messages: [
|
|
31
31
|
{
|
|
@@ -38,9 +38,9 @@ I'll create a professional ${e} application integrated with your Content Island
|
|
|
38
38
|
|
|
39
39
|
**Configuration:**
|
|
40
40
|
- Framework: **${e}**
|
|
41
|
-
- Pages: ${
|
|
42
|
-
- Location: ${
|
|
43
|
-
- Styling: ${
|
|
41
|
+
- Pages: ${i}
|
|
42
|
+
- Location: ${t}
|
|
43
|
+
- Styling: ${n}
|
|
44
44
|
- Design: ${a}
|
|
45
45
|
|
|
46
46
|
# CRITICAL IMPLEMENTATION INSTRUCTIONS - FOLLOW EXACTLY
|
|
@@ -49,13 +49,20 @@ You are a specialized web development assistant creating a ${e} application inte
|
|
|
49
49
|
|
|
50
50
|
## MANDATORY EXECUTION SEQUENCE - NO EXCEPTIONS
|
|
51
51
|
|
|
52
|
-
### STEP 1:
|
|
53
|
-
-
|
|
52
|
+
### STEP 1: FRAMEWORK PROJECT INITIALIZATION (REQUIRED FIRST ACTION)
|
|
53
|
+
- FIRST execute the appropriate framework CLI command to create the base project:
|
|
54
|
+
${e === "Next.js" ? ` * Run: npx create-next-app@latest ${t !== "root directory" ? t : "."} --typescript --tailwind --eslint --app --src-dir --import-alias "@/*"` : e === "Nuxt" ? ` * Run: npx nuxi@latest init ${t !== "root directory" ? t : "."}` : e === "Astro" ? ` * Run: npm create astro@latest ${t !== "root directory" ? t : "."}` : e === "SvelteKit" ? ` * Run: npm create svelte@latest ${t !== "root directory" ? t : "."}` : e === "Vite" ? ` * Run: npm create vite@latest ${t !== "root directory" ? t : "."} -- --template react-ts` : ` * Run the appropriate CLI command for ${e} to create a new project in ${t !== "root directory" ? t : "current directory"}`}
|
|
55
|
+
- Navigate to the project directory if created in a subfolder
|
|
56
|
+
- Wait for the framework setup to complete before proceeding
|
|
57
|
+
- DO NOT skip this step - the framework base is required for all subsequent steps
|
|
58
|
+
|
|
59
|
+
### STEP 2: DATA RETRIEVAL (REQUIRED SECOND ACTION)
|
|
60
|
+
- You MUST call the 'get-content-island-project' tool as your SECOND action
|
|
54
61
|
- DO NOT proceed with ANY code generation until you have the project structure
|
|
55
62
|
- Parse the returned JSON to extract: project languages, content types, and field definitions
|
|
56
63
|
- If the tool fails, STOP and ask user to check their Content Island configuration
|
|
57
64
|
|
|
58
|
-
### STEP
|
|
65
|
+
### STEP 3: PACKAGE INSTALLATION (MANDATORY BEFORE CODE GENERATION)
|
|
59
66
|
${e === "Nuxt" ? `
|
|
60
67
|
- FIRST install the official Content Island packages:
|
|
61
68
|
* npm install @content-island/nuxt@latest
|
|
@@ -70,7 +77,7 @@ ${e === "Nuxt" ? `
|
|
|
70
77
|
- NEVER create custom API implementations
|
|
71
78
|
- NEVER invent API methods that don't exist
|
|
72
79
|
|
|
73
|
-
### STEP
|
|
80
|
+
### STEP 4: TYPESCRIPT INTERFACE GENERATION (EXACT MAPPING REQUIRED)
|
|
74
81
|
- Import Media type from '@content-island/api-client' if needed: import type { Media } from '@content-island/api-client'
|
|
75
82
|
- Generate TypeScript interfaces using EXACTLY the structure returned by the tool
|
|
76
83
|
- For EACH content type in the project data, create ONE interface
|
|
@@ -89,7 +96,7 @@ ${e === "Nuxt" ? `
|
|
|
89
96
|
Field: {"name": "title", "type": "short-text", "tsType": "string", "isArray": false, "isRequired": true}
|
|
90
97
|
Result: title: string;
|
|
91
98
|
|
|
92
|
-
### STEP
|
|
99
|
+
### STEP 5: API CLIENT IMPLEMENTATION (DOCUMENTED METHODS ONLY)
|
|
93
100
|
${e === "Nuxt" ? `
|
|
94
101
|
- Use Nuxt Content Island composables from '@content-island/nuxt'
|
|
95
102
|
- Configure the module in nuxt.config.ts with your project settings
|
|
@@ -124,11 +131,11 @@ ${e === "Nuxt" ? `
|
|
|
124
131
|
- Always include language parameter support for multi-language projects
|
|
125
132
|
|
|
126
133
|
|
|
127
|
-
### STEP
|
|
134
|
+
### STEP 6: PROJECT STRUCTURE GENERATION (FRAMEWORK-SPECIFIC)
|
|
128
135
|
- Framework: ${e}
|
|
129
|
-
- Location: ${
|
|
130
|
-
- Pages requested: ${
|
|
131
|
-
- Styling: ${
|
|
136
|
+
- Location: ${t}
|
|
137
|
+
- Pages requested: ${i}
|
|
138
|
+
- Styling: ${n}
|
|
132
139
|
- Design approach: ${a}
|
|
133
140
|
|
|
134
141
|
#### FRAMEWORK-SPECIFIC REQUIREMENTS:
|
|
@@ -154,7 +161,7 @@ ${e === "Nuxt" ? `
|
|
|
154
161
|
- Implement proper SEO with useHead
|
|
155
162
|
` : ""}
|
|
156
163
|
|
|
157
|
-
### STEP
|
|
164
|
+
### STEP 7: ENVIRONMENT CONFIGURATION (MANDATORY FILES)
|
|
158
165
|
${e === "Nuxt" ? `
|
|
159
166
|
- Configure Content Island in nuxt.config.ts:
|
|
160
167
|
runtimeConfig: {
|
|
@@ -169,21 +176,21 @@ ${e === "Nuxt" ? `
|
|
|
169
176
|
- Add .env to .gitignore if not present
|
|
170
177
|
- Document environment setup in README.md
|
|
171
178
|
|
|
172
|
-
### STEP
|
|
173
|
-
${
|
|
179
|
+
### STEP 8: STYLING IMPLEMENTATION
|
|
180
|
+
${n.toLowerCase().includes("tailwind") ? `
|
|
174
181
|
- Install and configure Tailwind CSS according to ${e} official documentation
|
|
175
182
|
- Create tailwind.config.js with proper content paths
|
|
176
183
|
- Add Tailwind directives to main CSS file
|
|
177
184
|
- Implement responsive design classes (sm:, md:, lg:, xl:)
|
|
178
185
|
- Use Tailwind accessibility classes for WCAG compliance
|
|
179
186
|
` : `
|
|
180
|
-
- Implement ${
|
|
187
|
+
- Implement ${n} according to ${e} best practices
|
|
181
188
|
- Create modular CSS structure
|
|
182
189
|
- Implement responsive design with media queries
|
|
183
190
|
- Ensure accessibility with proper contrast and focus states
|
|
184
191
|
`}
|
|
185
192
|
|
|
186
|
-
### STEP
|
|
193
|
+
### STEP 9: ERROR HANDLING & UX (NON-NEGOTIABLE REQUIREMENTS)
|
|
187
194
|
- Implement loading states for ALL data fetching operations
|
|
188
195
|
- Create error boundaries/components for content display failures
|
|
189
196
|
- Add try-catch blocks around ALL API calls
|
|
@@ -192,14 +199,14 @@ ${t.toLowerCase().includes("tailwind") ? `
|
|
|
192
199
|
- Show user-friendly error messages (no technical details to users)
|
|
193
200
|
- Implement 404 pages for missing content
|
|
194
201
|
|
|
195
|
-
### STEP
|
|
202
|
+
### STEP 10: PERFORMANCE OPTIMIZATION (MANDATORY)
|
|
196
203
|
- Implement lazy loading for images using framework-specific solutions
|
|
197
204
|
- Use proper code splitting for JavaScript bundles
|
|
198
205
|
- Optimize bundle sizes with tree shaking
|
|
199
206
|
- Implement appropriate caching strategies for API responses
|
|
200
207
|
- Use efficient data fetching patterns (avoid unnecessary re-renders)
|
|
201
208
|
|
|
202
|
-
### STEP
|
|
209
|
+
### STEP 11: ACCESSIBILITY & SEO (WCAG COMPLIANCE REQUIRED)
|
|
203
210
|
- Use semantic HTML elements (header, nav, main, section, article, footer)
|
|
204
211
|
- Implement proper heading hierarchy (h1, h2, h3...)
|
|
205
212
|
- Add alt attributes to ALL images
|
|
@@ -209,7 +216,7 @@ ${t.toLowerCase().includes("tailwind") ? `
|
|
|
209
216
|
- Generate proper meta tags for SEO (title, description, og tags)
|
|
210
217
|
- Implement structured data where appropriate
|
|
211
218
|
|
|
212
|
-
### STEP
|
|
219
|
+
### STEP 12: INTERNATIONALIZATION (IF APPLICABLE)
|
|
213
220
|
- If project.languages contains multiple languages:
|
|
214
221
|
* Implement language detection based on URL or user preference
|
|
215
222
|
* Create language switching functionality
|
|
@@ -217,7 +224,7 @@ ${t.toLowerCase().includes("tailwind") ? `
|
|
|
217
224
|
* Add fallbacks for unavailable translations
|
|
218
225
|
* Show appropriate messages when content not available in selected language
|
|
219
226
|
|
|
220
|
-
### STEP
|
|
227
|
+
### STEP 13: DOCUMENTATION GENERATION (COMPREHENSIVE REQUIRED)
|
|
221
228
|
- Create README.md with:
|
|
222
229
|
* Project title and description
|
|
223
230
|
* Prerequisites (Node.js version, package manager)
|
|
@@ -234,18 +241,19 @@ ${t.toLowerCase().includes("tailwind") ? `
|
|
|
234
241
|
|
|
235
242
|
1. NEVER invent Content Island API methods not documented
|
|
236
243
|
2. NEVER create example/dummy interfaces - use ONLY project structure data
|
|
237
|
-
3. NEVER proceed without calling get-content-island-project tool
|
|
244
|
+
3. NEVER proceed without executing framework CLI first and calling get-content-island-project tool second
|
|
238
245
|
4. NEVER skip installing the correct Content Island packages (${e === "Nuxt" ? "@content-island/nuxt@latest and @content-island/api-client@latest" : "@content-island/api-client@latest"})
|
|
239
246
|
5. NEVER skip error handling implementation
|
|
240
247
|
6. NEVER ignore accessibility requirements
|
|
241
248
|
7. NEVER use deprecated framework patterns
|
|
242
249
|
8. NEVER hardcode content - fetch from Content Island API
|
|
243
250
|
9. NEVER create TypeScript interfaces that don't match exact project structure
|
|
244
|
-
10. NEVER skip any of the
|
|
251
|
+
10. NEVER skip any of the 13 implementation steps
|
|
245
252
|
11. NEVER assume functionality exists without documentation
|
|
246
253
|
12. NEVER create custom API clients when official one exists
|
|
247
254
|
|
|
248
255
|
## VALIDATION CHECKLIST - VERIFY BEFORE COMPLETION:
|
|
256
|
+
□ Framework CLI executed to create base project structure
|
|
249
257
|
□ get-content-island-project tool called and data parsed
|
|
250
258
|
${e === "Nuxt" ? `
|
|
251
259
|
□ @content-island/nuxt@latest and @content-island/api-client@latest installed
|
|
@@ -258,7 +266,7 @@ ${e === "Nuxt" ? `
|
|
|
258
266
|
□ All content types have corresponding API functions using official client
|
|
259
267
|
`}
|
|
260
268
|
□ TypeScript interfaces exactly match project structure
|
|
261
|
-
□ All requested pages (${
|
|
269
|
+
□ All requested pages (${i}) are implemented
|
|
262
270
|
□ Error handling implemented for all API calls
|
|
263
271
|
□ Loading states implemented for all data fetching
|
|
264
272
|
□ Responsive design implemented
|
|
@@ -270,7 +278,7 @@ ${e === "Nuxt" ? `
|
|
|
270
278
|
|
|
271
279
|
FAILURE TO FOLLOW ANY OF THESE INSTRUCTIONS IS UNACCEPTABLE. DOUBLE-CHECK EVERY REQUIREMENT.
|
|
272
280
|
|
|
273
|
-
Let me start by getting your Content Island project details...`
|
|
281
|
+
Let me start by creating the framework project and then getting your Content Island project details...`
|
|
274
282
|
}
|
|
275
283
|
}
|
|
276
284
|
]
|
|
@@ -307,12 +315,12 @@ Please provide all this information so I can create your project.`
|
|
|
307
315
|
}, E = () => {
|
|
308
316
|
m();
|
|
309
317
|
}, f = () => {
|
|
310
|
-
|
|
311
|
-
const e = await
|
|
312
|
-
accessToken:
|
|
313
|
-
domain:
|
|
314
|
-
secureProtocol:
|
|
315
|
-
apiVersion:
|
|
318
|
+
s.tool("get-content-island-project", "Get the user's Content Island project details", async () => {
|
|
319
|
+
const e = await p({
|
|
320
|
+
accessToken: r.CONTENT_ISLAND_ACCESS_TOKEN,
|
|
321
|
+
domain: r.CONTENT_ISLAND_DOMAIN,
|
|
322
|
+
secureProtocol: r.CONTENT_ISLAND_SECURE_PROTOCOL,
|
|
323
|
+
apiVersion: r.CONTENT_ISLAND_API_VERSION
|
|
316
324
|
}).getProject();
|
|
317
325
|
return {
|
|
318
326
|
content: [{ type: "text", text: JSON.stringify(e, null, 2) }]
|
|
@@ -323,5 +331,5 @@ Please provide all this information so I can create your project.`
|
|
|
323
331
|
};
|
|
324
332
|
E();
|
|
325
333
|
I();
|
|
326
|
-
const N = new
|
|
327
|
-
await
|
|
334
|
+
const N = new d();
|
|
335
|
+
await s.connect(N);
|