@kontent-ai/mcp-server 0.31.0 → 0.33.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 +57 -61
- package/build/schemas/bulkGetItemsWithVariantsSchemas.js +1 -1
- package/build/schemas/contentItemSchemas.js +1 -1
- package/build/schemas/filterVariantSchemas.js +8 -3
- package/build/schemas/searchOperationSchemas.js +2 -1
- package/build/server.js +4 -112
- package/build/test/bm25/bm25.js +47 -0
- package/build/test/bm25/toolSearchBm25.spec.js +874 -0
- package/build/tools/bulk-get-content-item-variants.js +31 -0
- package/build/tools/change-content-item-variant-workflow-step.js +35 -0
- package/build/tools/create-content-item-variant.js +44 -0
- package/build/tools/create-content-item.js +47 -0
- package/build/tools/create-content-type-snippet.js +34 -0
- package/build/tools/create-content-type.js +37 -0
- package/build/tools/create-language.js +24 -0
- package/build/tools/create-new-content-item-variant-version.js +27 -0
- package/build/tools/create-space.js +22 -0
- package/build/tools/create-taxonomy-group.js +18 -0
- package/build/tools/create-workflow.js +23 -0
- package/build/tools/delete-content-item-variant.js +25 -0
- package/build/tools/delete-content-item.js +23 -0
- package/build/tools/delete-content-type-snippet.js +19 -0
- package/build/tools/delete-content-type.js +23 -0
- package/build/tools/delete-space.js +19 -0
- package/build/tools/delete-taxonomy-group.js +19 -0
- package/build/tools/delete-workflow.js +19 -0
- package/build/tools/get-asset.js +17 -0
- package/build/tools/get-content-item-translations.js +20 -0
- package/build/tools/get-content-item-variant.js +22 -0
- package/build/tools/get-content-item.js +17 -0
- package/build/tools/get-content-type-snippet.js +20 -0
- package/build/tools/get-content-type.js +17 -0
- package/build/tools/get-patch-guide.js +12 -12
- package/build/tools/get-published-content-item-variant-version.js +23 -0
- package/build/tools/get-taxonomy-group.js +17 -0
- package/build/tools/index.js +106 -0
- package/build/tools/list-asset-folders.js +14 -0
- package/build/tools/list-assets.js +23 -0
- package/build/tools/list-collections.js +14 -0
- package/build/tools/list-content-item-variants.js +50 -0
- package/build/tools/list-content-type-snippets.js +23 -0
- package/build/tools/list-content-types.js +23 -0
- package/build/tools/list-languages.js +24 -0
- package/build/tools/list-roles.js +14 -0
- package/build/tools/list-spaces.js +14 -0
- package/build/tools/list-taxonomy-groups.js +23 -0
- package/build/tools/list-workflows.js +14 -0
- package/build/tools/patch-asset-folders.js +25 -0
- package/build/tools/patch-collections.js +25 -0
- package/build/tools/patch-content-type-snippet.js +30 -0
- package/build/tools/patch-content-type.js +33 -0
- package/build/tools/patch-language.js +24 -0
- package/build/tools/patch-space.js +28 -0
- package/build/tools/patch-taxonomy-group.js +28 -0
- package/build/tools/publish-content-item-variant.js +72 -0
- package/build/tools/referencedToolNames.js +10 -0
- package/build/tools/search-content-item-variants.js +108 -0
- package/build/tools/toolDefinition.js +1 -0
- package/build/tools/unpublish-content-item-variant.js +72 -0
- package/build/tools/update-asset.js +23 -0
- package/build/tools/update-content-item-variant.js +36 -0
- package/build/tools/update-content-item.js +74 -0
- package/build/tools/update-workflow.js +31 -0
- package/package.json +18 -17
- package/build/tools/add-content-item-mapi.js +0 -47
- package/build/tools/add-content-type-mapi.js +0 -38
- package/build/tools/add-content-type-snippet-mapi.js +0 -35
- package/build/tools/add-language-mapi.js +0 -25
- package/build/tools/add-space-mapi.js +0 -23
- package/build/tools/add-taxonomy-group-mapi.js +0 -19
- package/build/tools/add-workflow-mapi.js +0 -24
- package/build/tools/bulk-get-items-variants-mapi.js +0 -31
- package/build/tools/change-variant-workflow-step-mapi.js +0 -36
- package/build/tools/create-language-variant-mapi.js +0 -44
- package/build/tools/create-variant-version-mapi.js +0 -28
- package/build/tools/delete-content-item-mapi.js +0 -24
- package/build/tools/delete-content-type-mapi.js +0 -24
- package/build/tools/delete-language-variant-mapi.js +0 -26
- package/build/tools/delete-space-mapi.js +0 -20
- package/build/tools/delete-taxonomy-group-mapi.js +0 -20
- package/build/tools/delete-type-snippet-mapi.js +0 -23
- package/build/tools/delete-workflow-mapi.js +0 -20
- package/build/tools/filter-variants-mapi.js +0 -49
- package/build/tools/get-asset-mapi.js +0 -21
- package/build/tools/get-item-mapi.js +0 -21
- package/build/tools/get-latest-variant-mapi.js +0 -23
- package/build/tools/get-published-variant-mapi.js +0 -24
- package/build/tools/get-taxonomy-group-mapi.js +0 -21
- package/build/tools/get-type-mapi.js +0 -21
- package/build/tools/get-type-snippet-mapi.js +0 -21
- package/build/tools/list-asset-folders-mapi.js +0 -15
- package/build/tools/list-assets-mapi.js +0 -24
- package/build/tools/list-collections-mapi.js +0 -15
- package/build/tools/list-content-type-snippets-mapi.js +0 -24
- package/build/tools/list-content-types-mapi.js +0 -24
- package/build/tools/list-languages-mapi.js +0 -24
- package/build/tools/list-roles-mapi.js +0 -15
- package/build/tools/list-spaces-mapi.js +0 -15
- package/build/tools/list-taxonomy-groups-mapi.js +0 -24
- package/build/tools/list-variants-collection-mapi.js +0 -26
- package/build/tools/list-variants-components-type-mapi.js +0 -26
- package/build/tools/list-variants-item-mapi.js +0 -21
- package/build/tools/list-variants-space-mapi.js +0 -24
- package/build/tools/list-variants-type-mapi.js +0 -26
- package/build/tools/list-workflows-mapi.js +0 -15
- package/build/tools/patch-asset-folders-mapi.js +0 -25
- package/build/tools/patch-collections-mapi.js +0 -25
- package/build/tools/patch-content-type-mapi.js +0 -33
- package/build/tools/patch-language-mapi.js +0 -24
- package/build/tools/patch-space-mapi.js +0 -28
- package/build/tools/patch-taxonomy-group-mapi.js +0 -28
- package/build/tools/patch-type-snippet-mapi.js +0 -30
- package/build/tools/publish-variant-mapi.js +0 -73
- package/build/tools/search-variants-mapi.js +0 -108
- package/build/tools/unpublish-variant-mapi.js +0 -73
- package/build/tools/update-asset-mapi.js +0 -24
- package/build/tools/update-content-item-mapi.js +0 -74
- package/build/tools/update-language-variant-mapi.js +0 -37
- package/build/tools/update-workflow-mapi.js +0 -32
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Before you can use the MCP server, you need:
|
|
|
39
39
|
|
|
40
40
|
1. **A Kontent.ai account** - [Sign up](https://kontent.ai/signup) if you don't have an account.
|
|
41
41
|
1. **A project** - [Create a project](https://kontent.ai/learn/docs/projects#a-create-projects) to work with.
|
|
42
|
-
1. **Management API key** - [Create a
|
|
42
|
+
1. **Management API key** - [Create a key](https://kontent.ai/learn/docs/apis/api-keys#a-create-management-api-keys) with appropriate permissions.
|
|
43
43
|
1. **Environment ID** - [Get your environment ID](https://kontent.ai/learn/docs/environments#a-get-your-environment-id).
|
|
44
44
|
|
|
45
45
|
### 🛠 Setup Options
|
|
@@ -62,95 +62,91 @@ npx @kontent-ai/mcp-server@latest shttp
|
|
|
62
62
|
|
|
63
63
|
### Patch Operations Guide
|
|
64
64
|
|
|
65
|
-
* **get-patch-guide** – 🚨 **REQUIRED before any patch operation**. Get patch operations guide for Kontent.ai
|
|
65
|
+
* **get-patch-guide** – 🚨 **REQUIRED before any patch operation**. Get patch operations guide for Kontent.ai by entity type
|
|
66
66
|
|
|
67
67
|
### Content Type Management
|
|
68
68
|
|
|
69
|
-
* **get-type
|
|
70
|
-
* **list-content-types
|
|
71
|
-
* **
|
|
72
|
-
* **patch-content-type
|
|
73
|
-
* **delete-content-type
|
|
69
|
+
* **get-content-type** – Get Kontent.ai content type by ID
|
|
70
|
+
* **list-content-types** – Get all Kontent.ai content types
|
|
71
|
+
* **create-content-type** – Create new Kontent.ai content type
|
|
72
|
+
* **patch-content-type** – Update an existing Kontent.ai content type by codename using patch operations (move, addInto, remove, replace)
|
|
73
|
+
* **delete-content-type** – Delete a Kontent.ai content type by ID
|
|
74
74
|
|
|
75
75
|
### Content Type Snippet Management
|
|
76
76
|
|
|
77
|
-
* **get-type-snippet
|
|
78
|
-
* **list-content-type-snippets
|
|
79
|
-
* **
|
|
80
|
-
* **patch-type-snippet
|
|
81
|
-
* **delete-type-snippet
|
|
77
|
+
* **get-content-type-snippet** – Get Kontent.ai content type snippet by ID
|
|
78
|
+
* **list-content-type-snippets** – Get all Kontent.ai content type snippets
|
|
79
|
+
* **create-content-type-snippet** – Create new Kontent.ai content type snippet
|
|
80
|
+
* **patch-content-type-snippet** – Update an existing Kontent.ai content type snippet by ID using patch operations (move, addInto, remove, replace)
|
|
81
|
+
* **delete-content-type-snippet** – Delete a Kontent.ai content type snippet by ID
|
|
82
82
|
|
|
83
83
|
### Taxonomy Management
|
|
84
84
|
|
|
85
|
-
* **get-taxonomy-group
|
|
86
|
-
* **list-taxonomy-groups
|
|
87
|
-
* **
|
|
88
|
-
* **patch-taxonomy-group
|
|
89
|
-
* **delete-taxonomy-group
|
|
85
|
+
* **get-taxonomy-group** – Get Kontent.ai taxonomy group by ID
|
|
86
|
+
* **list-taxonomy-groups** – Get all Kontent.ai taxonomy groups
|
|
87
|
+
* **create-taxonomy-group** – Create new Kontent.ai taxonomy group
|
|
88
|
+
* **patch-taxonomy-group** – Update Kontent.ai taxonomy group using patch operations (addInto, move, remove, replace)
|
|
89
|
+
* **delete-taxonomy-group** – Delete Kontent.ai taxonomy group by ID
|
|
90
90
|
|
|
91
91
|
### Content Item Management
|
|
92
92
|
|
|
93
|
-
* **get-item
|
|
94
|
-
* **get-
|
|
95
|
-
* **get-published-variant-
|
|
96
|
-
* **
|
|
97
|
-
* **list-
|
|
98
|
-
* **
|
|
99
|
-
* **
|
|
100
|
-
* **
|
|
101
|
-
* **
|
|
102
|
-
* **update-content-item-
|
|
103
|
-
* **
|
|
104
|
-
* **
|
|
105
|
-
* **
|
|
106
|
-
* **
|
|
107
|
-
* **delete-language-variant-mapi** – Delete Kontent.ai language variant from Management API
|
|
108
|
-
* **filter-variants-mapi** – Filter Kontent.ai items with variants returning references (item ID + language ID). Use for exact keyword matching and finding specific terms in content. Supports full filtering capabilities (content types, workflow steps, taxonomies, spaces, collections, publishing states, etc.). Returns paginated results with continuation token for fetching subsequent pages. Use bulk-get-items-variants-mapi to retrieve full content for matched items
|
|
109
|
-
* **bulk-get-items-variants-mapi** – Bulk get Kontent.ai content items with their language variants by item and language reference pairs. Use after filter-variants-mapi to retrieve full content data for specific item+language pairs. Items without a variant in the requested language return the item without the variant property. Returns paginated results with continuation token
|
|
110
|
-
* **search-variants-mapi** – AI-powered semantic search for finding content by meaning and concepts in a specific language variant. Use for: conceptual searches when you don't know exact keywords. Limited filtering options (variant ID only)
|
|
93
|
+
* **get-content-item** – Get Kontent.ai content item by ID
|
|
94
|
+
* **get-content-item-variant** – Retrieve Kontent.ai content item variant (language version/translation). Returns the current version — draft if one exists, otherwise published
|
|
95
|
+
* **get-published-content-item-variant-version** – Retrieve the published version of a Kontent.ai content item variant. Use when a newer draft version exists but you need the currently published (live) content
|
|
96
|
+
* **get-content-item-translations** – Get all Kontent.ai content item translations — every language version (variant) of a specific content item
|
|
97
|
+
* **list-content-item-variants** – List, filter, search Kontent.ai content items with content item variants (language versions/translations)
|
|
98
|
+
* **create-content-item** – Create new Kontent.ai content item (creates the container only, use create-content-item-variant to add language versions/translations)
|
|
99
|
+
* **update-content-item** – Update existing Kontent.ai content item by ID. The content item must already exist - this tool will not create new items
|
|
100
|
+
* **delete-content-item** – Delete Kontent.ai content item by ID
|
|
101
|
+
* **create-content-item-variant** – Create Kontent.ai content item variant assigning current user as contributor. Element values must fulfill limitations and guidelines defined in content type
|
|
102
|
+
* **update-content-item-variant** – Update Kontent.ai content item variant of a content item. Element values must fulfill limitations and guidelines defined in content type. Only provided elements will be modified
|
|
103
|
+
* **create-new-content-item-variant-version** – Create new version of Kontent.ai content item variant. This operation creates a new version of an existing content item variant, useful for content versioning and creating new drafts from published content
|
|
104
|
+
* **delete-content-item-variant** – Delete Kontent.ai content item variant
|
|
105
|
+
* **bulk-get-content-item-variants** – Bulk get Kontent.ai content items with their content item variants by item and language reference pairs. Use after list-content-item-variants to retrieve full content data for specific item+language pairs. Items without a variant in the requested language return the item without the variant property. Returns paginated results with continuation token
|
|
106
|
+
* **search-content-item-variants** – AI-powered semantic search for finding content by meaning and concepts in a specific content item variant. Use for: conceptual searches when you don't know exact keywords. Limited filtering options (variant ID only)
|
|
111
107
|
|
|
112
108
|
### Asset Management
|
|
113
109
|
|
|
114
|
-
* **get-asset
|
|
115
|
-
* **list-assets
|
|
116
|
-
* **update-asset
|
|
110
|
+
* **get-asset** – Get a specific Kontent.ai asset by ID
|
|
111
|
+
* **list-assets** – Get all Kontent.ai assets
|
|
112
|
+
* **update-asset** – Update Kontent.ai asset by ID
|
|
117
113
|
|
|
118
114
|
### Asset Folder Management
|
|
119
115
|
|
|
120
|
-
* **list-asset-folders
|
|
121
|
-
* **patch-asset-folders
|
|
116
|
+
* **list-asset-folders** – List all Kontent.ai asset folders
|
|
117
|
+
* **patch-asset-folders** – Modify Kontent.ai asset folders using patch operations (addInto to add new folders, rename to change names, remove to delete folders)
|
|
122
118
|
|
|
123
119
|
### Language Management
|
|
124
120
|
|
|
125
|
-
* **list-languages
|
|
126
|
-
* **
|
|
127
|
-
* **patch-language
|
|
121
|
+
* **list-languages** – Get all Kontent.ai languages (includes both active and inactive - check is_active property)
|
|
122
|
+
* **create-language** – Create new Kontent.ai language (languages are always created as active)
|
|
123
|
+
* **patch-language** – Update Kontent.ai language using replace operations (only active languages can be modified - to activate/deactivate, use the Kontent.ai web UI)
|
|
128
124
|
|
|
129
125
|
### Collection Management
|
|
130
126
|
|
|
131
|
-
* **list-collections
|
|
132
|
-
* **patch-collections
|
|
127
|
+
* **list-collections** – Get all Kontent.ai collections. Collections set boundaries for content items in your environment and help organize content by team, brand, or project
|
|
128
|
+
* **patch-collections** – Update Kontent.ai collections using patch operations (addInto to add new collections, move to reorder, remove to delete empty collections, replace to rename)
|
|
133
129
|
|
|
134
130
|
### Space Management
|
|
135
131
|
|
|
136
|
-
* **list-spaces
|
|
137
|
-
* **
|
|
138
|
-
* **patch-space
|
|
139
|
-
* **delete-space
|
|
132
|
+
* **list-spaces** – Get all Kontent.ai spaces
|
|
133
|
+
* **create-space** – Create new Kontent.ai space for managing a website or channel
|
|
134
|
+
* **patch-space** – Patch Kontent.ai space using replace operations
|
|
135
|
+
* **delete-space** – Delete Kontent.ai space
|
|
140
136
|
|
|
141
137
|
### Role Management
|
|
142
138
|
|
|
143
|
-
* **list-roles
|
|
139
|
+
* **list-roles** – Get all Kontent.ai roles. Requires Enterprise or Flex plan with "Manage custom roles" permission
|
|
144
140
|
|
|
145
141
|
### Workflow Management
|
|
146
142
|
|
|
147
|
-
* **list-workflows
|
|
148
|
-
* **
|
|
149
|
-
* **update-workflow
|
|
150
|
-
* **delete-workflow
|
|
151
|
-
* **change-variant-workflow-step
|
|
152
|
-
* **publish-variant
|
|
153
|
-
* **unpublish-variant
|
|
143
|
+
* **list-workflows** – Get all Kontent.ai workflows. Workflows define the content lifecycle stages and transitions between them
|
|
144
|
+
* **create-workflow** – Create new Kontent.ai workflow with custom steps, transitions, scopes, and role permissions
|
|
145
|
+
* **update-workflow** – Update an existing Kontent.ai workflow by ID. Modify steps, transitions, scopes, and role permissions. Cannot remove steps that are in use
|
|
146
|
+
* **delete-workflow** – Delete a Kontent.ai workflow by ID. The workflow must not be in use by any content items
|
|
147
|
+
* **change-content-item-variant-workflow-step** – Change the workflow step of a content item variant in Kontent.ai. This operation moves a content item variant to a different step in the workflow, enabling content lifecycle management such as moving content from draft to review, review to published, etc.
|
|
148
|
+
* **publish-content-item-variant** – Publish or schedule a content item variant of a content item in Kontent.ai. This operation can either immediately publish the variant or schedule it for publication at a specific future date and time with optional timezone specification
|
|
149
|
+
* **unpublish-content-item-variant** – Unpublish or schedule unpublishing of a content item variant of a content item in Kontent.ai. This operation can either immediately unpublish the variant (making it unavailable through the Delivery API) or schedule it for unpublishing at a specific future date and time with optional timezone specification
|
|
154
150
|
|
|
155
151
|
## ⚙️ Configuration
|
|
156
152
|
|
|
@@ -167,11 +163,11 @@ Configure credentials via environment variables:
|
|
|
167
163
|
|
|
168
164
|
| Variable | Description | Required |
|
|
169
165
|
|----------|-------------|----------|
|
|
170
|
-
| KONTENT_API_KEY | Your Kontent.ai
|
|
166
|
+
| KONTENT_API_KEY | Your Kontent.ai key | ✅ |
|
|
171
167
|
| KONTENT_ENVIRONMENT_ID | Your environment ID | ✅ |
|
|
172
168
|
| appInsightsConnectionString | Application Insights connection string for telemetry | ❌ |
|
|
173
169
|
| projectLocation | Project location identifier for telemetry tracking | ❌ |
|
|
174
|
-
| manageApiUrl | Custom
|
|
170
|
+
| manageApiUrl | Custom base URL (for preview environments) | ❌ |
|
|
175
171
|
|
|
176
172
|
### Multi-Tenant Mode (Streamable HTTP)
|
|
177
173
|
|
|
@@ -186,7 +182,7 @@ This allows a single server instance to handle requests for multiple Kontent.ai
|
|
|
186
182
|
| PORT | Port for HTTP transport (defaults to 3001) | ❌ |
|
|
187
183
|
| appInsightsConnectionString | Application Insights connection string for telemetry | ❌ |
|
|
188
184
|
| projectLocation | Project location identifier for telemetry tracking | ❌ |
|
|
189
|
-
| manageApiUrl | Custom
|
|
185
|
+
| manageApiUrl | Custom base URL (for preview environments) | ❌ |
|
|
190
186
|
|
|
191
187
|
## 🚀 Transport Options
|
|
192
188
|
|
|
@@ -308,7 +304,7 @@ claude mcp add --transport http kontent-ai-multi \
|
|
|
308
304
|
</details>
|
|
309
305
|
|
|
310
306
|
> [!IMPORTANT]
|
|
311
|
-
> Replace `<environment-id>` with your Kontent.ai environment ID (GUID) and `<management-api-key>` with your
|
|
307
|
+
> Replace `<environment-id>` with your Kontent.ai environment ID (GUID) and `<management-api-key>` with your key.
|
|
312
308
|
|
|
313
309
|
## 💻 Development
|
|
314
310
|
|
|
@@ -9,6 +9,6 @@ export const bulkGetItemsWithVariantsSchema = z.object({
|
|
|
9
9
|
}))
|
|
10
10
|
.min(1)
|
|
11
11
|
.max(100)
|
|
12
|
-
.describe(
|
|
12
|
+
.describe(`Array of item and language reference pairs to retrieve (max 100).`),
|
|
13
13
|
continuation_token: continuationTokenField,
|
|
14
14
|
});
|
|
@@ -116,7 +116,7 @@ const richTextInVariantElementSchema = z
|
|
|
116
116
|
const elementInComponentSchema = z
|
|
117
117
|
.lazy(() => languageVariantElementSchema)
|
|
118
118
|
.describe("Element value within a component - same structure as top-level variant elements.");
|
|
119
|
-
// Top-level
|
|
119
|
+
// Top-level item variant element schema - discriminated by unique fields
|
|
120
120
|
export const languageVariantElementSchema = z.union([
|
|
121
121
|
// Most specific schemas first (with unique distinguishing fields)
|
|
122
122
|
urlSlugInVariantElementSchema, // has unique required 'mode' field
|
|
@@ -19,7 +19,7 @@ export const filterVariantsSchema = z.object({
|
|
|
19
19
|
search_phrase: z
|
|
20
20
|
.string()
|
|
21
21
|
.optional()
|
|
22
|
-
.describe("
|
|
22
|
+
.describe("Specific phrase or keywords to look for in content"),
|
|
23
23
|
content_types: z
|
|
24
24
|
.array(referenceObjectSchema)
|
|
25
25
|
.min(1)
|
|
@@ -33,7 +33,7 @@ export const filterVariantsSchema = z.object({
|
|
|
33
33
|
has_no_contributors: z
|
|
34
34
|
.boolean()
|
|
35
35
|
.optional()
|
|
36
|
-
.describe("Filter for content item
|
|
36
|
+
.describe("Filter for content item variants that have no contributors assigned"),
|
|
37
37
|
completion_statuses: z
|
|
38
38
|
.array(z.enum(["unfinished", "ready", "not_translated", "all_done"]))
|
|
39
39
|
.min(1)
|
|
@@ -63,7 +63,7 @@ export const filterVariantsSchema = z.object({
|
|
|
63
63
|
include_uncategorized: z
|
|
64
64
|
.boolean()
|
|
65
65
|
.optional()
|
|
66
|
-
.describe("Whether to include content item
|
|
66
|
+
.describe("Whether to include content item variants that don't have any taxonomy terms assigned in this taxonomy group"),
|
|
67
67
|
}))
|
|
68
68
|
.min(1)
|
|
69
69
|
.optional()
|
|
@@ -78,6 +78,11 @@ export const filterVariantsSchema = z.object({
|
|
|
78
78
|
.min(1)
|
|
79
79
|
.optional()
|
|
80
80
|
.describe("Array of references to collections by their id, codename, or external id"),
|
|
81
|
+
component_types: z
|
|
82
|
+
.array(referenceObjectSchema)
|
|
83
|
+
.min(1)
|
|
84
|
+
.optional()
|
|
85
|
+
.describe("Array of references to content component types stored in variants by their type id, codename, or external id"),
|
|
81
86
|
publishing_states: z
|
|
82
87
|
.array(z.enum(["published", "unpublished", "not_published_yet"]))
|
|
83
88
|
.min(1)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { listLanguagesToolName } from "../tools/referencedToolNames.js";
|
|
2
3
|
export const searchOperationSchema = z.object({
|
|
3
4
|
searchPhrase: z
|
|
4
5
|
.string()
|
|
@@ -6,6 +7,6 @@ export const searchOperationSchema = z.object({
|
|
|
6
7
|
filter: z.object({
|
|
7
8
|
variantId: z
|
|
8
9
|
.guid()
|
|
9
|
-
.describe(
|
|
10
|
+
.describe(`Language ID from ${listLanguagesToolName}. Use default language (is_default=true) if not specified by user.`),
|
|
10
11
|
}),
|
|
11
12
|
});
|
package/build/server.js
CHANGED
|
@@ -1,61 +1,6 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import packageJson from "../package.json" with { type: "json" };
|
|
3
|
-
import {
|
|
4
|
-
import { registerTool as registerAddContentTypeMapi } from "./tools/add-content-type-mapi.js";
|
|
5
|
-
import { registerTool as registerAddContentTypeSnippetMapi } from "./tools/add-content-type-snippet-mapi.js";
|
|
6
|
-
import { registerTool as registerAddLanguageMapi } from "./tools/add-language-mapi.js";
|
|
7
|
-
import { registerTool as registerAddSpaceMapi } from "./tools/add-space-mapi.js";
|
|
8
|
-
import { registerTool as registerAddTaxonomyGroupMapi } from "./tools/add-taxonomy-group-mapi.js";
|
|
9
|
-
import { registerTool as registerAddWorkflowMapi } from "./tools/add-workflow-mapi.js";
|
|
10
|
-
import { registerTool as registerBulkGetItemsVariantsMapi } from "./tools/bulk-get-items-variants-mapi.js";
|
|
11
|
-
import { registerTool as registerChangeVariantWorkflowStepMapi } from "./tools/change-variant-workflow-step-mapi.js";
|
|
12
|
-
import { registerTool as registerCreateLanguageVariantMapi } from "./tools/create-language-variant-mapi.js";
|
|
13
|
-
import { registerTool as registerCreateVariantVersionMapi } from "./tools/create-variant-version-mapi.js";
|
|
14
|
-
import { registerTool as registerDeleteContentItemMapi } from "./tools/delete-content-item-mapi.js";
|
|
15
|
-
import { registerTool as registerDeleteContentTypeMapi } from "./tools/delete-content-type-mapi.js";
|
|
16
|
-
import { registerTool as registerDeleteLanguageVariantMapi } from "./tools/delete-language-variant-mapi.js";
|
|
17
|
-
import { registerTool as registerDeleteSpaceMapi } from "./tools/delete-space-mapi.js";
|
|
18
|
-
import { registerTool as registerDeleteTaxonomyGroupMapi } from "./tools/delete-taxonomy-group-mapi.js";
|
|
19
|
-
import { registerTool as registerDeleteTypeSnippetMapi } from "./tools/delete-type-snippet-mapi.js";
|
|
20
|
-
import { registerTool as registerDeleteWorkflowMapi } from "./tools/delete-workflow-mapi.js";
|
|
21
|
-
import { registerTool as registerFilterVariantsMapi } from "./tools/filter-variants-mapi.js";
|
|
22
|
-
import { registerTool as registerGetAssetMapi } from "./tools/get-asset-mapi.js";
|
|
23
|
-
import { registerTool as registerGetItemMapi } from "./tools/get-item-mapi.js";
|
|
24
|
-
import { registerTool as registerGetLatestVariantMapi } from "./tools/get-latest-variant-mapi.js";
|
|
25
|
-
import { registerTool as registerGetPatchGuide } from "./tools/get-patch-guide.js";
|
|
26
|
-
import { registerTool as registerGetPublishedVariantMapi } from "./tools/get-published-variant-mapi.js";
|
|
27
|
-
import { registerTool as registerGetTaxonomyGroupMapi } from "./tools/get-taxonomy-group-mapi.js";
|
|
28
|
-
import { registerTool as registerGetTypeMapi } from "./tools/get-type-mapi.js";
|
|
29
|
-
import { registerTool as registerGetTypeSnippetMapi } from "./tools/get-type-snippet-mapi.js";
|
|
30
|
-
import { registerTool as registerListAssetFoldersMapi } from "./tools/list-asset-folders-mapi.js";
|
|
31
|
-
import { registerTool as registerListAssetsMapi } from "./tools/list-assets-mapi.js";
|
|
32
|
-
import { registerTool as registerListCollectionsMapi } from "./tools/list-collections-mapi.js";
|
|
33
|
-
import { registerTool as registerListContentTypeSnippetsMapi } from "./tools/list-content-type-snippets-mapi.js";
|
|
34
|
-
import { registerTool as registerListContentTypesMapi } from "./tools/list-content-types-mapi.js";
|
|
35
|
-
import { registerTool as registerListLanguagesMapi } from "./tools/list-languages-mapi.js";
|
|
36
|
-
import { registerTool as registerListRolesMapi } from "./tools/list-roles-mapi.js";
|
|
37
|
-
import { registerTool as registerListSpacesMapi } from "./tools/list-spaces-mapi.js";
|
|
38
|
-
import { registerTool as registerListTaxonomyGroupsMapi } from "./tools/list-taxonomy-groups-mapi.js";
|
|
39
|
-
import { registerTool as registerListVariantsCollectionMapi } from "./tools/list-variants-collection-mapi.js";
|
|
40
|
-
import { registerTool as registerListVariantsComponentsTypeMapi } from "./tools/list-variants-components-type-mapi.js";
|
|
41
|
-
import { registerTool as registerListVariantsItemMapi } from "./tools/list-variants-item-mapi.js";
|
|
42
|
-
import { registerTool as registerListVariantsSpaceMapi } from "./tools/list-variants-space-mapi.js";
|
|
43
|
-
import { registerTool as registerListVariantsTypeMapi } from "./tools/list-variants-type-mapi.js";
|
|
44
|
-
import { registerTool as registerListWorkflowsMapi } from "./tools/list-workflows-mapi.js";
|
|
45
|
-
import { registerTool as registerPatchAssetFoldersMapi } from "./tools/patch-asset-folders-mapi.js";
|
|
46
|
-
import { registerTool as registerPatchCollectionsMapi } from "./tools/patch-collections-mapi.js";
|
|
47
|
-
import { registerTool as registerPatchContentTypeMapi } from "./tools/patch-content-type-mapi.js";
|
|
48
|
-
import { registerTool as registerPatchLanguageMapi } from "./tools/patch-language-mapi.js";
|
|
49
|
-
import { registerTool as registerPatchSpaceMapi } from "./tools/patch-space-mapi.js";
|
|
50
|
-
import { registerTool as registerPatchTaxonomyGroupMapi } from "./tools/patch-taxonomy-group-mapi.js";
|
|
51
|
-
import { registerTool as registerPatchTypeSnippetMapi } from "./tools/patch-type-snippet-mapi.js";
|
|
52
|
-
import { registerTool as registerPublishVariantMapi } from "./tools/publish-variant-mapi.js";
|
|
53
|
-
import { registerTool as registerSearchVariantsMapi } from "./tools/search-variants-mapi.js";
|
|
54
|
-
import { registerTool as registerUnpublishVariantMapi } from "./tools/unpublish-variant-mapi.js";
|
|
55
|
-
import { registerTool as registerUpdateAssetMapi } from "./tools/update-asset-mapi.js";
|
|
56
|
-
import { registerTool as registerUpdateContentItemMapi } from "./tools/update-content-item-mapi.js";
|
|
57
|
-
import { registerTool as registerUpdateLanguageVariantMapi } from "./tools/update-language-variant-mapi.js";
|
|
58
|
-
import { registerTool as registerUpdateWorkflowMapi } from "./tools/update-workflow-mapi.js";
|
|
3
|
+
import { allTools } from "./tools/index.js";
|
|
59
4
|
// Create server instance
|
|
60
5
|
export const createServer = () => {
|
|
61
6
|
const server = new McpServer({
|
|
@@ -63,61 +8,8 @@ export const createServer = () => {
|
|
|
63
8
|
version: packageJson.version,
|
|
64
9
|
});
|
|
65
10
|
// Register all tools
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
registerGetPublishedVariantMapi(server);
|
|
70
|
-
registerListVariantsItemMapi(server);
|
|
71
|
-
registerListVariantsCollectionMapi(server);
|
|
72
|
-
registerListVariantsTypeMapi(server);
|
|
73
|
-
registerListVariantsComponentsTypeMapi(server);
|
|
74
|
-
registerListVariantsSpaceMapi(server);
|
|
75
|
-
registerGetTypeMapi(server);
|
|
76
|
-
registerListContentTypesMapi(server);
|
|
77
|
-
registerDeleteContentTypeMapi(server);
|
|
78
|
-
registerListLanguagesMapi(server);
|
|
79
|
-
registerAddLanguageMapi(server);
|
|
80
|
-
registerPatchLanguageMapi(server);
|
|
81
|
-
registerListCollectionsMapi(server);
|
|
82
|
-
registerPatchCollectionsMapi(server);
|
|
83
|
-
registerListSpacesMapi(server);
|
|
84
|
-
registerAddSpaceMapi(server);
|
|
85
|
-
registerPatchSpaceMapi(server);
|
|
86
|
-
registerDeleteSpaceMapi(server);
|
|
87
|
-
registerListRolesMapi(server);
|
|
88
|
-
registerGetAssetMapi(server);
|
|
89
|
-
registerListAssetsMapi(server);
|
|
90
|
-
registerUpdateAssetMapi(server);
|
|
91
|
-
registerListAssetFoldersMapi(server);
|
|
92
|
-
registerPatchAssetFoldersMapi(server);
|
|
93
|
-
registerAddContentTypeMapi(server);
|
|
94
|
-
registerPatchContentTypeMapi(server);
|
|
95
|
-
registerAddContentTypeSnippetMapi(server);
|
|
96
|
-
registerGetTypeSnippetMapi(server);
|
|
97
|
-
registerListContentTypeSnippetsMapi(server);
|
|
98
|
-
registerPatchTypeSnippetMapi(server);
|
|
99
|
-
registerDeleteTypeSnippetMapi(server);
|
|
100
|
-
registerAddTaxonomyGroupMapi(server);
|
|
101
|
-
registerListTaxonomyGroupsMapi(server);
|
|
102
|
-
registerGetTaxonomyGroupMapi(server);
|
|
103
|
-
registerPatchTaxonomyGroupMapi(server);
|
|
104
|
-
registerDeleteTaxonomyGroupMapi(server);
|
|
105
|
-
registerAddContentItemMapi(server);
|
|
106
|
-
registerUpdateContentItemMapi(server);
|
|
107
|
-
registerDeleteContentItemMapi(server);
|
|
108
|
-
registerCreateLanguageVariantMapi(server);
|
|
109
|
-
registerUpdateLanguageVariantMapi(server);
|
|
110
|
-
registerCreateVariantVersionMapi(server);
|
|
111
|
-
registerDeleteLanguageVariantMapi(server);
|
|
112
|
-
registerListWorkflowsMapi(server);
|
|
113
|
-
registerAddWorkflowMapi(server);
|
|
114
|
-
registerUpdateWorkflowMapi(server);
|
|
115
|
-
registerDeleteWorkflowMapi(server);
|
|
116
|
-
registerChangeVariantWorkflowStepMapi(server);
|
|
117
|
-
registerFilterVariantsMapi(server);
|
|
118
|
-
registerBulkGetItemsVariantsMapi(server);
|
|
119
|
-
registerSearchVariantsMapi(server);
|
|
120
|
-
registerPublishVariantMapi(server);
|
|
121
|
-
registerUnpublishVariantMapi(server);
|
|
11
|
+
for (const tool of Object.values(allTools)) {
|
|
12
|
+
server.registerTool(tool.name, { description: tool.description, inputSchema: tool.inputSchema }, tool.handler);
|
|
13
|
+
}
|
|
122
14
|
return { server };
|
|
123
15
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import MiniSearch from "minisearch";
|
|
2
|
+
/**
|
|
3
|
+
* Extracts argument names and descriptions from a Zod input schema
|
|
4
|
+
* to produce a searchable string, matching Anthropic's BM25 tool search
|
|
5
|
+
* which indexes argument names and argument descriptions.
|
|
6
|
+
*/
|
|
7
|
+
const extractArgs = (inputSchema) => {
|
|
8
|
+
const parts = [];
|
|
9
|
+
for (const [argName, zodType] of Object.entries(inputSchema)) {
|
|
10
|
+
parts.push(argName);
|
|
11
|
+
const desc = zodType.description;
|
|
12
|
+
if (desc)
|
|
13
|
+
parts.push(desc);
|
|
14
|
+
}
|
|
15
|
+
return parts.join(" ");
|
|
16
|
+
};
|
|
17
|
+
const tokenize = (text) => text
|
|
18
|
+
.toLowerCase()
|
|
19
|
+
.replace(/[^a-z0-9]/g, " ")
|
|
20
|
+
.split(/\s+/)
|
|
21
|
+
.filter((t) => t.length > 0);
|
|
22
|
+
export const createToolSearchIndex = (tools) => {
|
|
23
|
+
const docs = tools.map((t, i) => ({
|
|
24
|
+
id: i,
|
|
25
|
+
name: t.name,
|
|
26
|
+
description: t.description,
|
|
27
|
+
args: extractArgs(t.inputSchema),
|
|
28
|
+
}));
|
|
29
|
+
const index = new MiniSearch({
|
|
30
|
+
fields: ["name", "description", "args"],
|
|
31
|
+
storeFields: ["name"],
|
|
32
|
+
tokenize,
|
|
33
|
+
searchOptions: {
|
|
34
|
+
boost: { name: 2, args: 0.5 },
|
|
35
|
+
prefix: true,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
index.addAll(docs);
|
|
39
|
+
return index;
|
|
40
|
+
};
|
|
41
|
+
export const searchTools = (index, query, topK) => index
|
|
42
|
+
.search(query)
|
|
43
|
+
.slice(0, topK)
|
|
44
|
+
.map((r) => ({
|
|
45
|
+
name: r.name,
|
|
46
|
+
score: r.score,
|
|
47
|
+
}));
|