owner-clone-ai-mcp 1.2.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.
Files changed (2) hide show
  1. package/index.js +168 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -187,6 +187,106 @@ const TOOLS = [
187
187
  required: ['id'],
188
188
  },
189
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
+ },
190
290
  // 書き込みツール(読み書き可能キーが必要)
191
291
  {
192
292
  name: 'create_knowledge',
@@ -412,6 +512,73 @@ async function executeTool(name, args) {
412
512
  return `✅ ${data.message}\n削除したナレッジ: ${data.deleted.title} (ID: ${data.deleted.id})`;
413
513
  }
414
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
+
415
582
  default:
416
583
  throw new Error(`Unknown tool: ${name}`);
417
584
  }
@@ -420,7 +587,7 @@ async function executeTool(name, args) {
420
587
  // ── MCPサーバー起動 ────────────────────────────────────────────
421
588
  async function main() {
422
589
  const server = new Server(
423
- { name: 'owner-clone-ai', version: '1.2.0' },
590
+ { name: 'owner-clone-ai', version: '1.3.0' },
424
591
  { capabilities: { tools: {} } }
425
592
  );
426
593
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owner-clone-ai-mcp",
3
- "version": "1.2.0",
3
+ "version": "1.3.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": {