@kontent-ai/mcp-server 0.7.0 → 0.8.1
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/build/server.js
CHANGED
|
@@ -7,6 +7,7 @@ import { registerTool as registerAddTaxonomyGroupMapi } from "./tools/add-taxono
|
|
|
7
7
|
import { registerTool as registerDeleteContentItemMapi } from "./tools/delete-content-item-mapi.js";
|
|
8
8
|
import { registerTool as registerDeleteLanguageVariantMapi } from "./tools/delete-language-variant-mapi.js";
|
|
9
9
|
import { registerTool as registerGetAssetMapi } from "./tools/get-asset-mapi.js";
|
|
10
|
+
import { registerTool as registerGetInitialContext } from "./tools/get-initial-context.js";
|
|
10
11
|
import { registerTool as registerGetItemDapi } from "./tools/get-item-dapi.js";
|
|
11
12
|
import { registerTool as registerGetItemMapi } from "./tools/get-item-mapi.js";
|
|
12
13
|
import { registerTool as registerGetTaxonomyGroupMapi } from "./tools/get-taxonomy-group-mapi.js";
|
|
@@ -31,6 +32,7 @@ export const createServer = () => {
|
|
|
31
32
|
},
|
|
32
33
|
});
|
|
33
34
|
// Register all tools
|
|
35
|
+
registerGetInitialContext(server);
|
|
34
36
|
registerGetItemMapi(server);
|
|
35
37
|
registerGetItemDapi(server);
|
|
36
38
|
registerGetVariantMapi(server);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export const initialContext = `
|
|
2
|
+
# Kontent.ai Platform Guide
|
|
3
|
+
|
|
4
|
+
Kontent.ai is a headless content management system (CMS) that provides two main APIs: the Management API for creating, updating, and deleting content and structure, and the Delivery API for retrieving content for applications.
|
|
5
|
+
|
|
6
|
+
## Core Entities
|
|
7
|
+
|
|
8
|
+
### Content Items
|
|
9
|
+
Content items are language-neutral content containers that serve as the foundation for your content structure. Each content item has a unique identifier and codename, and references a specific content type. The key relationship to understand is that one content item can have multiple language variants.
|
|
10
|
+
|
|
11
|
+
### Language Variants
|
|
12
|
+
Language variants contain the actual language-specific content data including field values, workflow state, and language reference. Importantly, each variant is managed independently per language.
|
|
13
|
+
|
|
14
|
+
### Content Types
|
|
15
|
+
Content types define the structure and blueprint for language variants. They specify field definitions, validation rules, and element types that language variants will use. Think of them as templates that determine what fields and data types your language variants will have.
|
|
16
|
+
|
|
17
|
+
### Content Type Snippets
|
|
18
|
+
Content type snippets are reusable field groups that promote consistency across multiple content types. Following the DRY principle (define once, use everywhere), one snippet can be used across multiple content types. This prevents duplication and ensures consistency when you need the same fields across different content types.
|
|
19
|
+
|
|
20
|
+
## Understanding Key Relationships
|
|
21
|
+
|
|
22
|
+
The content structure flows from Content Type → Content Item → Language Variant(s). For reusability, Content Type Snippets can be included in multiple Content Types. For localization, each Content Item can have one Language Variant per language.
|
|
23
|
+
|
|
24
|
+
## Working with Content Types Containing Snippets
|
|
25
|
+
|
|
26
|
+
**CRITICAL**: When creating language variants for content types with snippets, you must:
|
|
27
|
+
|
|
28
|
+
1. **Read the content type** to identify snippet elements (type: "snippet")
|
|
29
|
+
2. **Retrieve each snippet definition** to understand its internal elements
|
|
30
|
+
3. **Include ALL elements** from both the content type AND all snippets in the language variant
|
|
31
|
+
|
|
32
|
+
Example: If a content type has direct elements (title, body) and a metadata snippet (meta_title, meta_description), your language variant must include ALL four elements.
|
|
33
|
+
|
|
34
|
+
**Failure to include snippet elements will result in incomplete content creation.**
|
|
35
|
+
|
|
36
|
+
## Operational Patterns
|
|
37
|
+
|
|
38
|
+
### Content Creation Workflow
|
|
39
|
+
1. Define content types (structure) - Create the blueprint for your content
|
|
40
|
+
2. Create content items (containers) - Establish the content containers
|
|
41
|
+
3. Add language variants (actual content) - Fill in the language-specific content
|
|
42
|
+
4. Publish variants (make live) - Make content available through the Delivery API
|
|
43
|
+
|
|
44
|
+
### Content Management Workflow
|
|
45
|
+
- Update language variants with new content or changes
|
|
46
|
+
- Manage workflow states as content progresses through its lifecycle
|
|
47
|
+
- Create new language variants when expanding to additional languages
|
|
48
|
+
- Organize with taxonomies for better content categorization
|
|
49
|
+
|
|
50
|
+
## Essential Concepts
|
|
51
|
+
|
|
52
|
+
**Taxonomies** provide hierarchical content categorization, allowing you to organize and tag content systematically.
|
|
53
|
+
|
|
54
|
+
**Assets** are digital files including images, videos, and documents that can be referenced throughout your content.
|
|
55
|
+
|
|
56
|
+
**Workflow states** manage the content lifecycle, tracking whether content is being drafted, is live, or has been archived.
|
|
57
|
+
|
|
58
|
+
**Codenames** are human-readable unique identifiers that provide a consistent way to reference content programmatically.
|
|
59
|
+
|
|
60
|
+
## Best Practices
|
|
61
|
+
|
|
62
|
+
Use snippets for common field groups to maintain consistency and avoid duplication. Plan your content types before creating content to ensure proper structure. Use meaningful codenames consistently throughout your project for better maintainability. Leverage taxonomies for organization to create logical content hierarchies. Consider your multilingual strategy early in the planning process to avoid restructuring later.
|
|
63
|
+
|
|
64
|
+
When working with snippets, always retrieve and understand the complete element structure before creating content variants.`;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
1
|
import { createMcpToolSuccessResponse } from "../utils/responseHelper.js";
|
|
5
|
-
|
|
6
|
-
const __dirname = dirname(__filename);
|
|
2
|
+
import { initialContext } from "./context/initial-context.js";
|
|
7
3
|
export const registerTool = (server) => {
|
|
8
4
|
server.tool("get-initial-context", "🚨 MANDATORY FIRST STEP: This tool MUST be called before using ANY other tools. It provides essential context, configuration, and operational guidelines for Kontent.ai. If you have not called this tool, do so immediately before proceeding with any other operation.", {}, async () => {
|
|
9
5
|
try {
|
|
10
|
-
|
|
11
|
-
const kontentaiInstructions = await readFile(markdownPath, "utf-8");
|
|
12
|
-
return createMcpToolSuccessResponse(kontentaiInstructions);
|
|
6
|
+
return createMcpToolSuccessResponse(initialContext);
|
|
13
7
|
}
|
|
14
8
|
catch (error) {
|
|
15
9
|
throw new Error(`Failed to read initial context: ${error instanceof Error ? error.message : "Unknown error"}`);
|