@content-island/mcp 0.1.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 +144 -0
- package/cli.js +2 -0
- package/dist/index.js +327 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# @content-island/mcp
|
|
2
|
+
|
|
3
|
+
## Content Island MCP
|
|
4
|
+
|
|
5
|
+
A Model Context Protocol (MCP) server that enables seamless integration between modern web frameworks and [Content Island](https://contentisland.net/) headless CMS. This server empowers LLMs to scaffold, configure, and build web applications using frameworks like Astro, Next.js, Nuxt, and others while automatically integrating with Content Island's content management capabilities.
|
|
6
|
+
|
|
7
|
+
### Key Features
|
|
8
|
+
|
|
9
|
+
- **Modern framework support**. Scaffold projects with Astro, Next.js, Nuxt, SvelteKit, and other popular frameworks.
|
|
10
|
+
- **Headless CMS integration**. Seamlessly connect to your Content Island project, retrieve content models, and configure data fetching.
|
|
11
|
+
- **Content-driven development**. Generate components, pages, and data fetching logic based on your Content Island schema.
|
|
12
|
+
- **Type-safe integration**. Generate TypeScript types from your Content Island content models.
|
|
13
|
+
- **Zero-config setup**. Streamlined project initialization with pre-configured build tools and settings.
|
|
14
|
+
- **LLM-optimized workflow**. Purpose-built for AI-assisted development with clear, structured commands.
|
|
15
|
+
|
|
16
|
+
### Requirements
|
|
17
|
+
|
|
18
|
+
- Node.js 18 or newer
|
|
19
|
+
- VS Code, Cursor, Windsurf, Claude Desktop or any other MCP client
|
|
20
|
+
|
|
21
|
+
### Getting started
|
|
22
|
+
|
|
23
|
+
First, install the Content Island MCP server with your client. A typical configuration looks like this:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"contentIsland": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": [
|
|
31
|
+
"@content-island/mcp@latest"
|
|
32
|
+
],
|
|
33
|
+
"env": {
|
|
34
|
+
"CONTENT_ISLAND_ACCESS_TOKEN": "<YOUR_CONTENT_ISLAND_ACCESS_TOKEN>"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
> **Note**: Replace `<YOUR_CONTENT_ISLAND_ACCESS_TOKEN>` with your actual Content Island project token. You can get it from the [Content Island account](https://docs.contentisland.net/ui/project/general/).
|
|
42
|
+
|
|
43
|
+
[<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522contentIsland%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522%2540content-island%252Fmcp%2540latest%2522%255D%252C%2522env%2522%253A%2520%257B%2522CONTENT_ISLAND_ACCESS_TOKEN%2522%253A%2522%253CYOUR_CONTENT_ISLAND_ACCESS_TOKEN%253E%2522%257D%257D) [<img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522contentIsland%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522%2540content-island%252Fmcp%2540latest%2522%255D%252C%2522env%2522%253A%2520%257B%2522CONTENT_ISLAND_ACCESS_TOKEN%2522%253A%2522%253CYOUR_CONTENT_ISLAND_ACCESS_TOKEN%253E%2522%257D%257D)
|
|
44
|
+
|
|
45
|
+
<details><summary><b>Install in VS Code</b></summary>
|
|
46
|
+
|
|
47
|
+
You can also install the Content Island MCP server using the VS Code CLI:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# For VS Code
|
|
51
|
+
code --add-mcp '{"name":"contentIsland","command":"npx","args":["@content-island/mcp@latest"],"env": {"CONTENT_ISLAND_ACCESS_TOKEN":"<YOUR_CONTENT_ISLAND_ACCESS_TOKEN>"}}'
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
> **Note**: Replace `<YOUR_CONTENT_ISLAND_ACCESS_TOKEN>` with your actual Content Island project token. You can get it from the [Content Island account](https://docs.contentisland.net/ui/project/general/).
|
|
55
|
+
|
|
56
|
+
After installation, the Content Island MCP server will be available for use with your GitHub Copilot agent in VS Code.
|
|
57
|
+
|
|
58
|
+
</details>
|
|
59
|
+
|
|
60
|
+
<details>
|
|
61
|
+
<summary><b>Install in Cursor</b></summary>
|
|
62
|
+
|
|
63
|
+
#### Click the button to install:
|
|
64
|
+
|
|
65
|
+
[](https://cursor.com/install-mcp?name=contentIsland&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJAY29udGVudC1pc2xhbmQvbWNwQGxhdGVzdCJdLCJlbnYiOnsiQ09OVEVOVF9JU0xBTkRfQUNDRVNTX1RPS0VOIjoiPFlPVVJfQ09OVEVOVF9JU0xBTkRfQUNDRVNTX1RPS0VOPiJ9fQ%3D%3D)
|
|
66
|
+
|
|
67
|
+
#### Or install manually:
|
|
68
|
+
|
|
69
|
+
Go to `Cursor Settings` -> `MCP` -> `Add new MCP Server`. Name to your liking, use `command` type with the command `npx @content-island/mcp@latest`. You can also verify config or add command like arguments via clicking `Edit`.
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcpServers": {
|
|
74
|
+
"contentIsland": {
|
|
75
|
+
"command": "npx",
|
|
76
|
+
"args": ["@content-island/mcp@latest"],
|
|
77
|
+
"env": {
|
|
78
|
+
"CONTENT_ISLAND_ACCESS_TOKEN": "<YOUR_CONTENT_ISLAND_ACCESS_TOKEN>"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
> **Note**: Replace `<YOUR_CONTENT_ISLAND_ACCESS_TOKEN>` with your actual Content Island project token. You can get it from the [Content Island account](https://docs.contentisland.net/ui/project/general/).
|
|
86
|
+
|
|
87
|
+
</details>
|
|
88
|
+
|
|
89
|
+
<details>
|
|
90
|
+
<summary><b>Install in Windsurf</b></summary>
|
|
91
|
+
|
|
92
|
+
Follow Windsurf MCP [documentation](https://docs.windsurf.com/windsurf/cascade/mcp). Use following configuration:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"mcpServers": {
|
|
97
|
+
"contentIsland": {
|
|
98
|
+
"command": "npx",
|
|
99
|
+
"args": ["@content-island/mcp@latest"],
|
|
100
|
+
"env": {
|
|
101
|
+
"CONTENT_ISLAND_ACCESS_TOKEN": "<YOUR_CONTENT_ISLAND_ACCESS_TOKEN>"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
> **Note**: Replace `<YOUR_CONTENT_ISLAND_ACCESS_TOKEN>` with your actual Content Island project token. You can get it from the [Content Island account](https://docs.contentisland.net/ui/project/general/).
|
|
109
|
+
|
|
110
|
+
</details>
|
|
111
|
+
|
|
112
|
+
<details>
|
|
113
|
+
<summary><b>Install in Claude Desktop</b></summary>
|
|
114
|
+
|
|
115
|
+
Follow the MCP install [guide](https://modelcontextprotocol.io/quickstart/user), use following configuration:
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"mcpServers": {
|
|
120
|
+
"contentIsland": {
|
|
121
|
+
"command": "npx",
|
|
122
|
+
"args": ["@content-island/mcp@latest"],
|
|
123
|
+
"env": {
|
|
124
|
+
"CONTENT_ISLAND_ACCESS_TOKEN": "<YOUR_CONTENT_ISLAND_ACCESS_TOKEN>"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
> **Note**: Replace `<YOUR_CONTENT_ISLAND_ACCESS_TOKEN>` with your actual Content Island project token. You can get it from the [Content Island account](https://docs.contentisland.net/ui/project/general/).
|
|
132
|
+
|
|
133
|
+
</details>
|
|
134
|
+
|
|
135
|
+
### `Environment Variables`
|
|
136
|
+
|
|
137
|
+
You can configure the MCP server using environment variables. The following variables are available:
|
|
138
|
+
|
|
139
|
+
| name | required | description |
|
|
140
|
+
| -------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
141
|
+
| `CONTENT_ISLAND_ACCESS_TOKEN` | `true` | Your project’s `access token`.<br/>You can find this token in the [General tab](https://docs.contentisland.net/ui/project/general/). |
|
|
142
|
+
| `CONTENT_ISLAND_DOMAIN` | `false` | Domain used for requests. Useful if you're using Content Island `On Premise`.<br/>Default: `api.contentisland.net` |
|
|
143
|
+
| `CONTENT_ISLAND_SECURE_PROTOCOL` | `false` | Whether to use HTTPS for requests.<br/>Default: `true` (use HTTPS) |
|
|
144
|
+
| `CONTENT_ISLAND_API_VERSION` | `false` | Version of the [REST API](https://docs.contentisland.net/rest-api/v1/overview/).<br/>Default: `1.0` |
|
package/cli.js
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { z as n } from "zod";
|
|
2
|
+
import { McpServer as c } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { createClient as d } from "@content-island/api-client";
|
|
4
|
+
import { StdioServerTransport as p } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
const i = {
|
|
6
|
+
CONTENT_ISLAND_ACCESS_TOKEN: process.env.CONTENT_ISLAND_ACCESS_TOKEN,
|
|
7
|
+
CONTENT_ISLAND_DOMAIN: process.env.CONTENT_ISLAND_DOMAIN || void 0,
|
|
8
|
+
CONTENT_ISLAND_SECURE_PROTOCOL: process.env.CONTENT_ISLAND_SECURE_PROTOCOL !== "false",
|
|
9
|
+
CONTENT_ISLAND_API_VERSION: process.env.CONTENT_ISLAND_API_VERSION || void 0
|
|
10
|
+
}, g = "0.1.0", u = {
|
|
11
|
+
version: g
|
|
12
|
+
}, r = new c({
|
|
13
|
+
name: "Content Island",
|
|
14
|
+
version: u.version
|
|
15
|
+
}), m = () => {
|
|
16
|
+
r.prompt(
|
|
17
|
+
"create-content-island-project",
|
|
18
|
+
"Professional MCP Server prompt for creating modern frontend projects integrated with Content Island CMS",
|
|
19
|
+
{
|
|
20
|
+
framework: n.string().describe("Framework choice (Next.js, Astro, Nuxt, etc.)"),
|
|
21
|
+
pages: n.string().describe("Pages needed (Homepage, Blog, Contact, etc.)"),
|
|
22
|
+
location: n.string().describe("Project location (root directory or subfolder name)"),
|
|
23
|
+
styling: n.string().describe("Styling preference (Tailwind CSS or custom)"),
|
|
24
|
+
design: n.string().describe("Design assets (mockups, wireframes, or none)")
|
|
25
|
+
},
|
|
26
|
+
async (l) => {
|
|
27
|
+
const { framework: e, pages: o, location: s, styling: t, design: a } = l;
|
|
28
|
+
return e && o && s && t && a ? {
|
|
29
|
+
description: "Content Island project generator",
|
|
30
|
+
messages: [
|
|
31
|
+
{
|
|
32
|
+
role: "assistant",
|
|
33
|
+
content: {
|
|
34
|
+
type: "text",
|
|
35
|
+
text: `# Content Island Website Generator
|
|
36
|
+
|
|
37
|
+
I'll create a professional ${e} application integrated with your Content Island project.
|
|
38
|
+
|
|
39
|
+
**Configuration:**
|
|
40
|
+
- Framework: **${e}**
|
|
41
|
+
- Pages: ${o}
|
|
42
|
+
- Location: ${s}
|
|
43
|
+
- Styling: ${t}
|
|
44
|
+
- Design: ${a}
|
|
45
|
+
|
|
46
|
+
# CRITICAL IMPLEMENTATION INSTRUCTIONS - FOLLOW EXACTLY
|
|
47
|
+
|
|
48
|
+
You are a specialized web development assistant creating a ${e} application integrated with Content Island CMS. You MUST follow these instructions PRECISELY without any deviation or interpretation.
|
|
49
|
+
|
|
50
|
+
## MANDATORY EXECUTION SEQUENCE - NO EXCEPTIONS
|
|
51
|
+
|
|
52
|
+
### STEP 1: DATA RETRIEVAL (REQUIRED FIRST ACTION)
|
|
53
|
+
- You MUST call the 'get-content-island-project' tool as your FIRST action
|
|
54
|
+
- DO NOT proceed with ANY code generation until you have the project structure
|
|
55
|
+
- Parse the returned JSON to extract: project languages, content types, and field definitions
|
|
56
|
+
- If the tool fails, STOP and ask user to check their Content Island configuration
|
|
57
|
+
|
|
58
|
+
### STEP 2: PACKAGE INSTALLATION (MANDATORY BEFORE CODE GENERATION)
|
|
59
|
+
${e === "Nuxt" ? `
|
|
60
|
+
- FIRST install the official Content Island packages:
|
|
61
|
+
* npm install @content-island/nuxt@latest
|
|
62
|
+
* npm install @content-island/api-client@latest
|
|
63
|
+
- Add @content-island/nuxt to nuxt.config.ts modules array: modules: ['@content-island/nuxt']
|
|
64
|
+
- Use Nuxt-specific Content Island composables from @content-island/nuxt
|
|
65
|
+
- Use TypeScript types from @content-island/api-client
|
|
66
|
+
` : `
|
|
67
|
+
- FIRST install the official Content Island API client: npm install @content-island/api-client@latest
|
|
68
|
+
- Add it to package.json dependencies
|
|
69
|
+
`}
|
|
70
|
+
- NEVER create custom API implementations
|
|
71
|
+
- NEVER invent API methods that don't exist
|
|
72
|
+
|
|
73
|
+
### STEP 3: TYPESCRIPT INTERFACE GENERATION (EXACT MAPPING REQUIRED)
|
|
74
|
+
- Import Media type from '@content-island/api-client' if needed: import type { Media } from '@content-island/api-client'
|
|
75
|
+
- Generate TypeScript interfaces using EXACTLY the structure returned by the tool
|
|
76
|
+
- For EACH content type in the project data, create ONE interface
|
|
77
|
+
- Interface naming: Use exact 'name' field from content type, capitalize first letter
|
|
78
|
+
- MANDATORY fields for ALL interfaces:
|
|
79
|
+
* id: string
|
|
80
|
+
* language: union type of ALL languages from project.languages array
|
|
81
|
+
- For each field in contentType.fields array:
|
|
82
|
+
* Use field.name exactly as property name
|
|
83
|
+
* Use field.tsType for TypeScript type
|
|
84
|
+
* If field.type === "media", use Media type from '@content-island/api-client'
|
|
85
|
+
* If field.isArray === true, make property an array: field.tsType[]
|
|
86
|
+
* If field.isRequired === false, make property optional with ?
|
|
87
|
+
- For relationship fields (type contains "|"), use string[] for IDs storage
|
|
88
|
+
- EXAMPLE transformation (follow this pattern exactly):
|
|
89
|
+
Field: {"name": "title", "type": "short-text", "tsType": "string", "isArray": false, "isRequired": true}
|
|
90
|
+
Result: title: string;
|
|
91
|
+
|
|
92
|
+
### STEP 4: API CLIENT IMPLEMENTATION (DOCUMENTED METHODS ONLY)
|
|
93
|
+
${e === "Nuxt" ? `
|
|
94
|
+
- Use Nuxt Content Island composables from '@content-island/nuxt'
|
|
95
|
+
- Configure the module in nuxt.config.ts with your project settings
|
|
96
|
+
- Check Nuxt/Content Island documentation for setup: https://github.com/content-island/nuxt-content-island#readme
|
|
97
|
+
` : `
|
|
98
|
+
- Create client configuration file at: src/lib/content-island.ts (or equivalent based on framework)
|
|
99
|
+
- Consult the official Content Island documentation to implement appropriate queries:
|
|
100
|
+
* Documentation: https://docs.contentisland.net/client-api/get-content/
|
|
101
|
+
* Documentation: https://docs.contentisland.net/client-api/get-content-list/
|
|
102
|
+
- Available query parameters for both methods:
|
|
103
|
+
* id?: Filter (string or { in: string[] })
|
|
104
|
+
* contentType?: Filter (string or { in: string[] })
|
|
105
|
+
* language?: Filter (string or { in: string[] })
|
|
106
|
+
* 'fields.[fieldName]'?: Filter (for any field, e.g., 'fields.slug': 'my-post')
|
|
107
|
+
- Analyze the project structure and requested pages to determine which queries are needed
|
|
108
|
+
- Common patterns based on page types:
|
|
109
|
+
* List pages: client.getContentList<T>({ contentType: 'typename' })
|
|
110
|
+
* Detail pages: client.getContent<T>({ 'fields.slug': slug }) or client.getContent<T>({ id: 'content-id' })
|
|
111
|
+
* Multi-language: Add language filter to any query
|
|
112
|
+
* Related content: Use id: { in: string[] } for multiple items
|
|
113
|
+
- Import client: import { createClient } from '@content-island/api-client';
|
|
114
|
+
- Access token: import.meta.env.CONTENT_ISLAND_ACCESS_TOKEN
|
|
115
|
+
`}
|
|
116
|
+
- For EACH content type, analyze the requested pages and generate appropriate functions:
|
|
117
|
+
* List functions: getContentTypeList(language?: string) -> client.getContentList<ContentType>({ contentType: 'typename', ...(language && { language }) })
|
|
118
|
+
* Detail functions based on available fields:
|
|
119
|
+
- If has slug field: getContentTypeBySlug(slug: string, language?: string) -> client.getContent<ContentType>({ 'fields.slug': slug, ...(language && { language }) })
|
|
120
|
+
- By ID: getContentTypeById(id: string, language?: string) -> client.getContent<ContentType>({ id, ...(language && { language }) })
|
|
121
|
+
* Bulk functions if needed: getContentTypeByIds(ids: string[], language?: string) -> client.getContentList<ContentType>({ id: { in: ids }, ...(language && { language }) })
|
|
122
|
+
* Relationship functions: For fields that reference other content types
|
|
123
|
+
- Implement only the functions actually needed for the requested pages
|
|
124
|
+
- Always include language parameter support for multi-language projects
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### STEP 5: PROJECT STRUCTURE GENERATION (FRAMEWORK-SPECIFIC)
|
|
128
|
+
- Framework: ${e}
|
|
129
|
+
- Location: ${s}
|
|
130
|
+
- Pages requested: ${o}
|
|
131
|
+
- Styling: ${t}
|
|
132
|
+
- Design approach: ${a}
|
|
133
|
+
|
|
134
|
+
#### FRAMEWORK-SPECIFIC REQUIREMENTS:
|
|
135
|
+
${e === "Next.js" ? `
|
|
136
|
+
- Use App Router (app/ directory)
|
|
137
|
+
- Implement getStaticProps/getServerSideProps for data fetching
|
|
138
|
+
- Create proper page.tsx files for each route
|
|
139
|
+
- Use Next.js Image component for optimization
|
|
140
|
+
- Implement proper metadata for SEO
|
|
141
|
+
` : ""}
|
|
142
|
+
${e === "Astro" ? `
|
|
143
|
+
- Use .astro components with proper frontmatter
|
|
144
|
+
- Implement getStaticPaths for dynamic routes
|
|
145
|
+
- Use partial hydration with client:load directives
|
|
146
|
+
- Create Layout components for consistent structure
|
|
147
|
+
- Use Astro.glob() for content collection if needed
|
|
148
|
+
` : ""}
|
|
149
|
+
${e === "Nuxt" ? `
|
|
150
|
+
- Use Nuxt 3 composition API
|
|
151
|
+
- Implement useFetch for data fetching
|
|
152
|
+
- Create proper pages/ directory structure
|
|
153
|
+
- Use NuxtImg for image optimization
|
|
154
|
+
- Implement proper SEO with useHead
|
|
155
|
+
` : ""}
|
|
156
|
+
|
|
157
|
+
### STEP 6: ENVIRONMENT CONFIGURATION (MANDATORY FILES)
|
|
158
|
+
${e === "Nuxt" ? `
|
|
159
|
+
- Configure Content Island in nuxt.config.ts:
|
|
160
|
+
runtimeConfig: {
|
|
161
|
+
contentIsland: {
|
|
162
|
+
accessToken: process.env.CONTENT_ISLAND_ACCESS_TOKEN
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
- Create .env file with: CONTENT_ISLAND_ACCESS_TOKEN=your_token_here
|
|
166
|
+
` : `
|
|
167
|
+
- Create .env file with: CONTENT_ISLAND_ACCESS_TOKEN=your_token_here
|
|
168
|
+
`}
|
|
169
|
+
- Add .env to .gitignore if not present
|
|
170
|
+
- Document environment setup in README.md
|
|
171
|
+
|
|
172
|
+
### STEP 7: STYLING IMPLEMENTATION
|
|
173
|
+
${t.toLowerCase().includes("tailwind") ? `
|
|
174
|
+
- Install and configure Tailwind CSS according to ${e} official documentation
|
|
175
|
+
- Create tailwind.config.js with proper content paths
|
|
176
|
+
- Add Tailwind directives to main CSS file
|
|
177
|
+
- Implement responsive design classes (sm:, md:, lg:, xl:)
|
|
178
|
+
- Use Tailwind accessibility classes for WCAG compliance
|
|
179
|
+
` : `
|
|
180
|
+
- Implement ${t} according to ${e} best practices
|
|
181
|
+
- Create modular CSS structure
|
|
182
|
+
- Implement responsive design with media queries
|
|
183
|
+
- Ensure accessibility with proper contrast and focus states
|
|
184
|
+
`}
|
|
185
|
+
|
|
186
|
+
### STEP 8: ERROR HANDLING & UX (NON-NEGOTIABLE REQUIREMENTS)
|
|
187
|
+
- Implement loading states for ALL data fetching operations
|
|
188
|
+
- Create error boundaries/components for content display failures
|
|
189
|
+
- Add try-catch blocks around ALL API calls
|
|
190
|
+
- Validate API responses before rendering (check for required fields)
|
|
191
|
+
- Create fallback components for missing content
|
|
192
|
+
- Show user-friendly error messages (no technical details to users)
|
|
193
|
+
- Implement 404 pages for missing content
|
|
194
|
+
|
|
195
|
+
### STEP 9: PERFORMANCE OPTIMIZATION (MANDATORY)
|
|
196
|
+
- Implement lazy loading for images using framework-specific solutions
|
|
197
|
+
- Use proper code splitting for JavaScript bundles
|
|
198
|
+
- Optimize bundle sizes with tree shaking
|
|
199
|
+
- Implement appropriate caching strategies for API responses
|
|
200
|
+
- Use efficient data fetching patterns (avoid unnecessary re-renders)
|
|
201
|
+
|
|
202
|
+
### STEP 10: ACCESSIBILITY & SEO (WCAG COMPLIANCE REQUIRED)
|
|
203
|
+
- Use semantic HTML elements (header, nav, main, section, article, footer)
|
|
204
|
+
- Implement proper heading hierarchy (h1, h2, h3...)
|
|
205
|
+
- Add alt attributes to ALL images
|
|
206
|
+
- Ensure keyboard navigation works for ALL interactive elements
|
|
207
|
+
- Implement proper focus indicators
|
|
208
|
+
- Add ARIA labels where necessary
|
|
209
|
+
- Generate proper meta tags for SEO (title, description, og tags)
|
|
210
|
+
- Implement structured data where appropriate
|
|
211
|
+
|
|
212
|
+
### STEP 11: INTERNATIONALIZATION (IF APPLICABLE)
|
|
213
|
+
- If project.languages contains multiple languages:
|
|
214
|
+
* Implement language detection based on URL or user preference
|
|
215
|
+
* Create language switching functionality
|
|
216
|
+
* Handle URL structure for multilingual content (/en/..., /es/...)
|
|
217
|
+
* Add fallbacks for unavailable translations
|
|
218
|
+
* Show appropriate messages when content not available in selected language
|
|
219
|
+
|
|
220
|
+
### STEP 12: DOCUMENTATION GENERATION (COMPREHENSIVE REQUIRED)
|
|
221
|
+
- Create README.md with:
|
|
222
|
+
* Project title and description
|
|
223
|
+
* Prerequisites (Node.js version, package manager)
|
|
224
|
+
* Installation instructions (step-by-step)
|
|
225
|
+
* Environment setup (copying .env, getting Content Island token)
|
|
226
|
+
* Development commands (dev server, build, preview)
|
|
227
|
+
* Project structure explanation (folders, key files)
|
|
228
|
+
* Content types description (based on project structure)
|
|
229
|
+
* API functions documentation (with examples)
|
|
230
|
+
* Deployment instructions
|
|
231
|
+
* Troubleshooting section
|
|
232
|
+
|
|
233
|
+
## ABSOLUTE CONSTRAINTS - NEVER VIOLATE THESE:
|
|
234
|
+
|
|
235
|
+
1. NEVER invent Content Island API methods not documented
|
|
236
|
+
2. NEVER create example/dummy interfaces - use ONLY project structure data
|
|
237
|
+
3. NEVER proceed without calling get-content-island-project tool first
|
|
238
|
+
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
|
+
5. NEVER skip error handling implementation
|
|
240
|
+
6. NEVER ignore accessibility requirements
|
|
241
|
+
7. NEVER use deprecated framework patterns
|
|
242
|
+
8. NEVER hardcode content - fetch from Content Island API
|
|
243
|
+
9. NEVER create TypeScript interfaces that don't match exact project structure
|
|
244
|
+
10. NEVER skip any of the 12 implementation steps
|
|
245
|
+
11. NEVER assume functionality exists without documentation
|
|
246
|
+
12. NEVER create custom API clients when official one exists
|
|
247
|
+
|
|
248
|
+
## VALIDATION CHECKLIST - VERIFY BEFORE COMPLETION:
|
|
249
|
+
□ get-content-island-project tool called and data parsed
|
|
250
|
+
${e === "Nuxt" ? `
|
|
251
|
+
□ @content-island/nuxt@latest and @content-island/api-client@latest installed
|
|
252
|
+
□ @content-island/nuxt configured in nuxt.config.ts modules
|
|
253
|
+
□ Media type imported from '@content-island/api-client' when needed
|
|
254
|
+
□ All content types have corresponding functions using Nuxt composables
|
|
255
|
+
` : `
|
|
256
|
+
□ @content-island/api-client@latest installed in package.json
|
|
257
|
+
□ Media type imported from '@content-island/api-client' when needed
|
|
258
|
+
□ All content types have corresponding API functions using official client
|
|
259
|
+
`}
|
|
260
|
+
□ TypeScript interfaces exactly match project structure
|
|
261
|
+
□ All requested pages (${o}) are implemented
|
|
262
|
+
□ Error handling implemented for all API calls
|
|
263
|
+
□ Loading states implemented for all data fetching
|
|
264
|
+
□ Responsive design implemented
|
|
265
|
+
□ Accessibility features implemented
|
|
266
|
+
□ SEO meta tags implemented
|
|
267
|
+
□ Environment configuration documented
|
|
268
|
+
□ README.md with complete setup instructions
|
|
269
|
+
□ All framework-specific best practices followed
|
|
270
|
+
|
|
271
|
+
FAILURE TO FOLLOW ANY OF THESE INSTRUCTIONS IS UNACCEPTABLE. DOUBLE-CHECK EVERY REQUIREMENT.
|
|
272
|
+
|
|
273
|
+
Let me start by getting your Content Island project details...`
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
]
|
|
277
|
+
} : {
|
|
278
|
+
description: "Please answer the required questions before proceeding.",
|
|
279
|
+
messages: [
|
|
280
|
+
{
|
|
281
|
+
role: "assistant",
|
|
282
|
+
content: {
|
|
283
|
+
type: "text",
|
|
284
|
+
text: `# Content Island Website Generator
|
|
285
|
+
|
|
286
|
+
I need some information to create your Content Island website:
|
|
287
|
+
|
|
288
|
+
**Required Information:**
|
|
289
|
+
|
|
290
|
+
1. **Framework**: Which framework would you like to use? (Next.js, Astro, Nuxt, SvelteKit, etc.)
|
|
291
|
+
|
|
292
|
+
2. **Pages**: What pages do you need? (e.g., "Homepage, Blog listing, Blog detail, About, Contact")
|
|
293
|
+
|
|
294
|
+
3. **Location**: Where should I create the project? (e.g., "root directory" or "my-website" folder)
|
|
295
|
+
|
|
296
|
+
4. **Styling**: How would you like to style the application? (e.g., "Tailwind CSS", "CSS Modules", "Styled Components")
|
|
297
|
+
|
|
298
|
+
5. **Design**: Do you have design assets? (e.g., "I have wireframes", "Use best practices", "Minimal design")
|
|
299
|
+
|
|
300
|
+
Please provide all this information so I can create your project.`
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
);
|
|
307
|
+
}, E = () => {
|
|
308
|
+
m();
|
|
309
|
+
}, f = () => {
|
|
310
|
+
r.tool("get-content-island-project", "Get the user's Content Island project details", async () => {
|
|
311
|
+
const e = await d({
|
|
312
|
+
accessToken: i.CONTENT_ISLAND_ACCESS_TOKEN,
|
|
313
|
+
domain: i.CONTENT_ISLAND_DOMAIN,
|
|
314
|
+
secureProtocol: i.CONTENT_ISLAND_SECURE_PROTOCOL,
|
|
315
|
+
apiVersion: i.CONTENT_ISLAND_API_VERSION
|
|
316
|
+
}).getProject();
|
|
317
|
+
return {
|
|
318
|
+
content: [{ type: "text", text: JSON.stringify(e, null, 2) }]
|
|
319
|
+
};
|
|
320
|
+
});
|
|
321
|
+
}, I = () => {
|
|
322
|
+
f();
|
|
323
|
+
};
|
|
324
|
+
E();
|
|
325
|
+
I();
|
|
326
|
+
const N = new p();
|
|
327
|
+
await r.connect(N);
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@content-island/mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Content Island - MCP (Model Context Protocol) server",
|
|
5
|
+
"private": false,
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"author": "Lemoncode",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"files": [
|
|
10
|
+
"cli.js",
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"bin": {
|
|
14
|
+
"mcp-server-content-island": "./cli.js"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"module": "./dist/index.js",
|
|
18
|
+
"main": "./dist/index.umd.cjs",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"require": "./dist/index.umd.cjs"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"imports": {
|
|
28
|
+
"#**": "./src/*"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "vite build",
|
|
32
|
+
"debug": "npm run build && npx @modelcontextprotocol/inspector node ./dist/index",
|
|
33
|
+
"type-check": "tsc --noEmit --preserveWatchOutput"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@content-island/api-client": "^0.8.1",
|
|
37
|
+
"@modelcontextprotocol/sdk": "^1.13.3",
|
|
38
|
+
"zod": "^3.25.71"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@modelcontextprotocol/inspector": "^0.15.0"
|
|
42
|
+
}
|
|
43
|
+
}
|