owner-clone-ai-mcp 1.1.0 → 1.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/index.js +341 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -94,6 +94,199 @@ const TOOLS = [
|
|
|
94
94
|
required: ['id'],
|
|
95
95
|
},
|
|
96
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_workflow',
|
|
193
|
+
description: 'ワークフローを新規作成します。【書き込み権限付きキーが必要】steps にエージェントタスク・アクションステップを配列で指定します。',
|
|
194
|
+
annotations: { destructiveHint: false, idempotentHint: false },
|
|
195
|
+
inputSchema: {
|
|
196
|
+
type: 'object',
|
|
197
|
+
properties: {
|
|
198
|
+
title: { type: 'string', description: 'ワークフロー名' },
|
|
199
|
+
description: { type: 'string', description: '説明(省略可)' },
|
|
200
|
+
steps: {
|
|
201
|
+
type: 'array',
|
|
202
|
+
description: 'ステップ配列。各ステップは {type:"agent_task"|"action", label, ...} の形式',
|
|
203
|
+
items: { type: 'object' },
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
required: ['title'],
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: 'update_workflow',
|
|
211
|
+
description: '既存のワークフローを更新します。【書き込み権限付きキーが必要】',
|
|
212
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
213
|
+
inputSchema: {
|
|
214
|
+
type: 'object',
|
|
215
|
+
properties: {
|
|
216
|
+
id: { type: 'string', description: 'ワークフローID' },
|
|
217
|
+
title: { type: 'string', description: '新しいタイトル(省略時は変更なし)' },
|
|
218
|
+
description: { type: 'string', description: '新しい説明(省略時は変更なし)' },
|
|
219
|
+
steps: { type: 'array', description: '新しいステップ配列(省略時は変更なし)', items: { type: 'object' } },
|
|
220
|
+
is_active: { type: 'boolean', description: '有効/無効(省略時は変更なし)' },
|
|
221
|
+
},
|
|
222
|
+
required: ['id'],
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
// チャットボット書き込み(読み書き可能キーが必要)
|
|
226
|
+
{
|
|
227
|
+
name: 'create_chatbot',
|
|
228
|
+
description: 'チャットボットを新規作成します。【書き込み権限付きキーが必要】widget_token は自動生成されます。',
|
|
229
|
+
annotations: { destructiveHint: false, idempotentHint: false },
|
|
230
|
+
inputSchema: {
|
|
231
|
+
type: 'object',
|
|
232
|
+
properties: {
|
|
233
|
+
name: { type: 'string', description: 'チャットボット名' },
|
|
234
|
+
system_prompt: { type: 'string', description: 'システムプロンプト(AIの役割・人格定義)' },
|
|
235
|
+
initial_message: { type: 'string', description: '最初のメッセージ(省略可)' },
|
|
236
|
+
rules_allow: { type: 'string', description: '許可ルール(省略可)' },
|
|
237
|
+
rules_deny: { type: 'string', description: '禁止ルール(省略可)' },
|
|
238
|
+
sales_flow: { type: 'string', description: '対話フロー・セールスフロー(省略可)' },
|
|
239
|
+
quick_replies: { type: 'string', description: 'クイック返信ボタン(改行区切り、省略可)' },
|
|
240
|
+
},
|
|
241
|
+
required: ['name'],
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
name: 'update_chatbot',
|
|
246
|
+
description: '既存のチャットボットを更新します。【書き込み権限付きキーが必要】',
|
|
247
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
248
|
+
inputSchema: {
|
|
249
|
+
type: 'object',
|
|
250
|
+
properties: {
|
|
251
|
+
id: { type: 'string', description: 'チャットボットID' },
|
|
252
|
+
name: { type: 'string', description: '新しい名前(省略時は変更なし)' },
|
|
253
|
+
system_prompt: { type: 'string', description: '新しいシステムプロンプト(省略時は変更なし)' },
|
|
254
|
+
initial_message: { type: 'string', description: '新しい最初のメッセージ(省略時は変更なし)' },
|
|
255
|
+
rules_allow: { type: 'string', description: '新しい許可ルール(省略時は変更なし)' },
|
|
256
|
+
rules_deny: { type: 'string', description: '新しい禁止ルール(省略時は変更なし)' },
|
|
257
|
+
sales_flow: { type: 'string', description: '新しい対話フロー(省略時は変更なし)' },
|
|
258
|
+
quick_replies: { type: 'string', description: '新しいクイック返信(改行区切り、省略時は変更なし)' },
|
|
259
|
+
},
|
|
260
|
+
required: ['id'],
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
// Claude Code月額でワークフロー実行(読み書き可能キーが必要)
|
|
264
|
+
{
|
|
265
|
+
name: 'get_workflow_plan',
|
|
266
|
+
description: 'ワークフローのステップ定義を全取得します。agent_task ステップは Claude Code が load_agent + ナレッジを使って自力で推論し、action ステップは execute_workflow_action でバックエンドが実行します。',
|
|
267
|
+
annotations: { readOnlyHint: true },
|
|
268
|
+
inputSchema: {
|
|
269
|
+
type: 'object',
|
|
270
|
+
properties: {
|
|
271
|
+
id: { type: 'string', description: 'ワークフローID' },
|
|
272
|
+
},
|
|
273
|
+
required: ['id'],
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: 'execute_workflow_action',
|
|
278
|
+
description: 'ワークフローのアクションステップ(send_chatwork / approval)をバックエンドで実行します。【書き込み権限付きキーが必要】Claude Code が AI 推論した結果(previous_output)を渡してください。',
|
|
279
|
+
annotations: { destructiveHint: false, idempotentHint: false },
|
|
280
|
+
inputSchema: {
|
|
281
|
+
type: 'object',
|
|
282
|
+
properties: {
|
|
283
|
+
id: { type: 'string', description: 'ワークフローID' },
|
|
284
|
+
step_index: { type: 'number', description: '実行するステップのインデックス(0始まり)' },
|
|
285
|
+
previous_output: { type: 'string', description: '直前の AI 推論結果(アクションメッセージとして使用)' },
|
|
286
|
+
},
|
|
287
|
+
required: ['id', 'step_index'],
|
|
288
|
+
},
|
|
289
|
+
},
|
|
97
290
|
// 書き込みツール(読み書き可能キーが必要)
|
|
98
291
|
{
|
|
99
292
|
name: 'create_knowledge',
|
|
@@ -209,6 +402,86 @@ async function executeTool(name, args) {
|
|
|
209
402
|
return parts.join('\n');
|
|
210
403
|
}
|
|
211
404
|
|
|
405
|
+
case 'load_agent': {
|
|
406
|
+
const params = new URLSearchParams();
|
|
407
|
+
if (args.query) params.set('query', args.query);
|
|
408
|
+
const data = await callApi(`/agent-presets/${args.id}/context?${params}`);
|
|
409
|
+
return data.context;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
case 'list_workflows': {
|
|
413
|
+
const data = await callApi('/workflows');
|
|
414
|
+
if (!data.workflows || data.workflows.length === 0) return 'ワークフローが登録されていません。';
|
|
415
|
+
const lines = data.workflows.map(w =>
|
|
416
|
+
`- [${w.id}] ${w.title}${w.is_active ? '' : ' (無効)'}\n ${w.description || ''}`
|
|
417
|
+
);
|
|
418
|
+
return `ワークフロー一覧(${data.workflows.length}件):\n\n${lines.join('\n')}`;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
case 'trigger_workflow': {
|
|
422
|
+
const data = await callApi(`/workflows/${args.id}/trigger`, {
|
|
423
|
+
method: 'POST',
|
|
424
|
+
body: JSON.stringify({ input: args.input || {} }),
|
|
425
|
+
});
|
|
426
|
+
return `✅ ワークフロー「${data.workflow_title}」を起動しました。\n実行ID: ${data.run_id}\nステータス: ${data.status}`;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
case 'list_chatbots': {
|
|
430
|
+
const data = await callApi('/chatbots');
|
|
431
|
+
if (!data.chatbots || data.chatbots.length === 0) return 'チャットボットが登録されていません。';
|
|
432
|
+
const lines = data.chatbots.map(c =>
|
|
433
|
+
`- [${c.id}] ${c.name} (モード: ${c.chatbot_mode || 'standard'}) 作成: ${c.created_at?.slice(0, 10)}`
|
|
434
|
+
);
|
|
435
|
+
return `チャットボット一覧(${data.chatbots.length}件):\n\n${lines.join('\n')}`;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
case 'get_chatbot': {
|
|
439
|
+
const data = await callApi(`/chatbots/${args.id}`);
|
|
440
|
+
const mode = data.knowledge_smart_full_text ? 'smart_full_text'
|
|
441
|
+
: !data.knowledge_semantic_search ? 'full_text'
|
|
442
|
+
: data.knowledge_query_rewrite ? 'two_step_rag'
|
|
443
|
+
: 'semantic';
|
|
444
|
+
const parts = [
|
|
445
|
+
`名前: ${data.name}`,
|
|
446
|
+
data.header_title ? `タイトル: ${data.header_title}` : '',
|
|
447
|
+
`モード: ${data.chatbot_mode || 'standard'}`,
|
|
448
|
+
`ナレッジ参照: ${mode}`,
|
|
449
|
+
data.system_prompt ? `\n--- システムプロンプト ---\n${data.system_prompt}` : '',
|
|
450
|
+
data.rules_allow ? `\n--- 許可ルール ---\n${data.rules_allow}` : '',
|
|
451
|
+
data.rules_deny ? `\n--- 禁止ルール ---\n${data.rules_deny}` : '',
|
|
452
|
+
data.sales_flow ? `\n--- 対話フロー ---\n${data.sales_flow}` : '',
|
|
453
|
+
].filter(Boolean);
|
|
454
|
+
return parts.join('\n');
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
case 'create_agent_preset': {
|
|
458
|
+
const data = await callApi('/agent-presets', {
|
|
459
|
+
method: 'POST',
|
|
460
|
+
body: JSON.stringify({
|
|
461
|
+
name: args.name,
|
|
462
|
+
description: args.description,
|
|
463
|
+
base_prompt: args.base_prompt,
|
|
464
|
+
rules_allow: args.rules_allow,
|
|
465
|
+
rules_deny: args.rules_deny,
|
|
466
|
+
sales_flow: args.sales_flow,
|
|
467
|
+
knowledge: args.knowledge,
|
|
468
|
+
knowledge_item_ids: args.knowledge_item_ids,
|
|
469
|
+
}),
|
|
470
|
+
});
|
|
471
|
+
return `✅ ${data.message}\nID: ${data.id}\n名前: ${data.name}\n作成日時: ${data.created_at}`;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
case 'update_agent_preset': {
|
|
475
|
+
const body = {};
|
|
476
|
+
const fields = ['name','description','base_prompt','rules_allow','rules_deny','sales_flow','knowledge','knowledge_item_ids'];
|
|
477
|
+
fields.forEach(f => { if (args[f] !== undefined) body[f] = args[f]; });
|
|
478
|
+
const data = await callApi(`/agent-presets/${args.id}`, {
|
|
479
|
+
method: 'PATCH',
|
|
480
|
+
body: JSON.stringify(body),
|
|
481
|
+
});
|
|
482
|
+
return `✅ ${data.message}\nID: ${data.id}\n名前: ${data.name}\n更新日時: ${data.updated_at}`;
|
|
483
|
+
}
|
|
484
|
+
|
|
212
485
|
case 'create_knowledge': {
|
|
213
486
|
const data = await callApi('/knowledge', {
|
|
214
487
|
method: 'POST',
|
|
@@ -239,6 +512,73 @@ async function executeTool(name, args) {
|
|
|
239
512
|
return `✅ ${data.message}\n削除したナレッジ: ${data.deleted.title} (ID: ${data.deleted.id})`;
|
|
240
513
|
}
|
|
241
514
|
|
|
515
|
+
case 'create_workflow': {
|
|
516
|
+
const data = await callApi('/workflows', {
|
|
517
|
+
method: 'POST',
|
|
518
|
+
body: JSON.stringify({ title: args.title, description: args.description, steps: args.steps }),
|
|
519
|
+
});
|
|
520
|
+
return `✅ ${data.message}\nID: ${data.id}\nタイトル: ${data.title}`;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
case 'update_workflow': {
|
|
524
|
+
const body = {};
|
|
525
|
+
const wFields = ['title', 'description', 'steps', 'is_active'];
|
|
526
|
+
wFields.forEach(f => { if (args[f] !== undefined) body[f] = args[f]; });
|
|
527
|
+
const data = await callApi(`/workflows/${args.id}`, {
|
|
528
|
+
method: 'PATCH',
|
|
529
|
+
body: JSON.stringify(body),
|
|
530
|
+
});
|
|
531
|
+
return `✅ ${data.message}\nID: ${data.id}`;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
case 'create_chatbot': {
|
|
535
|
+
const data = await callApi('/chatbots', {
|
|
536
|
+
method: 'POST',
|
|
537
|
+
body: JSON.stringify({
|
|
538
|
+
name: args.name, system_prompt: args.system_prompt,
|
|
539
|
+
initial_message: args.initial_message, rules_allow: args.rules_allow,
|
|
540
|
+
rules_deny: args.rules_deny, sales_flow: args.sales_flow,
|
|
541
|
+
quick_replies: args.quick_replies,
|
|
542
|
+
}),
|
|
543
|
+
});
|
|
544
|
+
return `✅ ${data.message}\nID: ${data.id}\n名前: ${data.name}\nwidget_token: ${data.widget_token}`;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
case 'update_chatbot': {
|
|
548
|
+
const body = {};
|
|
549
|
+
const cbFields = ['name','system_prompt','initial_message','rules_allow','rules_deny','sales_flow','quick_replies'];
|
|
550
|
+
cbFields.forEach(f => { if (args[f] !== undefined) body[f] = args[f]; });
|
|
551
|
+
const data = await callApi(`/chatbots/${args.id}`, {
|
|
552
|
+
method: 'PATCH',
|
|
553
|
+
body: JSON.stringify(body),
|
|
554
|
+
});
|
|
555
|
+
return `✅ ${data.message}\nID: ${data.id}`;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
case 'get_workflow_plan': {
|
|
559
|
+
const data = await callApi(`/workflows/${args.id}/plan`);
|
|
560
|
+
const stepLines = data.steps.map(s => {
|
|
561
|
+
if (s.type === 'agent_task') {
|
|
562
|
+
return ` [${s.index}] 🤖 AI推論: ${s.label}` +
|
|
563
|
+
(s.preset_id ? `\n → load_agent(${s.preset_id}) で呼び出し` : '') +
|
|
564
|
+
(s.prompt ? `\n → プロンプト: ${s.prompt.slice(0, 80)}...` : '');
|
|
565
|
+
}
|
|
566
|
+
return ` [${s.index}] ⚡ アクション: ${s.label} (${s.action_type})` +
|
|
567
|
+
`\n → execute_workflow_action(step_index=${s.index}) で実行`;
|
|
568
|
+
});
|
|
569
|
+
return `ワークフロー: ${data.title}\n説明: ${data.description || 'なし'}\nステップ数: ${data.total_steps}\n\n${stepLines.join('\n')}`;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
case 'execute_workflow_action': {
|
|
573
|
+
const data = await callApi(`/workflows/${args.id}/execute-action`, {
|
|
574
|
+
method: 'POST',
|
|
575
|
+
body: JSON.stringify({ step_index: args.step_index, previous_output: args.previous_output }),
|
|
576
|
+
});
|
|
577
|
+
if (data.status === 'sent') return `✅ ${data.message}`;
|
|
578
|
+
if (data.status === 'pending_approval') return `⏳ ${data.message}\nタスクID: ${data.task_id}`;
|
|
579
|
+
return `✅ ${data.message || JSON.stringify(data)}`;
|
|
580
|
+
}
|
|
581
|
+
|
|
242
582
|
default:
|
|
243
583
|
throw new Error(`Unknown tool: ${name}`);
|
|
244
584
|
}
|
|
@@ -247,7 +587,7 @@ async function executeTool(name, args) {
|
|
|
247
587
|
// ── MCPサーバー起動 ────────────────────────────────────────────
|
|
248
588
|
async function main() {
|
|
249
589
|
const server = new Server(
|
|
250
|
-
{ name: 'owner-clone-ai', version: '1.
|
|
590
|
+
{ name: 'owner-clone-ai', version: '1.3.0' },
|
|
251
591
|
{ capabilities: { tools: {} } }
|
|
252
592
|
);
|
|
253
593
|
|