Skip to content

Commit 8b665f6

Browse files
committed
manifest.jsonのバージョンを0.3.1から0.3.3に更新し、説明を日本語に変更しました。また、サーバーのツールに新しいコンテンツ作成および更新機能を追加しました。
1 parent 3bff131 commit 8b665f6

File tree

8 files changed

+195
-2
lines changed

8 files changed

+195
-2
lines changed

assets/icon.png

3.04 KB
Loading

manifest.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"dxt_version": "0.1",
33
"name": "microcms-mcp-server",
4-
"version": "0.3.1",
5-
"description": "microCMS MCP Server - A Model Context Protocol server for microCMS API",
4+
"version": "0.3.3",
5+
"description": "microCMSのMCP Serverです。LLMから直接コンテンツの取得や入稿ができます。",
6+
"icon": "assets/icon.png",
67
"author": {
78
"name": "himaratsu",
89
"url": "https://github.com/himaratsu"

microcms-mcp-server.dxt

5.17 KB
Binary file not shown.

src/server.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import {
88
import { getListTool, handleGetList } from './tools/get-list.js';
99
import { getContentTool, handleGetContent } from './tools/get-content.js';
1010
import { createContentTool, handleCreateContent } from './tools/create-content.js';
11+
import { createContentPublishedTool, handleCreateContentPublished } from './tools/create-content-published.js';
12+
import { createContentDraftTool, handleCreateContentDraft } from './tools/create-content-draft.js';
1113
import { updateContentTool, handleUpdateContent } from './tools/update-content.js';
14+
import { updateContentPublishedTool, handleUpdateContentPublished } from './tools/update-content-published.js';
15+
import { updateContentDraftTool, handleUpdateContentDraft } from './tools/update-content-draft.js';
1216
import { patchContentTool, handlePatchContent } from './tools/patch-content.js';
1317
import { deleteContentTool, handleDeleteContent } from './tools/delete-content.js';
1418
import { getMediaTool, handleGetMedia } from './tools/get-media.js';
@@ -34,7 +38,11 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
3438
getListTool,
3539
getContentTool,
3640
createContentTool,
41+
createContentPublishedTool,
42+
createContentDraftTool,
3743
updateContentTool,
44+
updateContentPublishedTool,
45+
updateContentDraftTool,
3846
patchContentTool,
3947
deleteContentTool,
4048
getMediaTool,
@@ -60,9 +68,21 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
6068
case 'microcms_create_content':
6169
result = await handleCreateContent(params);
6270
break;
71+
case 'microcms_create_content_published':
72+
result = await handleCreateContentPublished(params);
73+
break;
74+
case 'microcms_create_content_draft':
75+
result = await handleCreateContentDraft(params);
76+
break;
6377
case 'microcms_update_content':
6478
result = await handleUpdateContent(params);
6579
break;
80+
case 'microcms_update_content_published':
81+
result = await handleUpdateContentPublished(params);
82+
break;
83+
case 'microcms_update_content_draft':
84+
result = await handleUpdateContentDraft(params);
85+
break;
6686
case 'microcms_patch_content':
6787
result = await handlePatchContent(params);
6888
break;

src/tools/create-content-draft.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
2+
import { create } from '../client.js';
3+
import type { ToolParameters, MicroCMSCreateOptions } from '../types.js';
4+
5+
export const createContentDraftTool: Tool = {
6+
name: 'microcms_create_content_draft',
7+
description: 'Create new content in microCMS as draft. 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.',
8+
inputSchema: {
9+
type: 'object',
10+
properties: {
11+
endpoint: {
12+
type: 'string',
13+
description: 'Content type name (e.g., "blogs", "news")',
14+
},
15+
content: {
16+
type: 'object',
17+
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"].',
18+
},
19+
contentId: {
20+
type: 'string',
21+
description: 'Specific content ID to assign',
22+
},
23+
},
24+
required: ['endpoint', 'content'],
25+
},
26+
};
27+
28+
export async function handleCreateContentDraft(params: ToolParameters) {
29+
const { endpoint, content, ...options } = params;
30+
31+
if (!content) {
32+
throw new Error('content is required');
33+
}
34+
35+
const createOptions: MicroCMSCreateOptions = {
36+
isDraft: true, // Always save as draft
37+
};
38+
39+
if (options.contentId) createOptions.contentId = options.contentId;
40+
41+
return await create(endpoint, content, createOptions);
42+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
2+
import { create } from '../client.js';
3+
import type { ToolParameters, MicroCMSCreateOptions } from '../types.js';
4+
5+
export const createContentPublishedTool: Tool = {
6+
name: 'microcms_create_content_published',
7+
description: 'Create new content in microCMS and publish it immediately. 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.',
8+
inputSchema: {
9+
type: 'object',
10+
properties: {
11+
endpoint: {
12+
type: 'string',
13+
description: 'Content type name (e.g., "blogs", "news")',
14+
},
15+
content: {
16+
type: 'object',
17+
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"].',
18+
},
19+
contentId: {
20+
type: 'string',
21+
description: 'Specific content ID to assign',
22+
},
23+
},
24+
required: ['endpoint', 'content'],
25+
},
26+
};
27+
28+
export async function handleCreateContentPublished(params: ToolParameters) {
29+
const { endpoint, content, ...options } = params;
30+
31+
if (!content) {
32+
throw new Error('content is required');
33+
}
34+
35+
const createOptions: MicroCMSCreateOptions = {
36+
isDraft: false, // Always publish
37+
};
38+
39+
if (options.contentId) createOptions.contentId = options.contentId;
40+
41+
return await create(endpoint, content, createOptions);
42+
}

src/tools/update-content-draft.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
2+
import { update } from '../client.js';
3+
import type { ToolParameters, MicroCMSUpdateOptions } from '../types.js';
4+
5+
export const updateContentDraftTool: Tool = {
6+
name: 'microcms_update_content_draft',
7+
description: 'Update content in microCMS (PUT - full update) as draft. 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.',
8+
inputSchema: {
9+
type: 'object',
10+
properties: {
11+
endpoint: {
12+
type: 'string',
13+
description: 'Content type name (e.g., "blogs", "news")',
14+
},
15+
contentId: {
16+
type: 'string',
17+
description: 'Content ID to update',
18+
},
19+
content: {
20+
type: 'object',
21+
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"].',
22+
},
23+
},
24+
required: ['endpoint', 'contentId', 'content'],
25+
},
26+
};
27+
28+
export async function handleUpdateContentDraft(params: ToolParameters) {
29+
const { endpoint, contentId, content } = params;
30+
31+
if (!contentId) {
32+
throw new Error('contentId is required');
33+
}
34+
35+
if (!content) {
36+
throw new Error('content is required');
37+
}
38+
39+
const updateOptions: MicroCMSUpdateOptions = {
40+
isDraft: true, // Always save as draft
41+
};
42+
43+
return await update(endpoint, contentId, content, updateOptions);
44+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
2+
import { update } from '../client.js';
3+
import type { ToolParameters, MicroCMSUpdateOptions } from '../types.js';
4+
5+
export const updateContentPublishedTool: Tool = {
6+
name: 'microcms_update_content_published',
7+
description: 'Update content in microCMS (PUT - full update) and publish it immediately. 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.',
8+
inputSchema: {
9+
type: 'object',
10+
properties: {
11+
endpoint: {
12+
type: 'string',
13+
description: 'Content type name (e.g., "blogs", "news")',
14+
},
15+
contentId: {
16+
type: 'string',
17+
description: 'Content ID to update',
18+
},
19+
content: {
20+
type: 'object',
21+
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"].',
22+
},
23+
},
24+
required: ['endpoint', 'contentId', 'content'],
25+
},
26+
};
27+
28+
export async function handleUpdateContentPublished(params: ToolParameters) {
29+
const { endpoint, contentId, content } = params;
30+
31+
if (!contentId) {
32+
throw new Error('contentId is required');
33+
}
34+
35+
if (!content) {
36+
throw new Error('content is required');
37+
}
38+
39+
const updateOptions: MicroCMSUpdateOptions = {
40+
isDraft: false, // Always publish
41+
};
42+
43+
return await update(endpoint, contentId, content, updateOptions);
44+
}

0 commit comments

Comments
 (0)