@kontent-ai/mcp-server 0.3.0 → 0.4.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/LICENSE +21 -0
- package/README.md +59 -26
- package/build/schemas/contentTypeSchemas.js +139 -211
- package/build/tools/list-taxonomy-groups-mapi.js +1 -4
- package/package.json +6 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Kontent s.r.o.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
# Kontent.ai MCP Server
|
|
2
2
|
|
|
3
|
+
[![NPM Version][npm-shield]][npm-url]
|
|
4
|
+
[![Contributors][contributors-shield]][contributors-url]
|
|
5
|
+
[![Forks][forks-shield]][forks-url]
|
|
6
|
+
[![Stargazers][stars-shield]][stars-url]
|
|
7
|
+
[![Issues][issues-shield]][issues-url]
|
|
8
|
+
[![MIT License][license-shield]][license-url]
|
|
9
|
+
[![Discord][discord-shield]][discord-url]
|
|
10
|
+
|
|
3
11
|
This server provides a Model Context Protocol (MCP) interface for interacting with Kontent.ai's Management and Delivery APIs. It enables AI assistants to access and manipulate Kontent.ai content using standardized tools.
|
|
4
12
|
|
|
5
13
|
## Features
|
|
6
14
|
|
|
7
15
|
- Retrieve content items, variants, and assets
|
|
8
|
-
- Get content types and their structure
|
|
9
16
|
- List available languages and assets
|
|
10
|
-
- Create
|
|
17
|
+
- Get, List, and Create content types and snippets
|
|
18
|
+
- Get, List, and Create taxonomies
|
|
11
19
|
|
|
12
20
|
## Getting Started
|
|
13
21
|
|
|
@@ -16,41 +24,53 @@ This server provides a Model Context Protocol (MCP) interface for interacting wi
|
|
|
16
24
|
- Node.js (version specified in `.nvmrc`)
|
|
17
25
|
- Kontent.ai account with API keys
|
|
18
26
|
|
|
19
|
-
###
|
|
27
|
+
### Running
|
|
20
28
|
|
|
21
|
-
|
|
29
|
+
You can run this server with either stdio or sse transport.
|
|
22
30
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
### Stdio transport
|
|
32
|
+
|
|
33
|
+
To run the server with stdio transport configure your MCP client with the command to run and the necessary environment variables.
|
|
34
|
+
Example:
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"kontent-ai-stdio": {
|
|
38
|
+
"command": "npx @kontent-ai/mcp-server@latest stdio",
|
|
39
|
+
"env": {
|
|
40
|
+
"KONTENT_API_KEY": "<management-api-key>",
|
|
41
|
+
"KONTENT_ENVIRONMENT_ID": "<environment-id>"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
26
45
|
```
|
|
27
46
|
|
|
28
|
-
###
|
|
47
|
+
### SSE transport
|
|
29
48
|
|
|
30
|
-
You can run
|
|
49
|
+
You can also run your server manually with the SSE transport and configure your MCP client to connect to the port the server is running on.
|
|
50
|
+
Run the following command to start the server and ensure the environment variables are defined for it either by providing `.env` file in the `cwd` or providing the variables to the process any other way.
|
|
31
51
|
|
|
32
52
|
```bash
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
53
|
+
npx @kontent-ai/mcp-server@latest sse
|
|
54
|
+
```
|
|
55
|
+
```env
|
|
56
|
+
KONTENT_API_KEY=<management-api-key>
|
|
57
|
+
KONTENT_ENVIRONMENT_ID=<environment-id>
|
|
58
|
+
PORT=<port-number> # optionally specify port, defaults to 3001
|
|
38
59
|
```
|
|
39
60
|
|
|
40
|
-
|
|
41
|
-
|
|
61
|
+
Then configure your MCP client to connect to the running server.
|
|
62
|
+
Example:
|
|
42
63
|
```json
|
|
43
64
|
{
|
|
44
|
-
"kontent-ai-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"KONTENT_API_KEY": "<management-api-key>",
|
|
48
|
-
"KONTENT_ENVIRONMENT_ID": "<environment-id>"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
65
|
+
"kontent-ai-sse": {
|
|
66
|
+
"url": "http://localhost:3001/sse"
|
|
67
|
+
}
|
|
51
68
|
}
|
|
52
69
|
```
|
|
53
70
|
|
|
71
|
+
|
|
72
|
+
## Development
|
|
73
|
+
|
|
54
74
|
### Local Installation
|
|
55
75
|
|
|
56
76
|
```bash
|
|
@@ -69,8 +89,6 @@ npm run start:sse # For SSE transport
|
|
|
69
89
|
npm run start:stdio # For STDIO transport
|
|
70
90
|
```
|
|
71
91
|
|
|
72
|
-
## Development
|
|
73
|
-
|
|
74
92
|
### Available Scripts
|
|
75
93
|
|
|
76
94
|
- `npm run build` - Compile TypeScript to JavaScript
|
|
@@ -88,4 +106,19 @@ npm run start:stdio # For STDIO transport
|
|
|
88
106
|
|
|
89
107
|
## License
|
|
90
108
|
|
|
91
|
-
MIT
|
|
109
|
+
MIT
|
|
110
|
+
|
|
111
|
+
[contributors-shield]: https://img.shields.io/github/contributors/kontent-ai/mcp-server.svg?style=for-the-badge
|
|
112
|
+
[contributors-url]: https://github.com/kontent-ai/mcp-server/graphs/contributors
|
|
113
|
+
[forks-shield]: https://img.shields.io/github/forks/kontent-ai/mcp-server.svg?style=for-the-badge
|
|
114
|
+
[forks-url]: https://github.com/kontent-ai/mcp-server/network/members
|
|
115
|
+
[stars-shield]: https://img.shields.io/github/stars/kontent-ai/mcp-server.svg?style=for-the-badge
|
|
116
|
+
[stars-url]: https://github.com/kontent-ai/mcp-server/stargazers
|
|
117
|
+
[issues-shield]: https://img.shields.io/github/issues/kontent-ai/mcp-server.svg?style=for-the-badge
|
|
118
|
+
[issues-url]: https://github.com/kontent-ai/mcp-server/issues
|
|
119
|
+
[license-shield]: https://img.shields.io/github/license/kontent-ai/mcp-server.svg?style=for-the-badge
|
|
120
|
+
[license-url]: https://github.com/kontent-ai/mcp-server/blob/master/LICENSE.md
|
|
121
|
+
[discord-shield]: https://img.shields.io/discord/821885171984891914?color=%237289DA&label=Kontent.ai%20Discord&logo=discord&style=for-the-badge
|
|
122
|
+
[discord-url]: https://discord.com/invite/SKCxwPtevJ
|
|
123
|
+
[npm-url]: https://www.npmjs.com/package/@kontent-ai/mcp-server
|
|
124
|
+
[npm-shield]: https://img.shields.io/npm/v/%40kontent-ai%2Fmcp-server?style=for-the-badge&logo=npm&color=%23CB0000
|
|
@@ -8,7 +8,9 @@ const referenceObjectSchema = z.object({
|
|
|
8
8
|
const baseElementSchema = {
|
|
9
9
|
codename: z.string().optional(),
|
|
10
10
|
external_id: z.string().optional(),
|
|
11
|
-
content_group: referenceObjectSchema
|
|
11
|
+
content_group: referenceObjectSchema
|
|
12
|
+
.describe("An object with an id or codename property referencing a content group.")
|
|
13
|
+
.optional(),
|
|
12
14
|
};
|
|
13
15
|
const namedElementSchema = {
|
|
14
16
|
...baseElementSchema,
|
|
@@ -61,120 +63,131 @@ const textLengthLimitSchema = z.object({
|
|
|
61
63
|
value: z.number(),
|
|
62
64
|
applies_to: z.enum(['words', 'characters'])
|
|
63
65
|
}).optional();
|
|
66
|
+
// Individual element type schemas
|
|
67
|
+
const assetElementSchema = z.object({
|
|
68
|
+
type: z.literal('asset'),
|
|
69
|
+
...namedElementSchema,
|
|
70
|
+
asset_count_limit: countLimitSchema,
|
|
71
|
+
maximum_file_size: z.number().optional(),
|
|
72
|
+
allowed_file_types: z.enum(['adjustable', 'any']).optional(),
|
|
73
|
+
...imageLimitSchema,
|
|
74
|
+
default: arrayDefaultSchema(),
|
|
75
|
+
});
|
|
76
|
+
const customElementSchema = z.object({
|
|
77
|
+
type: z.literal('custom'),
|
|
78
|
+
...namedElementSchema,
|
|
79
|
+
source_url: z.string(),
|
|
80
|
+
json_parameters: z.string().optional(),
|
|
81
|
+
allowed_elements: z.array(referenceObjectSchema
|
|
82
|
+
.describe("An object with an id or codename property referencing an element.")).optional(),
|
|
83
|
+
});
|
|
84
|
+
const dateTimeElementSchema = z.object({
|
|
85
|
+
type: z.literal('date_time'),
|
|
86
|
+
...namedElementSchema,
|
|
87
|
+
default: stringDefaultSchema,
|
|
88
|
+
});
|
|
89
|
+
const guidelinesElementSchema = z.object({
|
|
90
|
+
type: z.literal('guidelines'),
|
|
91
|
+
guidelines: z.string(),
|
|
92
|
+
...baseElementSchema,
|
|
93
|
+
});
|
|
94
|
+
const modularContentElementSchema = z.object({
|
|
95
|
+
type: z.literal('modular_content'),
|
|
96
|
+
...namedElementSchema,
|
|
97
|
+
allowed_content_types: z.array(referenceObjectSchema
|
|
98
|
+
.describe("An object with an id or codename property referencing a content type.")).optional(),
|
|
99
|
+
item_count_limit: countLimitSchema,
|
|
100
|
+
default: arrayDefaultSchema(),
|
|
101
|
+
});
|
|
102
|
+
const subpagesElementSchema = z.object({
|
|
103
|
+
type: z.literal('subpages'),
|
|
104
|
+
...namedElementSchema,
|
|
105
|
+
allowed_content_types: z.array(referenceObjectSchema
|
|
106
|
+
.describe("An object with an id or codename property referencing a content type.")).optional(),
|
|
107
|
+
item_count_limit: countLimitSchema,
|
|
108
|
+
});
|
|
109
|
+
const multipleChoiceElementSchema = z.object({
|
|
110
|
+
type: z.literal('multiple_choice'),
|
|
111
|
+
...namedElementSchema,
|
|
112
|
+
mode: z.enum(['single', 'multiple']),
|
|
113
|
+
options: z.array(z.object({
|
|
114
|
+
name: z.string(),
|
|
115
|
+
codename: z.string().optional(),
|
|
116
|
+
external_id: z.string().optional(),
|
|
117
|
+
})),
|
|
118
|
+
default: arrayDefaultSchema(),
|
|
119
|
+
});
|
|
120
|
+
const numberElementSchema = z.object({
|
|
121
|
+
type: z.literal('number'),
|
|
122
|
+
...namedElementSchema,
|
|
123
|
+
default: numberDefaultSchema,
|
|
124
|
+
});
|
|
125
|
+
const richTextElementSchema = z.object({
|
|
126
|
+
type: z.literal('rich_text'),
|
|
127
|
+
...namedElementSchema,
|
|
128
|
+
allowed_blocks: z.array(z.enum(['images', 'text', 'tables', 'components-and-items'])).optional(),
|
|
129
|
+
allowed_formatting: z.array(z.enum(['unstyled', 'bold', 'italic', 'code', 'link', 'subscript', 'superscript'])).optional(),
|
|
130
|
+
allowed_text_blocks: z.array(z.enum(['paragraph', 'heading-one', 'heading-two', 'heading-three', 'heading-four', 'heading-five', 'heading-six', 'ordered-list', 'unordered-list'])).optional(),
|
|
131
|
+
allowed_table_blocks: z.array(z.enum(['images', 'text'])).optional(),
|
|
132
|
+
allowed_table_formatting: z.array(z.enum(['unstyled', 'bold', 'italic', 'code', 'link', 'subscript', 'superscript'])).optional(),
|
|
133
|
+
allowed_table_text_blocks: z.array(z.enum(['paragraph', 'heading-one', 'heading-two', 'heading-three', 'heading-four', 'heading-five', 'heading-six', 'ordered-list', 'unordered-list'])).optional(),
|
|
134
|
+
allowed_content_types: z.array(referenceObjectSchema
|
|
135
|
+
.describe("An object with an id or codename property referencing a content type.")).optional(),
|
|
136
|
+
allowed_item_link_types: z.array(referenceObjectSchema
|
|
137
|
+
.describe("An object with an id or codename property referencing a content type.")).optional(),
|
|
138
|
+
...imageLimitSchema,
|
|
139
|
+
allowed_image_types: z.enum(['adjustable', 'any']).optional(),
|
|
140
|
+
maximum_image_size: z.number().optional(),
|
|
141
|
+
maximum_text_length: textLengthLimitSchema,
|
|
142
|
+
});
|
|
143
|
+
const snippetElement = z.object({
|
|
144
|
+
type: z.literal('snippet'),
|
|
145
|
+
snippet: referenceObjectSchema
|
|
146
|
+
.describe("An object with an id or codename property referencing a snippet."),
|
|
147
|
+
...baseElementSchema,
|
|
148
|
+
});
|
|
149
|
+
const taxonomyElementSchema = z.object({
|
|
150
|
+
type: z.literal('taxonomy'),
|
|
151
|
+
taxonomy_group: referenceObjectSchema
|
|
152
|
+
.describe("An object with an id or codename property referencing a taxonomy group."),
|
|
153
|
+
...namedElementSchema,
|
|
154
|
+
term_count_limit: countLimitSchema,
|
|
155
|
+
default: arrayDefaultSchema(),
|
|
156
|
+
});
|
|
157
|
+
const textElementSchema = z.object({
|
|
158
|
+
type: z.literal('text'),
|
|
159
|
+
...namedElementSchema,
|
|
160
|
+
maximum_text_length: textLengthLimitSchema,
|
|
161
|
+
validation_regex: regexValidationSchema,
|
|
162
|
+
default: stringDefaultSchema,
|
|
163
|
+
});
|
|
164
|
+
const urlSlugElementSchema = z.object({
|
|
165
|
+
type: z.literal('url_slug'),
|
|
166
|
+
...namedElementSchema,
|
|
167
|
+
depends_on: z.object({
|
|
168
|
+
element: referenceObjectSchema
|
|
169
|
+
.describe("An object with an id or codename property referencing an element."),
|
|
170
|
+
snippet: referenceObjectSchema
|
|
171
|
+
.describe("An object with an id or codename property referencing a content type snippet.")
|
|
172
|
+
.optional(),
|
|
173
|
+
}),
|
|
174
|
+
validation_regex: regexValidationSchema,
|
|
175
|
+
});
|
|
64
176
|
// Define a union type of all possible element types for content types
|
|
65
|
-
export const elementSchema = z.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
...namedElementSchema,
|
|
80
|
-
source_url: z.string(),
|
|
81
|
-
json_parameters: z.string().optional(),
|
|
82
|
-
allowed_elements: z.array(referenceObjectSchema).optional(),
|
|
83
|
-
}),
|
|
84
|
-
// Date time element
|
|
85
|
-
z.object({
|
|
86
|
-
type: z.literal('date_time'),
|
|
87
|
-
...namedElementSchema,
|
|
88
|
-
default: stringDefaultSchema,
|
|
89
|
-
}),
|
|
90
|
-
// Guidelines element
|
|
91
|
-
z.object({
|
|
92
|
-
type: z.literal('guidelines'),
|
|
93
|
-
guidelines: z.string(),
|
|
94
|
-
...baseElementSchema,
|
|
95
|
-
}),
|
|
96
|
-
// Linked items (modular content) element
|
|
97
|
-
z.object({
|
|
98
|
-
type: z.literal('modular_content'),
|
|
99
|
-
...namedElementSchema,
|
|
100
|
-
allowed_content_types: z.array(referenceObjectSchema).optional(),
|
|
101
|
-
item_count_limit: countLimitSchema,
|
|
102
|
-
default: arrayDefaultSchema(),
|
|
103
|
-
}),
|
|
104
|
-
// Subpages element
|
|
105
|
-
z.object({
|
|
106
|
-
type: z.literal('subpages'),
|
|
107
|
-
...namedElementSchema,
|
|
108
|
-
allowed_content_types: z.array(referenceObjectSchema).optional(),
|
|
109
|
-
item_count_limit: countLimitSchema,
|
|
110
|
-
}),
|
|
111
|
-
// Multiple choice element
|
|
112
|
-
z.object({
|
|
113
|
-
type: z.literal('multiple_choice'),
|
|
114
|
-
...namedElementSchema,
|
|
115
|
-
mode: z.enum(['single', 'multiple']),
|
|
116
|
-
options: z.array(z.object({
|
|
117
|
-
name: z.string(),
|
|
118
|
-
codename: z.string().optional(),
|
|
119
|
-
external_id: z.string().optional(),
|
|
120
|
-
})),
|
|
121
|
-
default: arrayDefaultSchema(),
|
|
122
|
-
}),
|
|
123
|
-
// Number element
|
|
124
|
-
z.object({
|
|
125
|
-
type: z.literal('number'),
|
|
126
|
-
...namedElementSchema,
|
|
127
|
-
default: numberDefaultSchema,
|
|
128
|
-
}),
|
|
129
|
-
// Rich text element
|
|
130
|
-
z.object({
|
|
131
|
-
type: z.literal('rich_text'),
|
|
132
|
-
...namedElementSchema,
|
|
133
|
-
allowed_blocks: z.array(z.enum(['images', 'text', 'tables', 'components-and-items'])).optional(),
|
|
134
|
-
allowed_formatting: z.array(z.enum(['unstyled', 'bold', 'italic', 'code', 'link', 'subscript', 'superscript'])).optional(),
|
|
135
|
-
allowed_text_blocks: z.array(z.enum(['paragraph', 'heading-one', 'heading-two', 'heading-three', 'heading-four', 'heading-five', 'heading-six', 'ordered-list', 'unordered-list'])).optional(),
|
|
136
|
-
allowed_table_blocks: z.array(z.enum(['images', 'text'])).optional(),
|
|
137
|
-
allowed_table_formatting: z.array(z.enum(['unstyled', 'bold', 'italic', 'code', 'link', 'subscript', 'superscript'])).optional(),
|
|
138
|
-
allowed_table_text_blocks: z.array(z.enum(['paragraph', 'heading-one', 'heading-two', 'heading-three', 'heading-four', 'heading-five', 'heading-six', 'ordered-list', 'unordered-list'])).optional(),
|
|
139
|
-
allowed_content_types: z.array(referenceObjectSchema).optional(),
|
|
140
|
-
allowed_item_link_types: z.array(referenceObjectSchema).optional(),
|
|
141
|
-
...imageLimitSchema,
|
|
142
|
-
allowed_image_types: z.enum(['adjustable', 'any']).optional(),
|
|
143
|
-
maximum_image_size: z.number().optional(),
|
|
144
|
-
maximum_text_length: textLengthLimitSchema,
|
|
145
|
-
}),
|
|
146
|
-
// Snippet element
|
|
147
|
-
z.object({
|
|
148
|
-
type: z.literal('snippet'),
|
|
149
|
-
snippet: referenceObjectSchema,
|
|
150
|
-
...baseElementSchema,
|
|
151
|
-
}),
|
|
152
|
-
// Taxonomy element
|
|
153
|
-
z.object({
|
|
154
|
-
type: z.literal('taxonomy'),
|
|
155
|
-
taxonomy_group: referenceObjectSchema,
|
|
156
|
-
...namedElementSchema,
|
|
157
|
-
term_count_limit: countLimitSchema,
|
|
158
|
-
default: arrayDefaultSchema(),
|
|
159
|
-
}),
|
|
160
|
-
// Text element
|
|
161
|
-
z.object({
|
|
162
|
-
type: z.literal('text'),
|
|
163
|
-
...namedElementSchema,
|
|
164
|
-
maximum_text_length: textLengthLimitSchema,
|
|
165
|
-
validation_regex: regexValidationSchema,
|
|
166
|
-
default: stringDefaultSchema,
|
|
167
|
-
}),
|
|
168
|
-
// URL slug element
|
|
169
|
-
z.object({
|
|
170
|
-
type: z.literal('url_slug'),
|
|
171
|
-
...namedElementSchema,
|
|
172
|
-
depends_on: z.object({
|
|
173
|
-
element: referenceObjectSchema,
|
|
174
|
-
snippet: referenceObjectSchema.optional(),
|
|
175
|
-
}),
|
|
176
|
-
validation_regex: regexValidationSchema,
|
|
177
|
-
}),
|
|
177
|
+
export const elementSchema = z.discriminatedUnion('type', [
|
|
178
|
+
assetElementSchema,
|
|
179
|
+
customElementSchema,
|
|
180
|
+
dateTimeElementSchema,
|
|
181
|
+
guidelinesElementSchema,
|
|
182
|
+
modularContentElementSchema,
|
|
183
|
+
subpagesElementSchema,
|
|
184
|
+
multipleChoiceElementSchema,
|
|
185
|
+
numberElementSchema,
|
|
186
|
+
richTextElementSchema,
|
|
187
|
+
snippetElement,
|
|
188
|
+
taxonomyElementSchema,
|
|
189
|
+
textElementSchema,
|
|
190
|
+
urlSlugElementSchema,
|
|
178
191
|
]);
|
|
179
192
|
// Define schema for content groups
|
|
180
193
|
export const contentGroupSchema = z.object({
|
|
@@ -183,101 +196,16 @@ export const contentGroupSchema = z.object({
|
|
|
183
196
|
codename: z.string().optional(),
|
|
184
197
|
});
|
|
185
198
|
// Define a union type for snippet elements (excluding url_slug and snippet elements)
|
|
186
|
-
export const snippetElementSchema = z.
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
z.object({
|
|
199
|
-
type: z.literal('custom'),
|
|
200
|
-
...namedElementSchema,
|
|
201
|
-
source_url: z.string(),
|
|
202
|
-
json_parameters: z.string().optional(),
|
|
203
|
-
allowed_elements: z.array(referenceObjectSchema).optional(),
|
|
204
|
-
}),
|
|
205
|
-
// Date time element
|
|
206
|
-
z.object({
|
|
207
|
-
type: z.literal('date_time'),
|
|
208
|
-
...namedElementSchema,
|
|
209
|
-
default: stringDefaultSchema,
|
|
210
|
-
}),
|
|
211
|
-
// Guidelines element
|
|
212
|
-
z.object({
|
|
213
|
-
type: z.literal('guidelines'),
|
|
214
|
-
guidelines: z.string(),
|
|
215
|
-
...baseElementSchema,
|
|
216
|
-
}),
|
|
217
|
-
// Linked items (modular content) element
|
|
218
|
-
z.object({
|
|
219
|
-
type: z.literal('modular_content'),
|
|
220
|
-
...namedElementSchema,
|
|
221
|
-
allowed_content_types: z.array(referenceObjectSchema).optional(),
|
|
222
|
-
item_count_limit: countLimitSchema,
|
|
223
|
-
default: arrayDefaultSchema(),
|
|
224
|
-
}),
|
|
225
|
-
// Subpages element
|
|
226
|
-
z.object({
|
|
227
|
-
type: z.literal('subpages'),
|
|
228
|
-
...namedElementSchema,
|
|
229
|
-
allowed_content_types: z.array(referenceObjectSchema).optional(),
|
|
230
|
-
item_count_limit: countLimitSchema,
|
|
231
|
-
}),
|
|
232
|
-
// Multiple choice element
|
|
233
|
-
z.object({
|
|
234
|
-
type: z.literal('multiple_choice'),
|
|
235
|
-
...namedElementSchema,
|
|
236
|
-
mode: z.enum(['single', 'multiple']),
|
|
237
|
-
options: z.array(z.object({
|
|
238
|
-
name: z.string(),
|
|
239
|
-
codename: z.string().optional(),
|
|
240
|
-
external_id: z.string().optional(),
|
|
241
|
-
})),
|
|
242
|
-
default: arrayDefaultSchema(),
|
|
243
|
-
}),
|
|
244
|
-
// Number element
|
|
245
|
-
z.object({
|
|
246
|
-
type: z.literal('number'),
|
|
247
|
-
...namedElementSchema,
|
|
248
|
-
default: numberDefaultSchema,
|
|
249
|
-
}),
|
|
250
|
-
// Rich text element
|
|
251
|
-
z.object({
|
|
252
|
-
type: z.literal('rich_text'),
|
|
253
|
-
...namedElementSchema,
|
|
254
|
-
allowed_blocks: z.array(z.enum(['images', 'text', 'tables', 'components-and-items'])).optional(),
|
|
255
|
-
allowed_formatting: z.array(z.enum(['unstyled', 'bold', 'italic', 'code', 'link', 'subscript', 'superscript'])).optional(),
|
|
256
|
-
allowed_text_blocks: z.array(z.enum(['paragraph', 'heading-one', 'heading-two', 'heading-three', 'heading-four', 'heading-five', 'heading-six', 'ordered-list', 'unordered-list'])).optional(),
|
|
257
|
-
allowed_table_blocks: z.array(z.enum(['images', 'text'])).optional(),
|
|
258
|
-
allowed_table_formatting: z.array(z.enum(['unstyled', 'bold', 'italic', 'code', 'link', 'subscript', 'superscript'])).optional(),
|
|
259
|
-
allowed_table_text_blocks: z.array(z.enum(['paragraph', 'heading-one', 'heading-two', 'heading-three', 'heading-four', 'heading-five', 'heading-six', 'ordered-list', 'unordered-list'])).optional(),
|
|
260
|
-
allowed_content_types: z.array(referenceObjectSchema).optional(),
|
|
261
|
-
allowed_item_link_types: z.array(referenceObjectSchema).optional(),
|
|
262
|
-
...imageLimitSchema,
|
|
263
|
-
allowed_image_types: z.enum(['adjustable', 'any']).optional(),
|
|
264
|
-
maximum_image_size: z.number().optional(),
|
|
265
|
-
maximum_text_length: textLengthLimitSchema,
|
|
266
|
-
}),
|
|
267
|
-
// Taxonomy element
|
|
268
|
-
z.object({
|
|
269
|
-
type: z.literal('taxonomy'),
|
|
270
|
-
taxonomy_group: referenceObjectSchema,
|
|
271
|
-
...namedElementSchema,
|
|
272
|
-
term_count_limit: countLimitSchema,
|
|
273
|
-
default: arrayDefaultSchema(),
|
|
274
|
-
}),
|
|
275
|
-
// Text element
|
|
276
|
-
z.object({
|
|
277
|
-
type: z.literal('text'),
|
|
278
|
-
...namedElementSchema,
|
|
279
|
-
maximum_text_length: textLengthLimitSchema,
|
|
280
|
-
validation_regex: regexValidationSchema,
|
|
281
|
-
default: stringDefaultSchema,
|
|
282
|
-
}),
|
|
199
|
+
export const snippetElementSchema = z.discriminatedUnion('type', [
|
|
200
|
+
assetElementSchema,
|
|
201
|
+
customElementSchema,
|
|
202
|
+
dateTimeElementSchema,
|
|
203
|
+
guidelinesElementSchema,
|
|
204
|
+
modularContentElementSchema,
|
|
205
|
+
subpagesElementSchema,
|
|
206
|
+
multipleChoiceElementSchema,
|
|
207
|
+
numberElementSchema,
|
|
208
|
+
richTextElementSchema,
|
|
209
|
+
taxonomyElementSchema,
|
|
210
|
+
textElementSchema,
|
|
283
211
|
]);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
1
|
import { createMapiClient } from '../clients/kontentClients.js';
|
|
3
2
|
export const registerTool = (server) => {
|
|
4
|
-
server.tool("list-taxonomy-groups-mapi", "Get all taxonomy groups from Management API", {
|
|
5
|
-
random_string: z.string().describe("Dummy parameter for no-parameter tools")
|
|
6
|
-
}, async () => {
|
|
3
|
+
server.tool("list-taxonomy-groups-mapi", "Get all taxonomy groups from Management API", {}, async () => {
|
|
7
4
|
const client = createMapiClient();
|
|
8
5
|
const response = await client
|
|
9
6
|
.listTaxonomies()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kontent-ai/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
"author": "Jiri Lojda",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@kontent-ai/delivery-sdk": "^16.
|
|
20
|
+
"@kontent-ai/delivery-sdk": "^16.2.0",
|
|
21
21
|
"@kontent-ai/management-sdk": "^7.9.0",
|
|
22
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
22
|
+
"@modelcontextprotocol/sdk": "^1.11.4",
|
|
23
23
|
"dotenv": "^16.5.0",
|
|
24
24
|
"express": "^5.1.0",
|
|
25
|
-
"zod": "^3.
|
|
25
|
+
"zod": "^3.25.7"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/express": "^5.0.
|
|
29
|
-
"@types/node": "^22.
|
|
28
|
+
"@types/express": "^5.0.2",
|
|
29
|
+
"@types/node": "^22.15.19",
|
|
30
30
|
"typescript": "^5.8.3"
|
|
31
31
|
}
|
|
32
32
|
}
|