microcms-mcp-server 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/LICENSE +21 -0
- package/README.md +368 -0
- package/bin/microcms-mcp-server.js +9 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +105 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +42 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +58 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +27 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +118 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/create-content.d.ts +7 -0
- package/dist/tools/create-content.d.ts.map +1 -0
- package/dist/tools/create-content.js +40 -0
- package/dist/tools/create-content.js.map +1 -0
- package/dist/tools/delete-content.d.ts +7 -0
- package/dist/tools/delete-content.d.ts.map +1 -0
- package/dist/tools/delete-content.js +28 -0
- package/dist/tools/delete-content.js.map +1 -0
- package/dist/tools/get-content.d.ts +5 -0
- package/dist/tools/get-content.d.ts.map +1 -0
- package/dist/tools/get-content.js +48 -0
- package/dist/tools/get-content.js.map +1 -0
- package/dist/tools/get-list.d.ts +5 -0
- package/dist/tools/get-list.d.ts.map +1 -0
- package/dist/tools/get-list.js +80 -0
- package/dist/tools/get-list.js.map +1 -0
- package/dist/tools/get-media.d.ts +5 -0
- package/dist/tools/get-media.d.ts.map +1 -0
- package/dist/tools/get-media.js +51 -0
- package/dist/tools/get-media.js.map +1 -0
- package/dist/tools/patch-content.d.ts +7 -0
- package/dist/tools/patch-content.d.ts.map +1 -0
- package/dist/tools/patch-content.js +41 -0
- package/dist/tools/patch-content.js.map +1 -0
- package/dist/tools/update-content.d.ts +7 -0
- package/dist/tools/update-content.d.ts.map +1 -0
- package/dist/tools/update-content.js +41 -0
- package/dist/tools/update-content.js.map +1 -0
- package/dist/tools/upload-media.d.ts +7 -0
- package/dist/tools/upload-media.d.ts.map +1 -0
- package/dist/tools/upload-media.js +70 -0
- package/dist/tools/upload-media.js.map +1 -0
- package/dist/types.d.ts +74 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/mcp-config-sample.json +13 -0
- package/package.json +68 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import { getListTool, handleGetList } from './tools/get-list.js';
|
|
6
|
+
import { getContentTool, handleGetContent } from './tools/get-content.js';
|
|
7
|
+
import { createContentTool, handleCreateContent } from './tools/create-content.js';
|
|
8
|
+
import { updateContentTool, handleUpdateContent } from './tools/update-content.js';
|
|
9
|
+
import { patchContentTool, handlePatchContent } from './tools/patch-content.js';
|
|
10
|
+
import { deleteContentTool, handleDeleteContent } from './tools/delete-content.js';
|
|
11
|
+
import { getMediaTool, handleGetMedia } from './tools/get-media.js';
|
|
12
|
+
import { uploadMediaTool, handleUploadMedia } from './tools/upload-media.js';
|
|
13
|
+
const server = new Server({
|
|
14
|
+
name: 'microcms-mcp-server',
|
|
15
|
+
version: '1.0.0',
|
|
16
|
+
description: 'A Model Context Protocol server for microCMS API',
|
|
17
|
+
}, {
|
|
18
|
+
capabilities: {
|
|
19
|
+
tools: {},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
23
|
+
return {
|
|
24
|
+
tools: [
|
|
25
|
+
getListTool,
|
|
26
|
+
getContentTool,
|
|
27
|
+
createContentTool,
|
|
28
|
+
updateContentTool,
|
|
29
|
+
patchContentTool,
|
|
30
|
+
deleteContentTool,
|
|
31
|
+
getMediaTool,
|
|
32
|
+
uploadMediaTool,
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
37
|
+
const { name, arguments: args } = request.params;
|
|
38
|
+
const params = args;
|
|
39
|
+
try {
|
|
40
|
+
let result;
|
|
41
|
+
switch (name) {
|
|
42
|
+
case 'microcms_get_list':
|
|
43
|
+
result = await handleGetList(params);
|
|
44
|
+
break;
|
|
45
|
+
case 'microcms_get_content':
|
|
46
|
+
result = await handleGetContent(params);
|
|
47
|
+
break;
|
|
48
|
+
case 'microcms_create_content':
|
|
49
|
+
result = await handleCreateContent(params);
|
|
50
|
+
break;
|
|
51
|
+
case 'microcms_update_content':
|
|
52
|
+
result = await handleUpdateContent(params);
|
|
53
|
+
break;
|
|
54
|
+
case 'microcms_patch_content':
|
|
55
|
+
result = await handlePatchContent(params);
|
|
56
|
+
break;
|
|
57
|
+
case 'microcms_delete_content':
|
|
58
|
+
result = await handleDeleteContent(params);
|
|
59
|
+
break;
|
|
60
|
+
case 'microcms_get_media':
|
|
61
|
+
result = await handleGetMedia(params);
|
|
62
|
+
break;
|
|
63
|
+
case 'microcms_upload_media':
|
|
64
|
+
result = await handleUploadMedia(params);
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
content: [
|
|
71
|
+
{
|
|
72
|
+
type: 'text',
|
|
73
|
+
text: JSON.stringify(result, null, 2),
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
80
|
+
return {
|
|
81
|
+
content: [
|
|
82
|
+
{
|
|
83
|
+
type: 'text',
|
|
84
|
+
text: `Error: ${errorMessage}`,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
isError: true,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
export async function startServer() {
|
|
92
|
+
try {
|
|
93
|
+
// Validate configuration early to provide better error messages
|
|
94
|
+
const { parseConfig } = await import('./config.js');
|
|
95
|
+
parseConfig();
|
|
96
|
+
const transport = new StdioServerTransport();
|
|
97
|
+
await server.connect(transport);
|
|
98
|
+
console.error('microCMS MCP Server running on stdio');
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
if (error instanceof Error && error.message.includes('microCMS credentials')) {
|
|
102
|
+
console.error('Configuration Error:', error.message);
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async function main() {
|
|
109
|
+
await startServer();
|
|
110
|
+
}
|
|
111
|
+
// 直接実行された場合のみサーバーを起動
|
|
112
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
113
|
+
main().catch((error) => {
|
|
114
|
+
console.error('Fatal error in main():', error);
|
|
115
|
+
process.exit(1);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,mBAAmB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,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;QACpD,WAAW,EAAE,CAAC;QAEd,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC;YAC7E,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,WAAW,EAAE,CAAC;AACtB,CAAC;AAED,qBAAqB;AACrB,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACpD,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { ToolParameters } from '../types.js';
|
|
3
|
+
export declare const createContentTool: Tool;
|
|
4
|
+
export declare function handleCreateContent(params: ToolParameters): Promise<{
|
|
5
|
+
id: string;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=create-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-content.d.ts","sourceRoot":"","sources":["../../src/tools/create-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAyB,MAAM,aAAa,CAAC;AAEzE,eAAO,MAAM,iBAAiB,EAAE,IAyB/B,CAAC;AAEF,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,cAAc;;GAa/D"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { create } from '../client.js';
|
|
2
|
+
export const createContentTool = {
|
|
3
|
+
name: 'microcms_create_content',
|
|
4
|
+
description: 'Create new content in microCMS. Field type specifications: Image fields require URLs from the same microCMS service (e.g., "https://images.microcms-assets.io/assets/xxx/yyy/sample.png"), only the URL string is required. Multiple image fields use array format. Rich editor fields expect HTML strings. Date fields use ISO 8601 format. Select fields use arrays. Content reference fields use contentId strings or arrays for multiple references.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
endpoint: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Content type name (e.g., "blogs", "news")',
|
|
11
|
+
},
|
|
12
|
+
content: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
description: 'Content data to create (JSON object). Field formats: text="string", richEditor="<h1>HTML</h1>", image="https://images.microcms-assets.io/...", multipleImages=["url1","url2"], date="2020-04-23T14:32:38.163Z", select=["option1","option2"], contentReference="contentId" or ["id1","id2"].',
|
|
15
|
+
},
|
|
16
|
+
isDraft: {
|
|
17
|
+
type: 'boolean',
|
|
18
|
+
description: 'Save as draft',
|
|
19
|
+
},
|
|
20
|
+
contentId: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Specific content ID to assign',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: ['endpoint', 'content'],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export async function handleCreateContent(params) {
|
|
29
|
+
const { endpoint, content, ...options } = params;
|
|
30
|
+
if (!content) {
|
|
31
|
+
throw new Error('content is required');
|
|
32
|
+
}
|
|
33
|
+
const createOptions = {};
|
|
34
|
+
if (options.isDraft !== undefined)
|
|
35
|
+
createOptions.isDraft = options.isDraft;
|
|
36
|
+
if (options.contentId)
|
|
37
|
+
createOptions.contentId = options.contentId;
|
|
38
|
+
return await create(endpoint, content, createOptions);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=create-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-content.js","sourceRoot":"","sources":["../../src/tools/create-content.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,MAAM,CAAC,MAAM,iBAAiB,GAAS;IACrC,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,0bAA0b;IACvc,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2CAA2C;aACzD;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,8RAA8R;aAC5S;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,eAAe;aAC7B;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+BAA+B;aAC7C;SACF;QACD,QAAQ,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;KAClC;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,MAAsB;IAC9D,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC;IAEjD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,aAAa,GAA0B,EAAE,CAAC;IAEhD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS;QAAE,aAAa,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAC3E,IAAI,OAAO,CAAC,SAAS;QAAE,aAAa,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAEnE,OAAO,MAAM,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { ToolParameters } from '../types.js';
|
|
3
|
+
export declare const deleteContentTool: Tool;
|
|
4
|
+
export declare function handleDeleteContent(params: ToolParameters): Promise<{
|
|
5
|
+
message: string;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=delete-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-content.d.ts","sourceRoot":"","sources":["../../src/tools/delete-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,iBAAiB,EAAE,IAiB/B,CAAC;AAEF,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,cAAc;;GAS/D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { deleteContent } from '../client.js';
|
|
2
|
+
export const deleteContentTool = {
|
|
3
|
+
name: 'microcms_delete_content',
|
|
4
|
+
description: 'Delete content from microCMS',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
endpoint: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Content type name (e.g., "blogs", "news")',
|
|
11
|
+
},
|
|
12
|
+
contentId: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'Content ID to delete',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
required: ['endpoint', 'contentId'],
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export async function handleDeleteContent(params) {
|
|
21
|
+
const { endpoint, contentId } = params;
|
|
22
|
+
if (!contentId) {
|
|
23
|
+
throw new Error('contentId is required');
|
|
24
|
+
}
|
|
25
|
+
await deleteContent(endpoint, contentId);
|
|
26
|
+
return { message: `Content ${contentId} deleted successfully` };
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=delete-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-content.js","sourceRoot":"","sources":["../../src/tools/delete-content.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,CAAC,MAAM,iBAAiB,GAAS;IACrC,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,8BAA8B;IAC3C,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2CAA2C;aACzD;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sBAAsB;aACpC;SACF;QACD,QAAQ,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;KACpC;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,MAAsB;IAC9D,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAEvC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,aAAa,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACzC,OAAO,EAAE,OAAO,EAAE,WAAW,SAAS,uBAAuB,EAAE,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { ToolParameters } from '../types.js';
|
|
3
|
+
export declare const getContentTool: Tool;
|
|
4
|
+
export declare function handleGetContent(params: ToolParameters): Promise<import("../types.js").MicroCMSContent>;
|
|
5
|
+
//# sourceMappingURL=get-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-content.d.ts","sourceRoot":"","sources":["../../src/tools/get-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAC;AAEtE,eAAO,MAAM,cAAc,EAAE,IA+B5B,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,cAAc,kDAc5D"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { getListDetail } from '../client.js';
|
|
2
|
+
export const getContentTool = {
|
|
3
|
+
name: 'microcms_get_content',
|
|
4
|
+
description: 'Get a specific content from microCMS',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
endpoint: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Content type name (e.g., "blogs", "news")',
|
|
11
|
+
},
|
|
12
|
+
contentId: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'Content ID to retrieve',
|
|
15
|
+
},
|
|
16
|
+
draftKey: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'Draft key for preview',
|
|
19
|
+
},
|
|
20
|
+
fields: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Comma-separated list of fields to retrieve',
|
|
23
|
+
},
|
|
24
|
+
depth: {
|
|
25
|
+
type: 'number',
|
|
26
|
+
description: 'Depth of reference expansion (1-3)',
|
|
27
|
+
minimum: 1,
|
|
28
|
+
maximum: 3,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
required: ['endpoint', 'contentId'],
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
export async function handleGetContent(params) {
|
|
35
|
+
const { endpoint, contentId, ...options } = params;
|
|
36
|
+
if (!contentId) {
|
|
37
|
+
throw new Error('contentId is required');
|
|
38
|
+
}
|
|
39
|
+
const queries = {};
|
|
40
|
+
if (options.draftKey)
|
|
41
|
+
queries.draftKey = options.draftKey;
|
|
42
|
+
if (options.fields)
|
|
43
|
+
queries.fields = options.fields;
|
|
44
|
+
if (options.depth)
|
|
45
|
+
queries.depth = options.depth;
|
|
46
|
+
return await getListDetail(endpoint, contentId, queries);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=get-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-content.js","sourceRoot":"","sources":["../../src/tools/get-content.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,CAAC,MAAM,cAAc,GAAS;IAClC,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sCAAsC;IACnD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2CAA2C;aACzD;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,wBAAwB;aACtC;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uBAAuB;aACrC;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,4CAA4C;aAC1D;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oCAAoC;gBACjD,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,CAAC;aACX;SACF;QACD,QAAQ,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;KACpC;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAsB;IAC3D,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC;IAEnD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,OAAO,GAAuB,EAAE,CAAC;IAEvC,IAAI,OAAO,CAAC,QAAQ;QAAE,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAC1D,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IACpD,IAAI,OAAO,CAAC,KAAK;QAAE,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAEjD,OAAO,MAAM,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { ToolParameters } from '../types.js';
|
|
3
|
+
export declare const getListTool: Tool;
|
|
4
|
+
export declare function handleGetList(params: ToolParameters): Promise<import("../types.js").MicroCMSListResponse<import("../types.js").MicroCMSContent>>;
|
|
5
|
+
//# sourceMappingURL=get-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-list.d.ts","sourceRoot":"","sources":["../../src/tools/get-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAuB,MAAM,aAAa,CAAC;AAEvE,eAAO,MAAM,WAAW,EAAE,IAsDzB,CAAC;AAEF,wBAAsB,aAAa,CAAC,MAAM,EAAE,cAAc,8FAgBzD"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { getList } from '../client.js';
|
|
2
|
+
export const getListTool = {
|
|
3
|
+
name: 'microcms_get_list',
|
|
4
|
+
description: 'Get a list of contents from microCMS',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
endpoint: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Content type name (e.g., "blogs", "news")',
|
|
11
|
+
},
|
|
12
|
+
draftKey: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'Draft key for preview',
|
|
15
|
+
},
|
|
16
|
+
limit: {
|
|
17
|
+
type: 'number',
|
|
18
|
+
description: 'Number of contents to retrieve (1-100)',
|
|
19
|
+
minimum: 1,
|
|
20
|
+
maximum: 100,
|
|
21
|
+
},
|
|
22
|
+
offset: {
|
|
23
|
+
type: 'number',
|
|
24
|
+
description: 'Offset for pagination',
|
|
25
|
+
minimum: 0,
|
|
26
|
+
},
|
|
27
|
+
orders: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
description: 'Sort order (e.g., "-publishedAt" for descending)',
|
|
30
|
+
},
|
|
31
|
+
q: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
description: 'Full-text search query',
|
|
34
|
+
},
|
|
35
|
+
fields: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
description: 'Comma-separated list of fields to retrieve',
|
|
38
|
+
},
|
|
39
|
+
ids: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
description: 'Comma-separated list of content IDs',
|
|
42
|
+
},
|
|
43
|
+
filters: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
description: 'Filter conditions',
|
|
46
|
+
},
|
|
47
|
+
depth: {
|
|
48
|
+
type: 'number',
|
|
49
|
+
description: 'Depth of reference expansion (1-3)',
|
|
50
|
+
minimum: 1,
|
|
51
|
+
maximum: 3,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
required: ['endpoint'],
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
export async function handleGetList(params) {
|
|
58
|
+
const { endpoint, ...options } = params;
|
|
59
|
+
const queries = {};
|
|
60
|
+
if (options.draftKey)
|
|
61
|
+
queries.draftKey = options.draftKey;
|
|
62
|
+
if (options.limit)
|
|
63
|
+
queries.limit = options.limit;
|
|
64
|
+
if (options.offset)
|
|
65
|
+
queries.offset = options.offset;
|
|
66
|
+
if (options.orders)
|
|
67
|
+
queries.orders = options.orders;
|
|
68
|
+
if (options.q)
|
|
69
|
+
queries.q = options.q;
|
|
70
|
+
if (options.fields)
|
|
71
|
+
queries.fields = options.fields;
|
|
72
|
+
if (options.ids)
|
|
73
|
+
queries.ids = options.ids;
|
|
74
|
+
if (options.filters)
|
|
75
|
+
queries.filters = options.filters;
|
|
76
|
+
if (options.depth)
|
|
77
|
+
queries.depth = options.depth;
|
|
78
|
+
return await getList(endpoint, queries);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=get-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-list.js","sourceRoot":"","sources":["../../src/tools/get-list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,MAAM,CAAC,MAAM,WAAW,GAAS;IAC/B,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,sCAAsC;IACnD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2CAA2C;aACzD;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uBAAuB;aACrC;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,wCAAwC;gBACrD,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,GAAG;aACb;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uBAAuB;gBACpC,OA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,CAAC;IACpD,IAAI,OAAO,CAAC,GAAG;QAAE,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAC3C,IAAI,OAAO,CAAC,OAAO;QAAE,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACvD,IAAI,OAAO,CAAC,KAAK;QAAE,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAEjD,OAAO,MAAM,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { MediaToolParameters } from '../types.js';
|
|
3
|
+
export declare const getMediaTool: Tool;
|
|
4
|
+
export declare function handleGetMedia(params: MediaToolParameters): Promise<any>;
|
|
5
|
+
//# sourceMappingURL=get-media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-media.d.ts","sourceRoot":"","sources":["../../src/tools/get-media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,YAAY,EAAE,IA2B1B,CAAC;AAEF,wBAAsB,cAAc,CAAC,MAAM,EAAE,mBAAmB,gBAuB/D"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { microCMSConfig } from '../client.js';
|
|
2
|
+
export const getMediaTool = {
|
|
3
|
+
name: 'microcms_get_media',
|
|
4
|
+
description: 'Get media files from microCMS (Management API). Returns media information including URLs, dimensions for images. Supports pagination via token (15-second validity). Requires media retrieval permissions.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
limit: {
|
|
9
|
+
type: 'number',
|
|
10
|
+
description: 'Number of media to retrieve (max 100, default 10). Only valid on first request.',
|
|
11
|
+
minimum: 1,
|
|
12
|
+
maximum: 100,
|
|
13
|
+
},
|
|
14
|
+
imageOnly: {
|
|
15
|
+
type: 'boolean',
|
|
16
|
+
description: 'Set to true to retrieve only image files. Only valid on first request.',
|
|
17
|
+
},
|
|
18
|
+
fileName: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'Filter media by partial filename match (includes file extension)',
|
|
21
|
+
},
|
|
22
|
+
token: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'Continuation token for pagination (obtained from previous response, 15-second validity)',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
required: [],
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export async function handleGetMedia(params) {
|
|
31
|
+
const queryParams = new URLSearchParams();
|
|
32
|
+
if (params.limit)
|
|
33
|
+
queryParams.append('limit', params.limit.toString());
|
|
34
|
+
if (params.imageOnly)
|
|
35
|
+
queryParams.append('imageOnly', 'true');
|
|
36
|
+
if (params.fileName)
|
|
37
|
+
queryParams.append('fileName', params.fileName);
|
|
38
|
+
if (params.token)
|
|
39
|
+
queryParams.append('token', params.token);
|
|
40
|
+
const response = await fetch(`https://${microCMSConfig.serviceDomain}.microcms-management.io/api/v2/media?${queryParams}`, {
|
|
41
|
+
method: 'GET',
|
|
42
|
+
headers: {
|
|
43
|
+
'X-MICROCMS-API-KEY': microCMSConfig.apiKey,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
if (!response.ok) {
|
|
47
|
+
throw new Error(`Media retrieval failed: ${response.status} ${response.statusText}`);
|
|
48
|
+
}
|
|
49
|
+
return await response.json();
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=get-media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-media.js","sourceRoot":"","sources":["../../src/tools/get-media.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,MAAM,CAAC,MAAM,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C;IAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,2BAA2B,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IACvF,CAAC;IAED,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { ToolParameters } from '../types.js';
|
|
3
|
+
export declare const patchContentTool: Tool;
|
|
4
|
+
export declare function handlePatchContent(params: ToolParameters): Promise<{
|
|
5
|
+
id: string;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=patch-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch-content.d.ts","sourceRoot":"","sources":["../../src/tools/patch-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAyB,MAAM,aAAa,CAAC;AAEzE,eAAO,MAAM,gBAAgB,EAAE,IAyB9B,CAAC;AAEF,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,cAAc;;GAgB9D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { patch } from '../client.js';
|
|
2
|
+
export const patchContentTool = {
|
|
3
|
+
name: 'microcms_patch_content',
|
|
4
|
+
description: 'Partially update content in microCMS (PATCH). Field type specifications: Image fields require URLs from the same microCMS service (e.g., "https://images.microcms-assets.io/assets/xxx/yyy/sample.png"). Multiple image fields use array format. Rich editor fields expect HTML strings. Date fields use ISO 8601 format. Select fields use arrays. Content reference fields use contentId strings or arrays for multiple references.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
endpoint: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Content type name (e.g., "blogs", "news")',
|
|
11
|
+
},
|
|
12
|
+
contentId: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'Content ID to update',
|
|
15
|
+
},
|
|
16
|
+
content: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
description: 'Partial content data to update (JSON object). Field formats: text="string", richEditor="<h1>HTML</h1>", image="https://images.microcms-assets.io/...", multipleImages=["url1","url2"], date="2020-04-23T14:32:38.163Z", select=["option1","option2"], contentReference="contentId" or ["id1","id2"].',
|
|
19
|
+
},
|
|
20
|
+
isDraft: {
|
|
21
|
+
type: 'boolean',
|
|
22
|
+
description: 'Save as draft',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: ['endpoint', 'contentId', 'content'],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export async function handlePatchContent(params) {
|
|
29
|
+
const { endpoint, contentId, content, ...options } = params;
|
|
30
|
+
if (!contentId) {
|
|
31
|
+
throw new Error('contentId is required');
|
|
32
|
+
}
|
|
33
|
+
if (!content) {
|
|
34
|
+
throw new Error('content is required');
|
|
35
|
+
}
|
|
36
|
+
const updateOptions = {};
|
|
37
|
+
if (options.isDraft !== undefined)
|
|
38
|
+
updateOptions.isDraft = options.isDraft;
|
|
39
|
+
return await patch(endpoint, contentId, content, updateOptions);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=patch-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch-content.js","sourceRoot":"","sources":["../../src/tools/patch-content.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAGrC,MAAM,CAAC,MAAM,gBAAgB,GAAS;IACpC,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,uaAAua;IACpb,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2CAA2C;aACzD;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sBAAsB;aACpC;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sSAAsS;aACpT;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,eAAe;aAC7B;SACF;QACD,QAAQ,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC;KAC/C;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAsB;IAC7D,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC;IAE5D,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,aAAa,GAA0B,EAAE,CAAC;IAEhD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS;QAAE,aAAa,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAE3E,OAAO,MAAM,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { ToolParameters } from '../types.js';
|
|
3
|
+
export declare const updateContentTool: Tool;
|
|
4
|
+
export declare function handleUpdateContent(params: ToolParameters): Promise<{
|
|
5
|
+
id: string;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=update-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-content.d.ts","sourceRoot":"","sources":["../../src/tools/update-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAyB,MAAM,aAAa,CAAC;AAEzE,eAAO,MAAM,iBAAiB,EAAE,IAyB/B,CAAC;AAEF,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,cAAc;;GAgB/D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { update } from '../client.js';
|
|
2
|
+
export const updateContentTool = {
|
|
3
|
+
name: 'microcms_update_content',
|
|
4
|
+
description: 'Update content in microCMS (PUT - full update). Field type specifications: Image fields require URLs from the same microCMS service (e.g., "https://images.microcms-assets.io/assets/xxx/yyy/sample.png"). Multiple image fields use array format. Rich editor fields expect HTML strings. Date fields use ISO 8601 format. Select fields use arrays. Content reference fields use contentId strings or arrays for multiple references.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
endpoint: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Content type name (e.g., "blogs", "news")',
|
|
11
|
+
},
|
|
12
|
+
contentId: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'Content ID to update',
|
|
15
|
+
},
|
|
16
|
+
content: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
description: 'Content data to update (JSON object). Field formats: text="string", richEditor="<h1>HTML</h1>", image="https://images.microcms-assets.io/...", multipleImages=["url1","url2"], date="2020-04-23T14:32:38.163Z", select=["option1","option2"], contentReference="contentId" or ["id1","id2"].',
|
|
19
|
+
},
|
|
20
|
+
isDraft: {
|
|
21
|
+
type: 'boolean',
|
|
22
|
+
description: 'Save as draft',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: ['endpoint', 'contentId', 'content'],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export async function handleUpdateContent(params) {
|
|
29
|
+
const { endpoint, contentId, content, ...options } = params;
|
|
30
|
+
if (!contentId) {
|
|
31
|
+
throw new Error('contentId is required');
|
|
32
|
+
}
|
|
33
|
+
if (!content) {
|
|
34
|
+
throw new Error('content is required');
|
|
35
|
+
}
|
|
36
|
+
const updateOptions = {};
|
|
37
|
+
if (options.isDraft !== undefined)
|
|
38
|
+
updateOptions.isDraft = options.isDraft;
|
|
39
|
+
return await update(endpoint, contentId, content, updateOptions);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=update-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-content.js","sourceRoot":"","sources":["../../src/tools/update-content.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,MAAM,CAAC,MAAM,iBAAiB,GAAS;IACrC,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,yaAAya;IACtb,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2CAA2C;aACzD;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sBAAsB;aACpC;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,8RAA8R;aAC5S;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,eAAe;aAC7B;SACF;QACD,QAAQ,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC;KAC/C;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,MAAsB;IAC9D,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC;IAE5D,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,aAAa,GAA0B,EAAE,CAAC;IAEhD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS;QAAE,aAAa,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAE3E,OAAO,MAAM,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { MediaToolParameters } from '../types.js';
|
|
3
|
+
export declare const uploadMediaTool: Tool;
|
|
4
|
+
export declare function handleUploadMedia(params: MediaToolParameters): Promise<{
|
|
5
|
+
url: string;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=upload-media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-media.d.ts","sourceRoot":"","sources":["../../src/tools/upload-media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,eAAe,EAAE,IAgC7B,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,mBAAmB;;GAwClE"}
|