@kontent-ai/mcp-server 0.2.0 → 0.3.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/build/schemas/taxonomySchemas.js +15 -0
- package/build/server.js +10 -0
- package/build/tools/add-taxonomy-group-mapi.js +19 -0
- package/build/tools/get-taxonomy-group-mapi.js +21 -0
- package/build/tools/get-type-snippet-mapi.js +21 -0
- package/build/tools/list-content-type-snippets-mapi.js +17 -0
- package/build/tools/list-taxonomy-groups-mapi.js +20 -0
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// Schema for a taxonomy term
|
|
3
|
+
const taxonomyTermSchema = z.object({
|
|
4
|
+
name: z.string(),
|
|
5
|
+
codename: z.string().optional(),
|
|
6
|
+
external_id: z.string().optional(),
|
|
7
|
+
terms: z.lazy(() => z.array(taxonomyTermSchema)),
|
|
8
|
+
});
|
|
9
|
+
// Schema for a taxonomy group
|
|
10
|
+
export const taxonomyGroupSchemas = {
|
|
11
|
+
name: z.string().describe("Display name of the taxonomy group"),
|
|
12
|
+
codename: z.string().optional().describe("Codename of the taxonomy group (optional, will be generated if not provided)"),
|
|
13
|
+
external_id: z.string().optional().describe("External ID of the taxonomy group (optional)"),
|
|
14
|
+
terms: z.array(taxonomyTermSchema).describe("Hierarchical structure of taxonomy terms"),
|
|
15
|
+
};
|
package/build/server.js
CHANGED
|
@@ -9,6 +9,11 @@ import { registerTool as registerGetAssetMapi } from "./tools/get-asset-mapi.js"
|
|
|
9
9
|
import { registerTool as registerListAssetsMapi } from "./tools/list-assets-mapi.js";
|
|
10
10
|
import { registerTool as registerAddContentTypeMapi } from "./tools/add-content-type-mapi.js";
|
|
11
11
|
import { registerTool as registerAddContentTypeSnippetMapi } from "./tools/add-content-type-snippet-mapi.js";
|
|
12
|
+
import { registerTool as registerGetTypeSnippetMapi } from "./tools/get-type-snippet-mapi.js";
|
|
13
|
+
import { registerTool as registerListContentTypeSnippetsMapi } from "./tools/list-content-type-snippets-mapi.js";
|
|
14
|
+
import { registerTool as registerAddTaxonomyGroupMapi } from "./tools/add-taxonomy-group-mapi.js";
|
|
15
|
+
import { registerTool as registerListTaxonomyGroupsMapi } from "./tools/list-taxonomy-groups-mapi.js";
|
|
16
|
+
import { registerTool as registerGetTaxonomyGroupMapi } from "./tools/get-taxonomy-group-mapi.js";
|
|
12
17
|
// Create server instance
|
|
13
18
|
export const createServer = () => {
|
|
14
19
|
const server = new McpServer({
|
|
@@ -30,5 +35,10 @@ export const createServer = () => {
|
|
|
30
35
|
registerListAssetsMapi(server);
|
|
31
36
|
registerAddContentTypeMapi(server);
|
|
32
37
|
registerAddContentTypeSnippetMapi(server);
|
|
38
|
+
registerGetTypeSnippetMapi(server);
|
|
39
|
+
registerListContentTypeSnippetsMapi(server);
|
|
40
|
+
registerAddTaxonomyGroupMapi(server);
|
|
41
|
+
registerListTaxonomyGroupsMapi(server);
|
|
42
|
+
registerGetTaxonomyGroupMapi(server);
|
|
33
43
|
return { server };
|
|
34
44
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createMapiClient } from '../clients/kontentClients.js';
|
|
2
|
+
import { taxonomyGroupSchemas } from '../schemas/taxonomySchemas.js';
|
|
3
|
+
export const registerTool = (server) => {
|
|
4
|
+
server.tool("add-taxonomy-group-mapi", "Add a new taxonomy group via Management API", taxonomyGroupSchemas, async (taxonomyGroup) => {
|
|
5
|
+
const client = createMapiClient();
|
|
6
|
+
const response = await client
|
|
7
|
+
.addTaxonomy()
|
|
8
|
+
.withData(taxonomyGroup)
|
|
9
|
+
.toPromise();
|
|
10
|
+
return {
|
|
11
|
+
content: [
|
|
12
|
+
{
|
|
13
|
+
type: "text",
|
|
14
|
+
text: JSON.stringify(response.data),
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createMapiClient } from '../clients/kontentClients.js';
|
|
3
|
+
export const registerTool = (server) => {
|
|
4
|
+
server.tool("get-taxonomy-group-mapi", "Get taxonomy group by codename from Management API", {
|
|
5
|
+
codename: z.string().describe("Codename of the taxonomy group to get")
|
|
6
|
+
}, async ({ codename }) => {
|
|
7
|
+
const client = createMapiClient();
|
|
8
|
+
const response = await client
|
|
9
|
+
.getTaxonomy()
|
|
10
|
+
.byTaxonomyCodename(codename)
|
|
11
|
+
.toPromise();
|
|
12
|
+
return {
|
|
13
|
+
content: [
|
|
14
|
+
{
|
|
15
|
+
type: "text",
|
|
16
|
+
text: JSON.stringify(response.data),
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createMapiClient } from '../clients/kontentClients.js';
|
|
3
|
+
export const registerTool = (server) => {
|
|
4
|
+
server.tool("get-type-snippet-mapi", "Get content type snippet by codename from Management API", {
|
|
5
|
+
codename: z.string().describe("Codename of the content type snippet to get")
|
|
6
|
+
}, async ({ codename }) => {
|
|
7
|
+
const client = createMapiClient();
|
|
8
|
+
const response = await client
|
|
9
|
+
.viewContentTypeSnippet()
|
|
10
|
+
.byTypeCodename(codename)
|
|
11
|
+
.toPromise();
|
|
12
|
+
return {
|
|
13
|
+
content: [
|
|
14
|
+
{
|
|
15
|
+
type: "text",
|
|
16
|
+
text: JSON.stringify(response.data),
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createMapiClient } from '../clients/kontentClients.js';
|
|
2
|
+
export const registerTool = (server) => {
|
|
3
|
+
server.tool("list-content-type-snippets-mapi", "Get all content type snippets from Management API", {}, async () => {
|
|
4
|
+
const client = createMapiClient();
|
|
5
|
+
const response = await client
|
|
6
|
+
.listContentTypeSnippets()
|
|
7
|
+
.toAllPromise();
|
|
8
|
+
return {
|
|
9
|
+
content: [
|
|
10
|
+
{
|
|
11
|
+
type: "text",
|
|
12
|
+
text: JSON.stringify(response.data),
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createMapiClient } from '../clients/kontentClients.js';
|
|
3
|
+
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 () => {
|
|
7
|
+
const client = createMapiClient();
|
|
8
|
+
const response = await client
|
|
9
|
+
.listTaxonomies()
|
|
10
|
+
.toPromise();
|
|
11
|
+
return {
|
|
12
|
+
content: [
|
|
13
|
+
{
|
|
14
|
+
type: "text",
|
|
15
|
+
text: JSON.stringify(response.data),
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
};
|