owner-clone-ai-mcp 1.7.0 → 1.8.1

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 +169 -30
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -97,13 +97,34 @@ const TOOLS = [
97
97
  // AIパートナー関連(読み取り)
98
98
  {
99
99
  name: 'load_agent',
100
- description: 'AIパートナーの設定(システムプロンプト・ルール・対話フロー)と関連ナレッジを取得します。AIパートナーに設定されたナレッジ参照モード(semantic/full_text/two_step_rag/smart_full_text)でナレッジを検索し、Claude Codeがそのパートナーの人格・知識で回答できるようにします。追加のAI課金は発生しません。',
100
+ description: `AIパートナーの設定(システムプロンプト・ルール・対話フロー)と関連ナレッジを取得します。
101
+ AIパートナーに設定されたナレッジ参照モードでナレッジを検索し、Claude Codeがそのパートナーの人格・知識で回答できるようにします。追加のAI課金は発生しません。
102
+
103
+ ■ queryパラメータは必ずユーザーの質問文をそのまま渡すこと(要約・言い換え禁止)。
104
+ セマンティック検索の精度がqueryの文字列に直接依存するため。
105
+
106
+ ■ ナレッジ参照モード別の呼び出し戦略(AIパートナー設定で自動決定):
107
+
108
+ 【full_text モード】(knowledge_semantic_search=false)
109
+ → セッション開始時に1回だけ呼べばOK。
110
+ 返ってくるナレッジ全文は毎回同じ(クエリ非依存)なので、
111
+ Claude Codeのコンテキストに記憶される。2回目以降はload_agentを呼ばずに
112
+ 記憶済みナレッジから直接回答できる。query省略可。
113
+
114
+ 【semantic モード】(デフォルト)
115
+ → 質問ごとに呼ぶ。queryに質問文を渡すと関連チャンクが変わる。
116
+
117
+ 【smart_full_text モード】
118
+ → 質問ごとに呼ぶ。queryに質問文を渡す。
119
+
120
+ 【two_step_rag モード】
121
+ → 質問ごとに呼ぶ。queryに質問文を渡す(クエリ最適化はバックエンドで自動対応)。`,
101
122
  annotations: { readOnlyHint: true },
102
123
  inputSchema: {
103
124
  type: 'object',
104
125
  properties: {
105
126
  id: { type: 'string', description: 'AIパートナーのID(list_agent_presetsで確認)' },
106
- query: { type: 'string', description: 'ユーザーの質問・依頼内容(ナレッジ検索に使用。省略時は全ナレッジを返す)' },
127
+ query: { type: 'string', description: 'ユーザーの質問文をそのまま渡す(full_textモードは省略可。他モードは必須)' },
107
128
  },
108
129
  required: ['id'],
109
130
  },
@@ -406,7 +427,24 @@ const TOOLS = [
406
427
 
407
428
  ▸ google_sheets_write(スプレッドシートに書き込み)
408
429
  { "type": "action", "label": "スプレッドシートに保存", "action_type": "google_sheets_write",
409
- "spreadsheet_id": "スプレッドシートID", "sheet_range": "Sheet1!A:A" }
430
+ "spreadsheet_id": "スプレッドシートID", "sheet_range": "Sheet1!A:A",
431
+ "row_values": ["__output__"] } ← __output__ は前ステップ出力を自動挿入
432
+
433
+ ▸ check_chatwork(ChatWorkの未読メッセージ取得)
434
+ { "type": "action", "label": "ChatWork受信確認", "action_type": "check_chatwork",
435
+ "chatwork_setting_id": "ChatWork設定ID" }
436
+ → 取得した本文が次ステップに引き継がれる
437
+
438
+ ▸ save_email_draft(メール下書き保存)
439
+ { "type": "action", "label": "メール下書き作成", "action_type": "save_email_draft",
440
+ "email_setting_id": "メール設定ID",
441
+ "to_email": "宛先(省略時はcheck_emailの差出人)",
442
+ "subject": "件名" }
443
+
444
+ ▸ post_sns(SNSへ投稿)
445
+ { "type": "action", "label": "SNS投稿", "action_type": "post_sns",
446
+ "sns_setting_id": "SNS設定ID",
447
+ "post_title": "投稿タイトル(省略可)" }
410
448
 
411
449
  ■ 典型的なワークフロー構成例:
412
450
 
@@ -524,12 +562,58 @@ diagnostic_mode=true の場合、必ず diagnostic_result_mode も指定する:
524
562
  → おすすめ: 課題特定フロー・商品レコメンド・お悩み分岐診断
525
563
 
526
564
  diagnostic_strict_result=true: 結果が確定した瞬間に即表示(全問回答を待たない)。
527
- diagnostic_ai_text_enabled=false: 質問間のAI会話文を省略してフォーム形式に(count/scoreモードで高速化したい場合)。`,
565
+ diagnostic_ai_text_enabled=false: 質問間のAI会話文を省略してフォーム形式に(count/scoreモードで高速化したい場合)。
566
+
567
+ ■ 診断の質問・結果データ(diagnostic_questions / diagnostic_results):
568
+
569
+ diagnostic_questions — 質問の配列。各要素のフォーマット:
570
+ ai/count/scoreモード:
571
+ { "id": "q1", "question": "質問文", "survey_type": "choices",
572
+ "choices": ["選択肢A", "選択肢B", "選択肢C"] }
573
+ ※ scoreモードの場合は choice_scores を追加:
574
+ "choice_scores": { "0": {"result-id": 3}, "1": {"result-id": 1} }
575
+ (choices配列インデックス → { 結果ID: 点数 } のマッピング)
576
+
577
+ branchモード(各選択肢が次の質問/結果へリンク):
578
+ { "id": "q1", "question": "質問文", "survey_type": "choices",
579
+ "choices": [
580
+ { "id": "c1", "text": "はい", "next": "q2" },
581
+ { "id": "c2", "text": "いいえ", "next": "result-A" }
582
+ ] }
583
+
584
+ diagnostic_results — 結果の配列。各要素のフォーマット:
585
+ { "id": "result-A", "label": "結果タイトル",
586
+ "condition_hint": "このユーザーはどんな人か(ai/countモードでAIが判定するヒント)",
587
+ "badge": "#3b82f6", "bg": "#3b82f618", "text": "#3b82f6",
588
+ "blocks": [] }
589
+
590
+ ■ 診断後のCTA(行動喚起)設定:
591
+ diagnostic_goal_cta: ボタンに表示するテキスト(例: "無料相談に申し込む")
592
+ diagnostic_goal_url: ボタンのリンク先URL
593
+ diagnostic_goal_button_text: ボタン上のメインラベル(cta より具体的な文言)
594
+
595
+ ■ エスカレーション(有人対応への切り替え):
596
+ 特定のキーワードが出たとき、または「担当者につないでほしい」などのリクエストで、
597
+ チャットの対応を人に切り替える機能。
598
+ escalation_enabled=true で有効化。
599
+ escalation_trigger: "user_request"(ユーザーが明示的に要求したとき)または "keyword"(キーワード検出)
600
+ escalation_email: 通知先メールアドレス
601
+ escalation_chatwork_room_id: 通知先ChatWorkルームID
602
+ escalation_message: エスカレーション時にユーザーへ表示するメッセージ
603
+ escalation_keywords: 検出するキーワード(改行区切り)
604
+
605
+ ■ ヘッダー:
606
+ header_title: チャットウィンドウ上部に表示するタイトル(例: "○○サポート")。省略時はチャットボット名。
607
+
608
+ ■ Branchモードのボタンラベル:
609
+ branch_yes_label: Yesボタンの表示テキスト(デフォルト: "はい")
610
+ branch_no_label: Noボタンの表示テキスト(デフォルト: "いいえ")`,
528
611
  annotations: { destructiveHint: false, idempotentHint: false },
529
612
  inputSchema: {
530
613
  type: 'object',
531
614
  properties: {
532
615
  name: { type: 'string', description: 'チャットボット名(例: 「ECサイト問い合わせBot」)' },
616
+ header_title: { type: 'string', description: 'チャットウィンドウ上部のヘッダータイトル。省略時はname(チャットボット名)を使用。' },
533
617
  system_prompt: { type: 'string', description: 'AIの人格・役割・回答スタイルを定義するメインプロンプト。チャット時に毎回注入される。' },
534
618
  initial_message: { type: 'string', description: 'チャット開始時にAIが最初に表示するメッセージ。ユーザーへの歓迎・誘導文。' },
535
619
  rules_allow: { type: 'string', description: '許可ルール。改行区切り箇条書き。AIが積極的に行うべきこと。' },
@@ -545,10 +629,31 @@ diagnostic_ai_text_enabled=false: 質問間のAI会話文を省略してフォ
545
629
  diagnostic_result_mode: {
546
630
  type: 'string',
547
631
  enum: ['ai', 'count', 'score', 'branch'],
548
- description: '診断判定ロジック。diagnostic_mode=trueの場合必須。ai=AI総合判断(自由記述向き)/ count=最多選択番号で判定(選択式向き)/ score=ポイント合計で判定(重み付け向き)/ branch=Yes/No分岐型(決定木向き)',
632
+ description: '診断判定ロジック。ai=AI総合判断(自由記述向き)/ count=最多選択番号判定(選択式向き)/ score=ポイント合計(重み付け向き)/ branch=Yes/No分岐型(決定木向き)',
549
633
  },
550
- diagnostic_strict_result: { type: 'boolean', description: 'true=結果確定時に即表示(全問回答を待たない)。デフォルト: false' },
634
+ diagnostic_strict_result: { type: 'boolean', description: 'true=結果確定時に即表示(全問回答を待たない)。デフォルト: false' },
551
635
  diagnostic_ai_text_enabled: { type: 'boolean', description: 'false=質問間のAI会話文を省略してフォーム形式に高速化(count/scoreモード推奨)。デフォルト: true' },
636
+ diagnostic_questions: {
637
+ type: 'array',
638
+ description: '診断の質問配列。各要素: {id, question, survey_type:"choices", choices:[...]}。branchモードはchoices内に{id,text,next}を使用。',
639
+ items: { type: 'object' },
640
+ },
641
+ diagnostic_results: {
642
+ type: 'array',
643
+ description: '診断の結果配列。各要素: {id, label, condition_hint, badge:"#色", bg:"#色18", text:"#色", blocks:[]}。',
644
+ items: { type: 'object' },
645
+ },
646
+ diagnostic_goal_cta: { type: 'string', description: '診断結果後のCTAボタンテキスト(例: "無料相談に申し込む")' },
647
+ diagnostic_goal_url: { type: 'string', description: '診断結果後のCTAボタンリンク先URL' },
648
+ diagnostic_goal_button_text: { type: 'string', description: '診断結果後のボタン表示テキスト' },
649
+ escalation_enabled: { type: 'boolean', description: 'true=有人対応切り替え機能を有効化。デフォルト: false' },
650
+ escalation_trigger: { type: 'string', description: 'エスカレーション発動条件: "user_request"(ユーザーが要求した時)/ "keyword"(キーワード検出時)', enum: ['user_request', 'keyword'] },
651
+ escalation_email: { type: 'string', description: 'エスカレーション通知先メールアドレス(省略可)' },
652
+ escalation_chatwork_room_id: { type: 'string', description: 'エスカレーション通知先ChatWorkルームID(省略可)' },
653
+ escalation_message: { type: 'string', description: 'エスカレーション時にユーザーへ表示するメッセージ。デフォルト: "担当者に繋ぎます…"' },
654
+ escalation_keywords: { type: 'string', description: 'keyword triggerの場合のキーワードリスト。改行区切り。' },
655
+ branch_yes_label: { type: 'string', description: 'branchモードのYesボタン表示テキスト(デフォルト: "はい")' },
656
+ branch_no_label: { type: 'string', description: 'branchモードのNoボタン表示テキスト(デフォルト: "いいえ")' },
552
657
  },
553
658
  required: ['name'],
554
659
  },
@@ -557,28 +662,43 @@ diagnostic_ai_text_enabled=false: 質問間のAI会話文を省略してフォ
557
662
  name: 'update_chatbot',
558
663
  description: `既存のチャットボットを更新します。【書き込み権限付きキーが必要】
559
664
  指定したフィールドのみ更新され、省略したフィールドは現在値を維持します。
665
+ diagnostic_questions / diagnostic_results を渡すと全データが置換されます(差分更新ではない)。
560
666
  各フィールドの意味は create_chatbot と同じです。`,
561
667
  annotations: { destructiveHint: false, idempotentHint: true },
562
668
  inputSchema: {
563
669
  type: 'object',
564
670
  properties: {
565
- id: { type: 'string', description: 'チャットボットID(list_chatbotsで確認)' },
566
- name: { type: 'string', description: '新しい名前(省略時は変更なし)' },
567
- system_prompt: { type: 'string', description: '新しいシステムプロンプト(省略時は変更なし)' },
568
- initial_message: { type: 'string', description: '新しい最初のメッセージ(省略時は変更なし)' },
569
- rules_allow: { type: 'string', description: '新しい許可ルール・改行区切り(省略時は変更なし)' },
570
- rules_deny: { type: 'string', description: '新しい禁止ルール・改行区切り(省略時は変更なし)' },
571
- sales_flow: { type: 'string', description: '新しい対話フロー(省略時は変更なし)' },
572
- quick_replies: { type: 'string', description: '新しいクイック返信・改行区切り(省略時は変更なし)' },
573
- ai_provider: { type: 'string', description: '新しいAIエンジン(省略時は変更なし)', enum: ['claude', 'openai', 'gemini', 'openrouter', 'groq'] },
574
- ai_model: { type: 'string', description: '新しいモデル(省略時は変更なし)' },
575
- knowledge_semantic_search: { type: 'boolean', description: 'ナレッジ検索モード変更(省略時は変更なし)' },
576
- knowledge_query_rewrite: { type: 'boolean', description: 'クエリ最適化モード変更(省略時は変更なし)' },
577
- knowledge_smart_full_text: { type: 'boolean', description: 'スマート全文取得モード変更(省略時は変更なし)' },
578
- diagnostic_mode: { type: 'boolean', description: '診断フロー有効/無効(省略時は変更なし)' },
579
- diagnostic_result_mode: { type: 'string', description: '診断判定ロジック変更: ai / count / score / branch(省略時は変更なし)', enum: ['ai', 'count', 'score', 'branch'] },
580
- diagnostic_strict_result: { type: 'boolean', description: '即時結果表示の変更(省略時は変更なし)' },
581
- diagnostic_ai_text_enabled:{ type: 'boolean', description: '質問間のAI会話文生成の変更(省略時は変更なし)' },
671
+ id: { type: 'string', description: 'チャットボットID(list_chatbotsで確認)' },
672
+ name: { type: 'string', description: '新しい名前(省略時は変更なし)' },
673
+ header_title: { type: 'string', description: '新しいヘッダータイトル(省略時は変更なし)' },
674
+ system_prompt: { type: 'string', description: '新しいシステムプロンプト(省略時は変更なし)' },
675
+ initial_message: { type: 'string', description: '新しい最初のメッセージ(省略時は変更なし)' },
676
+ rules_allow: { type: 'string', description: '新しい許可ルール・改行区切り(省略時は変更なし)' },
677
+ rules_deny: { type: 'string', description: '新しい禁止ルール・改行区切り(省略時は変更なし)' },
678
+ sales_flow: { type: 'string', description: '新しい対話フロー(省略時は変更なし)' },
679
+ quick_replies: { type: 'string', description: '新しいクイック返信・改行区切り(省略時は変更なし)' },
680
+ ai_provider: { type: 'string', description: '新しいAIエンジン(省略時は変更なし)', enum: ['claude', 'openai', 'gemini', 'openrouter', 'groq'] },
681
+ ai_model: { type: 'string', description: '新しいモデル(省略時は変更なし)' },
682
+ knowledge_semantic_search: { type: 'boolean', description: 'ナレッジ検索モード変更(省略時は変更なし)' },
683
+ knowledge_query_rewrite: { type: 'boolean', description: 'クエリ最適化モード変更(省略時は変更なし)' },
684
+ knowledge_smart_full_text: { type: 'boolean', description: 'スマート全文取得モード変更(省略時は変更なし)' },
685
+ diagnostic_mode: { type: 'boolean', description: '診断フロー有効/無効(省略時は変更なし)' },
686
+ diagnostic_result_mode: { type: 'string', description: '診断判定ロジック変更: ai / count / score / branch(省略時は変更なし)', enum: ['ai', 'count', 'score', 'branch'] },
687
+ diagnostic_strict_result: { type: 'boolean', description: '即時結果表示の変更(省略時は変更なし)' },
688
+ diagnostic_ai_text_enabled: { type: 'boolean', description: '質問間のAI会話文生成の変更(省略時は変更なし)' },
689
+ diagnostic_questions: { type: 'array', description: '診断質問を全置換(省略時は変更なし)', items: { type: 'object' } },
690
+ diagnostic_results: { type: 'array', description: '診断結果を全置換(省略時は変更なし)', items: { type: 'object' } },
691
+ diagnostic_goal_cta: { type: 'string', description: '診断後CTAボタンテキスト(省略時は変更なし)' },
692
+ diagnostic_goal_url: { type: 'string', description: '診断後CTAリンク先(省略時は変更なし)' },
693
+ diagnostic_goal_button_text: { type: 'string', description: '診断後ボタンテキスト(省略時は変更なし)' },
694
+ escalation_enabled: { type: 'boolean', description: 'エスカレーション有効/無効(省略時は変更なし)' },
695
+ escalation_trigger: { type: 'string', description: 'エスカレーション発動条件変更(省略時は変更なし)', enum: ['user_request', 'keyword'] },
696
+ escalation_email: { type: 'string', description: 'エスカレーション通知メール(省略時は変更なし)' },
697
+ escalation_chatwork_room_id: { type: 'string', description: 'エスカレーション通知ChatWorkルームID(省略時は変更なし)' },
698
+ escalation_message: { type: 'string', description: 'エスカレーション時のメッセージ(省略時は変更なし)' },
699
+ escalation_keywords: { type: 'string', description: 'エスカレーションキーワード改行区切り(省略時は変更なし)' },
700
+ branch_yes_label: { type: 'string', description: 'branchモードYesボタンテキスト(省略時は変更なし)' },
701
+ branch_no_label: { type: 'string', description: 'branchモードNoボタンテキスト(省略時は変更なし)' },
582
702
  },
583
703
  required: ['id'],
584
704
  },
@@ -1010,27 +1130,46 @@ async function executeTool(name, args) {
1010
1130
 
1011
1131
  case 'create_chatbot': {
1012
1132
  const cbCreate = {};
1013
- const cbAllFields = ['name','system_prompt','initial_message','rules_allow','rules_deny',
1133
+ const cbAllFields = [
1134
+ 'name','header_title','system_prompt','initial_message','rules_allow','rules_deny',
1014
1135
  'sales_flow','quick_replies','ai_provider','ai_model',
1015
1136
  'knowledge_query_rewrite','knowledge_smart_full_text',
1016
- 'diagnostic_mode','diagnostic_result_mode','diagnostic_strict_result','diagnostic_ai_text_enabled'];
1137
+ 'diagnostic_mode','diagnostic_result_mode','diagnostic_strict_result','diagnostic_ai_text_enabled',
1138
+ 'diagnostic_goal_cta','diagnostic_goal_url','diagnostic_goal_button_text',
1139
+ 'escalation_enabled','escalation_trigger','escalation_email',
1140
+ 'escalation_chatwork_room_id','escalation_message','escalation_keywords',
1141
+ 'branch_yes_label','branch_no_label',
1142
+ ];
1017
1143
  cbAllFields.forEach(f => { if (args[f] !== undefined) cbCreate[f] = args[f]; });
1018
1144
  if (Array.isArray(args.knowledge_item_ids)) cbCreate.knowledge_item_ids = args.knowledge_item_ids;
1145
+ if (Array.isArray(args.diagnostic_questions)) cbCreate.diagnostic_questions = args.diagnostic_questions;
1146
+ if (Array.isArray(args.diagnostic_results)) cbCreate.diagnostic_results = args.diagnostic_results;
1019
1147
  const data = await callApi('/chatbots', {
1020
1148
  method: 'POST',
1021
1149
  body: JSON.stringify(cbCreate),
1022
1150
  });
1023
- const diagInfo = cbCreate.diagnostic_mode ? `\n診断モード: ON (${cbCreate.diagnostic_result_mode || 'ai'})` : '';
1024
- return `✅ ${data.message}\nID: ${data.id}\n名前: ${data.name}\nAI: ${data.ai_provider || 'claude'}\nwidget_token: ${data.widget_token}\n紐付けナレッジ: ${data.linked_knowledge_count ?? 0}件${diagInfo}`;
1151
+ const diagInfo = cbCreate.diagnostic_mode
1152
+ ? `\n診断モード: ON (${cbCreate.diagnostic_result_mode || 'ai'}) / 質問数: ${(cbCreate.diagnostic_questions || []).length} / 結果数: ${(cbCreate.diagnostic_results || []).length}`
1153
+ : '';
1154
+ const escInfo = cbCreate.escalation_enabled ? '\nエスカレーション: ON' : '';
1155
+ return `✅ ${data.message}\nID: ${data.id}\n名前: ${data.name}\nAI: ${data.ai_provider || 'claude'}\nwidget_token: ${data.widget_token}\n紐付けナレッジ: ${data.linked_knowledge_count ?? 0}件${diagInfo}${escInfo}`;
1025
1156
  }
1026
1157
 
1027
1158
  case 'update_chatbot': {
1028
1159
  const body = {};
1029
- const cbFields = ['name','system_prompt','initial_message','rules_allow','rules_deny',
1160
+ const cbFields = [
1161
+ 'name','header_title','system_prompt','initial_message','rules_allow','rules_deny',
1030
1162
  'sales_flow','quick_replies','ai_provider','ai_model',
1031
1163
  'knowledge_semantic_search','knowledge_query_rewrite','knowledge_smart_full_text',
1032
- 'diagnostic_mode','diagnostic_result_mode','diagnostic_strict_result','diagnostic_ai_text_enabled'];
1164
+ 'diagnostic_mode','diagnostic_result_mode','diagnostic_strict_result','diagnostic_ai_text_enabled',
1165
+ 'diagnostic_goal_cta','diagnostic_goal_url','diagnostic_goal_button_text',
1166
+ 'escalation_enabled','escalation_trigger','escalation_email',
1167
+ 'escalation_chatwork_room_id','escalation_message','escalation_keywords',
1168
+ 'branch_yes_label','branch_no_label',
1169
+ ];
1033
1170
  cbFields.forEach(f => { if (args[f] !== undefined) body[f] = args[f]; });
1171
+ if (Array.isArray(args.diagnostic_questions)) body.diagnostic_questions = args.diagnostic_questions;
1172
+ if (Array.isArray(args.diagnostic_results)) body.diagnostic_results = args.diagnostic_results;
1034
1173
  const data = await callApi(`/chatbots/${args.id}`, {
1035
1174
  method: 'PATCH',
1036
1175
  body: JSON.stringify(body),
@@ -1094,7 +1233,7 @@ async function executeTool(name, args) {
1094
1233
  // ── MCPサーバー起動 ────────────────────────────────────────────
1095
1234
  async function main() {
1096
1235
  const server = new Server(
1097
- { name: 'owner-clone-ai', version: '1.7.0' },
1236
+ { name: 'owner-clone-ai', version: '1.8.1' },
1098
1237
  { capabilities: { tools: {} } }
1099
1238
  );
1100
1239
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owner-clone-ai-mcp",
3
- "version": "1.7.0",
3
+ "version": "1.8.1",
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": {