owner-clone-ai-mcp 1.1.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.
- package/index.js +174 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -94,6 +94,99 @@ 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
|
+
},
|
|
97
190
|
// 書き込みツール(読み書き可能キーが必要)
|
|
98
191
|
{
|
|
99
192
|
name: 'create_knowledge',
|
|
@@ -209,6 +302,86 @@ async function executeTool(name, args) {
|
|
|
209
302
|
return parts.join('\n');
|
|
210
303
|
}
|
|
211
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
|
+
|
|
212
385
|
case 'create_knowledge': {
|
|
213
386
|
const data = await callApi('/knowledge', {
|
|
214
387
|
method: 'POST',
|
|
@@ -247,7 +420,7 @@ async function executeTool(name, args) {
|
|
|
247
420
|
// ── MCPサーバー起動 ────────────────────────────────────────────
|
|
248
421
|
async function main() {
|
|
249
422
|
const server = new Server(
|
|
250
|
-
{ name: 'owner-clone-ai', version: '1.
|
|
423
|
+
{ name: 'owner-clone-ai', version: '1.2.0' },
|
|
251
424
|
{ capabilities: { tools: {} } }
|
|
252
425
|
);
|
|
253
426
|
|