owner-clone-ai-mcp 1.0.0 → 1.2.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.
Files changed (2) hide show
  1. package/index.js +258 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -30,9 +30,11 @@ async function callApi(path, options = {}) {
30
30
 
31
31
  // ── ツール定義 ─────────────────────────────────────────────────
32
32
  const TOOLS = [
33
+ // 読み取り専用ツール
33
34
  {
34
35
  name: 'search_knowledge',
35
36
  description: 'Owner Clone AIのナレッジベースを検索します。セマンティック検索(意味検索)とキーワード検索を使用します。',
37
+ annotations: { readOnlyHint: true },
36
38
  inputSchema: {
37
39
  type: 'object',
38
40
  properties: {
@@ -45,6 +47,7 @@ const TOOLS = [
45
47
  {
46
48
  name: 'list_knowledge_items',
47
49
  description: 'Owner Clone AIに登録されたナレッジの一覧を取得します。フォルダやカテゴリで絞り込み可能。',
50
+ annotations: { readOnlyHint: true },
48
51
  inputSchema: {
49
52
  type: 'object',
50
53
  properties: {
@@ -58,6 +61,7 @@ const TOOLS = [
58
61
  {
59
62
  name: 'get_knowledge_item',
60
63
  description: '指定したIDのナレッジの全文を取得します。',
64
+ annotations: { readOnlyHint: true },
61
65
  inputSchema: {
62
66
  type: 'object',
63
67
  properties: {
@@ -69,16 +73,19 @@ const TOOLS = [
69
73
  {
70
74
  name: 'list_knowledge_folders',
71
75
  description: 'ナレッジのフォルダ一覧を取得します。',
76
+ annotations: { readOnlyHint: true },
72
77
  inputSchema: { type: 'object', properties: {} },
73
78
  },
74
79
  {
75
80
  name: 'list_agent_presets',
76
81
  description: 'AIパートナー(エージェントプリセット)の一覧を取得します。システムプリセットも含みます。ナレッジ内容は含みません。',
82
+ annotations: { readOnlyHint: true },
77
83
  inputSchema: { type: 'object', properties: {} },
78
84
  },
79
85
  {
80
86
  name: 'get_agent_preset',
81
87
  description: '指定したIDのAIパートナーの詳細(システムプロンプト・ルール)を取得します。セキュリティ上、紐づくナレッジの内容は返しません。',
88
+ annotations: { readOnlyHint: true },
82
89
  inputSchema: {
83
90
  type: 'object',
84
91
  properties: {
@@ -87,6 +94,146 @@ const TOOLS = [
87
94
  required: ['id'],
88
95
  },
89
96
  },
97
+ // AIパートナー関連(読み取り)
98
+ {
99
+ name: 'load_agent',
100
+ description: 'AIパートナーの設定(システムプロンプト・ルール・対話フロー)と関連ナレッジを取得します。AIパートナーに設定されたナレッジ参照モード(semantic/full_text/two_step_rag/smart_full_text)でナレッジを検索し、Claude Codeがそのパートナーの人格・知識で回答できるようにします。追加のAI課金は発生しません。',
101
+ annotations: { readOnlyHint: true },
102
+ inputSchema: {
103
+ type: 'object',
104
+ properties: {
105
+ id: { type: 'string', description: 'AIパートナーのID(list_agent_presetsで確認)' },
106
+ query: { type: 'string', description: 'ユーザーの質問・依頼内容(ナレッジ検索に使用。省略時は全ナレッジを返す)' },
107
+ },
108
+ required: ['id'],
109
+ },
110
+ },
111
+ // ワークフロー関連
112
+ {
113
+ name: 'list_workflows',
114
+ description: 'ワークフロー一覧を取得します。',
115
+ annotations: { readOnlyHint: true },
116
+ inputSchema: { type: 'object', properties: {} },
117
+ },
118
+ {
119
+ name: 'trigger_workflow',
120
+ description: '指定したワークフローを起動します。【書き込み権限付きキーが必要】ワークフローは非同期で実行されます。',
121
+ annotations: { destructiveHint: false, idempotentHint: false },
122
+ inputSchema: {
123
+ type: 'object',
124
+ properties: {
125
+ id: { type: 'string', description: '起動するワークフローのID' },
126
+ input: { type: 'object', description: 'ワークフローへの入力データ(省略可)' },
127
+ },
128
+ required: ['id'],
129
+ },
130
+ },
131
+ // チャットボット関連
132
+ {
133
+ name: 'list_chatbots',
134
+ description: 'チャットボット一覧を取得します。',
135
+ annotations: { readOnlyHint: true },
136
+ inputSchema: { type: 'object', properties: {} },
137
+ },
138
+ {
139
+ name: 'get_chatbot',
140
+ description: '指定したチャットボットの設定詳細(システムプロンプト・ルール・ナレッジ参照モード等)を取得します。',
141
+ annotations: { readOnlyHint: true },
142
+ inputSchema: {
143
+ type: 'object',
144
+ properties: {
145
+ id: { type: 'string', description: 'チャットボットのID' },
146
+ },
147
+ required: ['id'],
148
+ },
149
+ },
150
+ // AIパートナー書き込み(読み書き可能キーが必要)
151
+ {
152
+ name: 'create_agent_preset',
153
+ description: 'AIパートナーを新規作成します。【書き込み権限付きキーが必要】',
154
+ annotations: { destructiveHint: false, idempotentHint: false },
155
+ inputSchema: {
156
+ type: 'object',
157
+ properties: {
158
+ name: { type: 'string', description: 'AIパートナー名' },
159
+ description: { type: 'string', description: '説明(省略可)' },
160
+ base_prompt: { type: 'string', description: 'システムプロンプト(人格・役割定義)' },
161
+ rules_allow: { type: 'string', description: '許可ルール(省略可)' },
162
+ rules_deny: { type: 'string', description: '禁止ルール(省略可)' },
163
+ sales_flow: { type: 'string', description: '対話フロー・セールスフロー(省略可)' },
164
+ knowledge: { type: 'string', description: '直接記述のナレッジテキスト(省略可)' },
165
+ knowledge_item_ids: { type: 'array', items: { type: 'string' }, description: '紐づけるナレッジIDの配列(省略可)' },
166
+ },
167
+ required: ['name'],
168
+ },
169
+ },
170
+ {
171
+ name: 'update_agent_preset',
172
+ description: '既存のAIパートナーを更新します。【書き込み権限付きキーが必要】システムプリセットは編集不可。',
173
+ annotations: { destructiveHint: false, idempotentHint: true },
174
+ inputSchema: {
175
+ type: 'object',
176
+ properties: {
177
+ id: { type: 'string', description: '更新するAIパートナーのID' },
178
+ name: { type: 'string', description: '新しい名前(省略時は変更なし)' },
179
+ description: { type: 'string', description: '新しい説明(省略時は変更なし)' },
180
+ base_prompt: { type: 'string', description: '新しいシステムプロンプト(省略時は変更なし)' },
181
+ rules_allow: { type: 'string', description: '新しい許可ルール(省略時は変更なし)' },
182
+ rules_deny: { type: 'string', description: '新しい禁止ルール(省略時は変更なし)' },
183
+ sales_flow: { type: 'string', description: '新しい対話フロー(省略時は変更なし)' },
184
+ knowledge: { type: 'string', description: '新しい直接記述ナレッジ(省略時は変更なし)' },
185
+ knowledge_item_ids: { type: 'array', items: { type: 'string' }, description: '新しいナレッジID配列(省略時は変更なし)' },
186
+ },
187
+ required: ['id'],
188
+ },
189
+ },
190
+ // 書き込みツール(読み書き可能キーが必要)
191
+ {
192
+ name: 'create_knowledge',
193
+ description: 'Owner Clone AIにナレッジを新規作成します。【書き込み権限付きキーが必要】作成後、自動的にベクトル化されセマンティック検索に対応します。',
194
+ annotations: { destructiveHint: false, idempotentHint: false },
195
+ inputSchema: {
196
+ type: 'object',
197
+ properties: {
198
+ title: { type: 'string', description: 'ナレッジのタイトル' },
199
+ text_content: { type: 'string', description: 'ナレッジの本文テキスト' },
200
+ category: {
201
+ type: 'string',
202
+ description: 'カテゴリ(product / profile / testimonial / persona / tone / other)',
203
+ enum: ['product', 'profile', 'testimonial', 'persona', 'tone', 'other'],
204
+ },
205
+ folder_id: { type: 'string', description: 'フォルダID(省略可)' },
206
+ },
207
+ required: ['title', 'text_content'],
208
+ },
209
+ },
210
+ {
211
+ name: 'update_knowledge',
212
+ description: '既存のナレッジを更新します。【書き込み権限付きキーが必要】本文を変更した場合は自動的に再ベクトル化されます。',
213
+ annotations: { destructiveHint: false, idempotentHint: true },
214
+ inputSchema: {
215
+ type: 'object',
216
+ properties: {
217
+ id: { type: 'string', description: '更新するナレッジのID' },
218
+ title: { type: 'string', description: '新しいタイトル(省略時は変更なし)' },
219
+ text_content: { type: 'string', description: '新しい本文(省略時は変更なし)' },
220
+ category: { type: 'string', description: '新しいカテゴリ(省略時は変更なし)' },
221
+ },
222
+ required: ['id'],
223
+ },
224
+ },
225
+ {
226
+ name: 'delete_knowledge',
227
+ description: '指定したナレッジを削除します。【書き込み権限付きキーが必要】この操作は元に戻せません。',
228
+ annotations: { destructiveHint: true, idempotentHint: false },
229
+ inputSchema: {
230
+ type: 'object',
231
+ properties: {
232
+ id: { type: 'string', description: '削除するナレッジのID' },
233
+ },
234
+ required: ['id'],
235
+ },
236
+ },
90
237
  ];
91
238
 
92
239
  // ── ツール実行 ─────────────────────────────────────────────────
@@ -155,6 +302,116 @@ async function executeTool(name, args) {
155
302
  return parts.join('\n');
156
303
  }
157
304
 
305
+ case 'load_agent': {
306
+ const params = new URLSearchParams();
307
+ if (args.query) params.set('query', args.query);
308
+ const data = await callApi(`/agent-presets/${args.id}/context?${params}`);
309
+ return data.context;
310
+ }
311
+
312
+ case 'list_workflows': {
313
+ const data = await callApi('/workflows');
314
+ if (!data.workflows || data.workflows.length === 0) return 'ワークフローが登録されていません。';
315
+ const lines = data.workflows.map(w =>
316
+ `- [${w.id}] ${w.title}${w.is_active ? '' : ' (無効)'}\n ${w.description || ''}`
317
+ );
318
+ return `ワークフロー一覧(${data.workflows.length}件):\n\n${lines.join('\n')}`;
319
+ }
320
+
321
+ case 'trigger_workflow': {
322
+ const data = await callApi(`/workflows/${args.id}/trigger`, {
323
+ method: 'POST',
324
+ body: JSON.stringify({ input: args.input || {} }),
325
+ });
326
+ return `✅ ワークフロー「${data.workflow_title}」を起動しました。\n実行ID: ${data.run_id}\nステータス: ${data.status}`;
327
+ }
328
+
329
+ case 'list_chatbots': {
330
+ const data = await callApi('/chatbots');
331
+ if (!data.chatbots || data.chatbots.length === 0) return 'チャットボットが登録されていません。';
332
+ const lines = data.chatbots.map(c =>
333
+ `- [${c.id}] ${c.name} (モード: ${c.chatbot_mode || 'standard'}) 作成: ${c.created_at?.slice(0, 10)}`
334
+ );
335
+ return `チャットボット一覧(${data.chatbots.length}件):\n\n${lines.join('\n')}`;
336
+ }
337
+
338
+ case 'get_chatbot': {
339
+ const data = await callApi(`/chatbots/${args.id}`);
340
+ const mode = data.knowledge_smart_full_text ? 'smart_full_text'
341
+ : !data.knowledge_semantic_search ? 'full_text'
342
+ : data.knowledge_query_rewrite ? 'two_step_rag'
343
+ : 'semantic';
344
+ const parts = [
345
+ `名前: ${data.name}`,
346
+ data.header_title ? `タイトル: ${data.header_title}` : '',
347
+ `モード: ${data.chatbot_mode || 'standard'}`,
348
+ `ナレッジ参照: ${mode}`,
349
+ data.system_prompt ? `\n--- システムプロンプト ---\n${data.system_prompt}` : '',
350
+ data.rules_allow ? `\n--- 許可ルール ---\n${data.rules_allow}` : '',
351
+ data.rules_deny ? `\n--- 禁止ルール ---\n${data.rules_deny}` : '',
352
+ data.sales_flow ? `\n--- 対話フロー ---\n${data.sales_flow}` : '',
353
+ ].filter(Boolean);
354
+ return parts.join('\n');
355
+ }
356
+
357
+ case 'create_agent_preset': {
358
+ const data = await callApi('/agent-presets', {
359
+ method: 'POST',
360
+ body: JSON.stringify({
361
+ name: args.name,
362
+ description: args.description,
363
+ base_prompt: args.base_prompt,
364
+ rules_allow: args.rules_allow,
365
+ rules_deny: args.rules_deny,
366
+ sales_flow: args.sales_flow,
367
+ knowledge: args.knowledge,
368
+ knowledge_item_ids: args.knowledge_item_ids,
369
+ }),
370
+ });
371
+ return `✅ ${data.message}\nID: ${data.id}\n名前: ${data.name}\n作成日時: ${data.created_at}`;
372
+ }
373
+
374
+ case 'update_agent_preset': {
375
+ const body = {};
376
+ const fields = ['name','description','base_prompt','rules_allow','rules_deny','sales_flow','knowledge','knowledge_item_ids'];
377
+ fields.forEach(f => { if (args[f] !== undefined) body[f] = args[f]; });
378
+ const data = await callApi(`/agent-presets/${args.id}`, {
379
+ method: 'PATCH',
380
+ body: JSON.stringify(body),
381
+ });
382
+ return `✅ ${data.message}\nID: ${data.id}\n名前: ${data.name}\n更新日時: ${data.updated_at}`;
383
+ }
384
+
385
+ case 'create_knowledge': {
386
+ const data = await callApi('/knowledge', {
387
+ method: 'POST',
388
+ body: JSON.stringify({
389
+ title: args.title,
390
+ text_content: args.text_content,
391
+ category: args.category || 'other',
392
+ folder_id: args.folder_id,
393
+ }),
394
+ });
395
+ return `✅ ${data.message}\nID: ${data.id}\nタイトル: ${data.title}\nカテゴリ: ${data.category}\n作成日時: ${data.created_at}`;
396
+ }
397
+
398
+ case 'update_knowledge': {
399
+ const body = {};
400
+ if (args.title) body.title = args.title;
401
+ if (args.text_content) body.text_content = args.text_content;
402
+ if (args.category) body.category = args.category;
403
+ const data = await callApi(`/knowledge/${args.id}`, {
404
+ method: 'PATCH',
405
+ body: JSON.stringify(body),
406
+ });
407
+ return `✅ ${data.message}\nID: ${data.id}\nタイトル: ${data.title}\n更新日時: ${data.updated_at}`;
408
+ }
409
+
410
+ case 'delete_knowledge': {
411
+ const data = await callApi(`/knowledge/${args.id}`, { method: 'DELETE' });
412
+ return `✅ ${data.message}\n削除したナレッジ: ${data.deleted.title} (ID: ${data.deleted.id})`;
413
+ }
414
+
158
415
  default:
159
416
  throw new Error(`Unknown tool: ${name}`);
160
417
  }
@@ -163,7 +420,7 @@ async function executeTool(name, args) {
163
420
  // ── MCPサーバー起動 ────────────────────────────────────────────
164
421
  async function main() {
165
422
  const server = new Server(
166
- { name: 'owner-clone-ai', version: '1.0.0' },
423
+ { name: 'owner-clone-ai', version: '1.2.0' },
167
424
  { capabilities: { tools: {} } }
168
425
  );
169
426
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owner-clone-ai-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "MCP server for Owner Clone AI — exposes knowledge and agent presets to Claude Code",
5
5
  "main": "index.js",
6
6
  "bin": {