bluelamp 4.3.2 → 5.0.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/bin/musuhi-vscode-base +2 -0
- package/bin/musuhi1 +2 -0
- package/bin/musuhi10 +2 -0
- package/bin/musuhi100 +2 -0
- package/bin/musuhi101 +2 -0
- package/bin/musuhi102 +2 -0
- package/bin/musuhi103 +2 -0
- package/bin/musuhi104 +2 -0
- package/bin/musuhi105 +2 -0
- package/bin/musuhi106 +2 -0
- package/bin/musuhi107 +2 -0
- package/bin/musuhi108 +2 -0
- package/bin/musuhi109 +2 -0
- package/bin/musuhi11 +2 -0
- package/bin/musuhi110 +2 -0
- package/bin/musuhi111 +2 -0
- package/bin/musuhi112 +2 -0
- package/bin/musuhi113 +2 -0
- package/bin/musuhi114 +2 -0
- package/bin/musuhi115 +2 -0
- package/bin/musuhi116 +2 -0
- package/bin/musuhi117 +2 -0
- package/bin/musuhi118 +2 -0
- package/bin/musuhi119 +2 -0
- package/bin/musuhi12 +2 -0
- package/bin/musuhi120 +2 -0
- package/bin/musuhi121 +2 -0
- package/bin/musuhi122 +2 -0
- package/bin/musuhi123 +2 -0
- package/bin/musuhi124 +2 -0
- package/bin/musuhi125 +2 -0
- package/bin/musuhi126 +2 -0
- package/bin/musuhi127 +2 -0
- package/bin/musuhi128 +2 -0
- package/bin/musuhi129 +2 -0
- package/bin/musuhi13 +2 -0
- package/bin/musuhi130 +2 -0
- package/bin/musuhi131 +2 -0
- package/bin/musuhi132 +2 -0
- package/bin/musuhi133 +2 -0
- package/bin/musuhi134 +2 -0
- package/bin/musuhi135 +2 -0
- package/bin/musuhi136 +2 -0
- package/bin/musuhi137 +2 -0
- package/bin/musuhi138 +2 -0
- package/bin/musuhi139 +2 -0
- package/bin/musuhi14 +2 -0
- package/bin/musuhi140 +2 -0
- package/bin/musuhi141 +2 -0
- package/bin/musuhi142 +2 -0
- package/bin/musuhi143 +2 -0
- package/bin/musuhi144 +2 -0
- package/bin/musuhi145 +2 -0
- package/bin/musuhi146 +2 -0
- package/bin/musuhi147 +2 -0
- package/bin/musuhi148 +2 -0
- package/bin/musuhi149 +2 -0
- package/bin/musuhi15 +2 -0
- package/bin/musuhi150 +2 -0
- package/bin/musuhi151 +2 -0
- package/bin/musuhi152 +2 -0
- package/bin/musuhi153 +2 -0
- package/bin/musuhi154 +2 -0
- package/bin/musuhi155 +2 -0
- package/bin/musuhi156 +2 -0
- package/bin/musuhi157 +2 -0
- package/bin/musuhi158 +2 -0
- package/bin/musuhi159 +2 -0
- package/bin/musuhi16 +2 -0
- package/bin/musuhi160 +2 -0
- package/bin/musuhi161 +2 -0
- package/bin/musuhi162 +2 -0
- package/bin/musuhi163 +2 -0
- package/bin/musuhi164 +2 -0
- package/bin/musuhi165 +2 -0
- package/bin/musuhi166 +2 -0
- package/bin/musuhi167 +2 -0
- package/bin/musuhi168 +2 -0
- package/bin/musuhi169 +2 -0
- package/bin/musuhi17 +2 -0
- package/bin/musuhi170 +2 -0
- package/bin/musuhi171 +2 -0
- package/bin/musuhi172 +2 -0
- package/bin/musuhi173 +2 -0
- package/bin/musuhi174 +2 -0
- package/bin/musuhi175 +2 -0
- package/bin/musuhi176 +2 -0
- package/bin/musuhi177 +2 -0
- package/bin/musuhi178 +2 -0
- package/bin/musuhi179 +2 -0
- package/bin/musuhi18 +2 -0
- package/bin/musuhi180 +2 -0
- package/bin/musuhi181 +2 -0
- package/bin/musuhi182 +2 -0
- package/bin/musuhi183 +2 -0
- package/bin/musuhi184 +2 -0
- package/bin/musuhi185 +2 -0
- package/bin/musuhi186 +2 -0
- package/bin/musuhi187 +2 -0
- package/bin/musuhi188 +2 -0
- package/bin/musuhi189 +2 -0
- package/bin/musuhi19 +2 -0
- package/bin/musuhi190 +2 -0
- package/bin/musuhi191 +2 -0
- package/bin/musuhi192 +2 -0
- package/bin/musuhi193 +2 -0
- package/bin/musuhi194 +2 -0
- package/bin/musuhi195 +2 -0
- package/bin/musuhi196 +2 -0
- package/bin/musuhi197 +2 -0
- package/bin/musuhi198 +2 -0
- package/bin/musuhi199 +2 -0
- package/bin/musuhi2 +2 -0
- package/bin/musuhi20 +2 -0
- package/bin/musuhi200 +2 -0
- package/bin/musuhi21 +2 -0
- package/bin/musuhi22 +2 -0
- package/bin/musuhi23 +2 -0
- package/bin/musuhi24 +2 -0
- package/bin/musuhi25 +2 -0
- package/bin/musuhi26 +2 -0
- package/bin/musuhi27 +2 -0
- package/bin/musuhi28 +2 -0
- package/bin/musuhi29 +2 -0
- package/bin/musuhi3 +2 -0
- package/bin/musuhi30 +2 -0
- package/bin/musuhi31 +2 -0
- package/bin/musuhi32 +2 -0
- package/bin/musuhi33 +2 -0
- package/bin/musuhi34 +2 -0
- package/bin/musuhi35 +2 -0
- package/bin/musuhi36 +2 -0
- package/bin/musuhi37 +2 -0
- package/bin/musuhi38 +2 -0
- package/bin/musuhi39 +2 -0
- package/bin/musuhi4 +2 -0
- package/bin/musuhi40 +2 -0
- package/bin/musuhi41 +2 -0
- package/bin/musuhi42 +2 -0
- package/bin/musuhi43 +2 -0
- package/bin/musuhi44 +2 -0
- package/bin/musuhi45 +2 -0
- package/bin/musuhi46 +2 -0
- package/bin/musuhi47 +2 -0
- package/bin/musuhi48 +2 -0
- package/bin/musuhi49 +2 -0
- package/bin/musuhi5 +2 -0
- package/bin/musuhi50 +2 -0
- package/bin/musuhi51 +2 -0
- package/bin/musuhi52 +2 -0
- package/bin/musuhi53 +2 -0
- package/bin/musuhi54 +2 -0
- package/bin/musuhi55 +2 -0
- package/bin/musuhi56 +2 -0
- package/bin/musuhi57 +2 -0
- package/bin/musuhi58 +2 -0
- package/bin/musuhi59 +2 -0
- package/bin/musuhi6 +2 -0
- package/bin/musuhi60 +2 -0
- package/bin/musuhi61 +2 -0
- package/bin/musuhi62 +2 -0
- package/bin/musuhi63 +2 -0
- package/bin/musuhi64 +2 -0
- package/bin/musuhi65 +2 -0
- package/bin/musuhi66 +2 -0
- package/bin/musuhi67 +2 -0
- package/bin/musuhi68 +2 -0
- package/bin/musuhi69 +2 -0
- package/bin/musuhi7 +2 -0
- package/bin/musuhi70 +2 -0
- package/bin/musuhi71 +2 -0
- package/bin/musuhi72 +2 -0
- package/bin/musuhi73 +2 -0
- package/bin/musuhi74 +2 -0
- package/bin/musuhi75 +2 -0
- package/bin/musuhi76 +2 -0
- package/bin/musuhi77 +2 -0
- package/bin/musuhi78 +2 -0
- package/bin/musuhi79 +2 -0
- package/bin/musuhi8 +2 -0
- package/bin/musuhi80 +2 -0
- package/bin/musuhi81 +2 -0
- package/bin/musuhi82 +2 -0
- package/bin/musuhi83 +2 -0
- package/bin/musuhi84 +2 -0
- package/bin/musuhi85 +2 -0
- package/bin/musuhi86 +2 -0
- package/bin/musuhi87 +2 -0
- package/bin/musuhi88 +2 -0
- package/bin/musuhi89 +2 -0
- package/bin/musuhi9 +2 -0
- package/bin/musuhi90 +2 -0
- package/bin/musuhi91 +2 -0
- package/bin/musuhi92 +2 -0
- package/bin/musuhi93 +2 -0
- package/bin/musuhi94 +2 -0
- package/bin/musuhi95 +2 -0
- package/bin/musuhi96 +2 -0
- package/bin/musuhi97 +2 -0
- package/bin/musuhi98 +2 -0
- package/bin/musuhi99 +2 -0
- package/lib/agents//343/{203/226/343/203/253/343/203/274/343/203/251/343/203/263/343/203/227.md → 202/200/343/201/231/343/201/262.md} +3 -3
- package/lib/auth/InteractiveLogin.js +1 -1
- package/lib/auth/PortalAuthClient.js +1 -1
- package/lib/auth/TokenManager.js +1 -1
- package/lib/i18n/en.json +11 -11
- package/lib/i18n/index.js +1 -1
- package/lib/i18n/ja.json +15 -15
- package/lib/mcp-gmail/index.js +4 -144
- package/lib/mcp-password-manager/index.js +3 -3
- package/lib/mcp-server/index.cjs +1 -1
- package/lib/mcp-server/portal-api-client.cjs +1 -1
- package/lib/utils/logger.js +1 -1
- package/package.json +206 -106
- package/scripts/generate-commands.js +1 -1
- package/scripts/playwright-launch.js +1 -1
- package/scripts/setup-mcps.js +1 -1
- package/bin/bluelamp-vscode-base +0 -2
- package/bin/bluelamp1 +0 -2
- package/bin/bluelamp10 +0 -2
- package/bin/bluelamp100 +0 -2
- package/bin/bluelamp11 +0 -2
- package/bin/bluelamp12 +0 -2
- package/bin/bluelamp13 +0 -2
- package/bin/bluelamp14 +0 -2
- package/bin/bluelamp15 +0 -2
- package/bin/bluelamp16 +0 -2
- package/bin/bluelamp17 +0 -2
- package/bin/bluelamp18 +0 -2
- package/bin/bluelamp19 +0 -2
- package/bin/bluelamp2 +0 -2
- package/bin/bluelamp20 +0 -2
- package/bin/bluelamp21 +0 -2
- package/bin/bluelamp22 +0 -2
- package/bin/bluelamp23 +0 -2
- package/bin/bluelamp24 +0 -2
- package/bin/bluelamp25 +0 -2
- package/bin/bluelamp26 +0 -2
- package/bin/bluelamp27 +0 -2
- package/bin/bluelamp28 +0 -2
- package/bin/bluelamp29 +0 -2
- package/bin/bluelamp3 +0 -2
- package/bin/bluelamp30 +0 -2
- package/bin/bluelamp31 +0 -2
- package/bin/bluelamp32 +0 -2
- package/bin/bluelamp33 +0 -2
- package/bin/bluelamp34 +0 -2
- package/bin/bluelamp35 +0 -2
- package/bin/bluelamp36 +0 -2
- package/bin/bluelamp37 +0 -2
- package/bin/bluelamp38 +0 -2
- package/bin/bluelamp39 +0 -2
- package/bin/bluelamp4 +0 -2
- package/bin/bluelamp40 +0 -2
- package/bin/bluelamp41 +0 -2
- package/bin/bluelamp42 +0 -2
- package/bin/bluelamp43 +0 -2
- package/bin/bluelamp44 +0 -2
- package/bin/bluelamp45 +0 -2
- package/bin/bluelamp46 +0 -2
- package/bin/bluelamp47 +0 -2
- package/bin/bluelamp48 +0 -2
- package/bin/bluelamp49 +0 -2
- package/bin/bluelamp5 +0 -2
- package/bin/bluelamp50 +0 -2
- package/bin/bluelamp51 +0 -2
- package/bin/bluelamp52 +0 -2
- package/bin/bluelamp53 +0 -2
- package/bin/bluelamp54 +0 -2
- package/bin/bluelamp55 +0 -2
- package/bin/bluelamp56 +0 -2
- package/bin/bluelamp57 +0 -2
- package/bin/bluelamp58 +0 -2
- package/bin/bluelamp59 +0 -2
- package/bin/bluelamp6 +0 -2
- package/bin/bluelamp60 +0 -2
- package/bin/bluelamp61 +0 -2
- package/bin/bluelamp62 +0 -2
- package/bin/bluelamp63 +0 -2
- package/bin/bluelamp64 +0 -2
- package/bin/bluelamp65 +0 -2
- package/bin/bluelamp66 +0 -2
- package/bin/bluelamp67 +0 -2
- package/bin/bluelamp68 +0 -2
- package/bin/bluelamp69 +0 -2
- package/bin/bluelamp7 +0 -2
- package/bin/bluelamp70 +0 -2
- package/bin/bluelamp71 +0 -2
- package/bin/bluelamp72 +0 -2
- package/bin/bluelamp73 +0 -2
- package/bin/bluelamp74 +0 -2
- package/bin/bluelamp75 +0 -2
- package/bin/bluelamp76 +0 -2
- package/bin/bluelamp77 +0 -2
- package/bin/bluelamp78 +0 -2
- package/bin/bluelamp79 +0 -2
- package/bin/bluelamp8 +0 -2
- package/bin/bluelamp80 +0 -2
- package/bin/bluelamp81 +0 -2
- package/bin/bluelamp82 +0 -2
- package/bin/bluelamp83 +0 -2
- package/bin/bluelamp84 +0 -2
- package/bin/bluelamp85 +0 -2
- package/bin/bluelamp86 +0 -2
- package/bin/bluelamp87 +0 -2
- package/bin/bluelamp88 +0 -2
- package/bin/bluelamp89 +0 -2
- package/bin/bluelamp9 +0 -2
- package/bin/bluelamp90 +0 -2
- package/bin/bluelamp91 +0 -2
- package/bin/bluelamp92 +0 -2
- package/bin/bluelamp93 +0 -2
- package/bin/bluelamp94 +0 -2
- package/bin/bluelamp95 +0 -2
- package/bin/bluelamp96 +0 -2
- package/bin/bluelamp97 +0 -2
- package/bin/bluelamp98 +0 -2
- package/bin/bluelamp99 +0 -2
package/lib/i18n/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const ja=require("./ja.json"),en=require("./en.json"),messages={ja:ja,en:en};let currentLanguage="ja";function setLanguage(e){e&&messages[e]&&(currentLanguage=e)}function getLanguage(){return currentLanguage}function t(e,n={}){const a=e.split(".");let t=messages[currentLanguage];for(const n of a){if(!t||"object"!=typeof t||!(n in t)){t=messages.ja;for(const n of a){if(!t||"object"!=typeof t||!(n in t))return e;t=t[n]}break}t=t[n]}return"string"!=typeof t?e:t.replace(/\{(\w+)\}/g,(e,a)=>void 0!==n[a]?String(n[a]):`{${a}}`)}const envLang=process.env.
|
|
1
|
+
const ja=require("./ja.json"),en=require("./en.json"),messages={ja:ja,en:en};let currentLanguage="ja";function setLanguage(e){e&&messages[e]&&(currentLanguage=e)}function getLanguage(){return currentLanguage}function t(e,n={}){const a=e.split(".");let t=messages[currentLanguage];for(const n of a){if(!t||"object"!=typeof t||!(n in t)){t=messages.ja;for(const n of a){if(!t||"object"!=typeof t||!(n in t))return e;t=t[n]}break}t=t[n]}return"string"!=typeof t?e:t.replace(/\{(\w+)\}/g,(e,a)=>void 0!==n[a]?String(n[a]):`{${a}}`)}const envLang=process.env.MUSUHI_LANGUAGE;envLang&&setLanguage(envLang),module.exports={t:t,setLanguage:setLanguage,getLanguage:getLanguage};
|
package/lib/i18n/ja.json
CHANGED
|
@@ -5,35 +5,35 @@
|
|
|
5
5
|
"undefinedCommand": "未定義のコマンド: {commandName}",
|
|
6
6
|
"customSlotConfig": "カスタムスロット設定: slot{slotNumber} → \"{keyword}\"",
|
|
7
7
|
"slotConfigError": "スロット設定取得エラー、デフォルトを使用: {error}",
|
|
8
|
-
"brandTitle": "
|
|
8
|
+
"brandTitle": "む す ひ — 産霊",
|
|
9
9
|
"commandInfo": "コマンド: {commandName}{slotInfo}",
|
|
10
10
|
"debugMode": "デバッグモード: 有効",
|
|
11
11
|
"logFile": "ログファイル: {path}",
|
|
12
12
|
"promptInfo": "プロンプト: {keyword}",
|
|
13
|
-
"initialPromptTitle": "
|
|
14
|
-
"initialPromptLoadContext": "
|
|
13
|
+
"initialPromptTitle": "さあ、産み出そう",
|
|
14
|
+
"initialPromptLoadContext": "このセッションではむすひMCPの参考資料 \"{keyword}\" が利用可能です。\nload_knowledge ツールで \"{keyword}\" を読み込んでから始めてください。",
|
|
15
15
|
"initialPromptKeywordNote": "MCPツールがまだ読み込まれていない場合は、少し待ってから再度お試しください。",
|
|
16
16
|
"initialPromptReady": "",
|
|
17
17
|
"launchingClaude": "Claude 起動中...",
|
|
18
|
-
"mcpServer": "MCP Server:
|
|
18
|
+
"mcpServer": "MCP Server: むすひ",
|
|
19
19
|
"knowledge": "Knowledge: {keyword}",
|
|
20
20
|
"debugInfo": "デバッグ情報:",
|
|
21
21
|
"debugCommand": "コマンド: {command}",
|
|
22
22
|
"debugArgs": "引数: {args}",
|
|
23
23
|
"debugConfigFile": "MCP設定ファイル: {path}",
|
|
24
|
-
"debugEnvKeyword": "環境変数
|
|
25
|
-
"debugEnvToken": "環境変数
|
|
24
|
+
"debugEnvKeyword": "環境変数 MUSUHI_KEYWORD: {keyword}",
|
|
25
|
+
"debugEnvToken": "環境変数 MUSUHI_TOKEN: {token}...",
|
|
26
26
|
"debugEnvPortal": "環境変数 PORTAL_URL: {url}",
|
|
27
27
|
"debugConfigContent": "MCP設定ファイル内容:",
|
|
28
28
|
"claudeStartError": "Claude 起動エラー: {error}",
|
|
29
|
-
"sessionEnd": "
|
|
30
|
-
"shuttingDown": "
|
|
29
|
+
"sessionEnd": "む す ひ セッション終了",
|
|
30
|
+
"shuttingDown": "む す ひ を終了しています...",
|
|
31
31
|
"unexpectedError": "予期しないエラー: {error}",
|
|
32
|
-
"authActivated": "
|
|
33
|
-
"extendedMode": "
|
|
32
|
+
"authActivated": "むすひ に接続しました",
|
|
33
|
+
"extendedMode": "むすひ に接続しました"
|
|
34
34
|
},
|
|
35
35
|
"auth": {
|
|
36
|
-
"portalAuthTitle": "
|
|
36
|
+
"portalAuthTitle": "む す ひ ─ 認証",
|
|
37
37
|
"checkingSavedToken": "保存されたトークンを確認中...",
|
|
38
38
|
"validationResult": "検証結果:",
|
|
39
39
|
"existingTokenValid": "既存のトークンが有効です",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"roleLabel": "ロール: {role}",
|
|
55
55
|
"usingCachedToken": "保存済みトークンを使用",
|
|
56
56
|
"firstLoginComplete": "初回ログイン完了",
|
|
57
|
-
"logoutTitle": "
|
|
57
|
+
"logoutTitle": "むすひ VSCode - ログアウト",
|
|
58
58
|
"confirmLogout": "ログイン情報を削除しますか? (y/N): ",
|
|
59
59
|
"logoutSuccess": "ログイン情報を削除しました",
|
|
60
60
|
"logoutNotFound": "ログイン情報が見つかりません",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"tokenSaveError": "トークン保存エラー: {error}",
|
|
74
74
|
"tokenLoadError": "トークン読み込みエラー: {error}",
|
|
75
75
|
"tokenDeleteError": "トークン削除エラー: {error}",
|
|
76
|
-
"invalidTokenFormat": "
|
|
76
|
+
"invalidTokenFormat": "CLI形式トークンのみサポートされています(CLI_xxx形式)",
|
|
77
77
|
"networkError": "ネットワークエラー: {error}",
|
|
78
78
|
"requestTimeout": "リクエストタイムアウト",
|
|
79
79
|
"responseParseError": "レスポンス解析エラー: {error}"
|
|
@@ -89,11 +89,11 @@
|
|
|
89
89
|
"knowledgeNotFound": "キーワード \"{keyword}\" に対応する知識が見つかりませんでした",
|
|
90
90
|
"portalApiFailed": "Portal APIから知識を取得できませんでした: {error}",
|
|
91
91
|
"knowledgeLoadError": "知識の読み込み中にエラーが発生しました: {error}",
|
|
92
|
-
"knowledgeLoadSuccess": "
|
|
92
|
+
"knowledgeLoadSuccess": "むすひ 専門コンテキスト読み込み完了",
|
|
93
93
|
"knowledgeApplied": "参考情報の読み込みが完了しました。上記の内容を参考にしてご支援ください。",
|
|
94
94
|
"violationReportFailed": "違反報告に失敗しました: {error}",
|
|
95
95
|
"violationReportError": "違反報告中にエラーが発生しました: {error}",
|
|
96
|
-
"noAuthToken": "認証トークンが設定されていません。
|
|
96
|
+
"noAuthToken": "認証トークンが設定されていません。musuhi login コマンドでログインしてください。",
|
|
97
97
|
"portalApiError": "Portal APIエラー (HTTP {status})",
|
|
98
98
|
"apiReturnedError": "APIがエラーを返しました",
|
|
99
99
|
"promptNotFoundForKeyword": "キーワード \"{keyword}\" に対応するプロンプトが見つかりませんでした",
|
package/lib/mcp-gmail/index.js
CHANGED
|
@@ -6,10 +6,10 @@ import { google } from 'googleapis';
|
|
|
6
6
|
import * as fs from 'node:fs';
|
|
7
7
|
import * as path from 'node:path';
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
const TOKEN_FILE_PATH = path.join(process.env.HOME || '/tmp', '.
|
|
9
|
+
// むすひ認証チェック
|
|
10
|
+
const TOKEN_FILE_PATH = path.join(process.env.HOME || '/tmp', '.musuhi', 'portal-token.enc');
|
|
11
11
|
if (!fs.existsSync(TOKEN_FILE_PATH)) {
|
|
12
|
-
console.error('❌
|
|
12
|
+
console.error('❌ むすひ認証が必要です。musuhiコマンドでログインしてください。');
|
|
13
13
|
process.exit(1);
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -20,7 +20,7 @@ const CREDENTIALS_PATH = path.join(CONFIG_DIR, 'credentials.json');
|
|
|
20
20
|
const ACCOUNTS_PATH = path.join(CONFIG_DIR, 'accounts.json');
|
|
21
21
|
// Legacy single-token path (for migration)
|
|
22
22
|
const LEGACY_TOKEN_PATH = path.join(CONFIG_DIR, 'token.json');
|
|
23
|
-
const SCOPES = ['https://www.googleapis.com/auth/gmail.readonly'
|
|
23
|
+
const SCOPES = ['https://www.googleapis.com/auth/gmail.readonly'];
|
|
24
24
|
const DEFAULT_TEXT_BODY_LIMIT = 10000;
|
|
25
25
|
// --- Account discovery ---
|
|
26
26
|
function getAccounts() {
|
|
@@ -293,36 +293,6 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
293
293
|
required: ['items'],
|
|
294
294
|
},
|
|
295
295
|
},
|
|
296
|
-
{
|
|
297
|
-
name: 'prepare_outbox',
|
|
298
|
-
description: 'Stage a new message for review with optional file attachments. Saved to outbox for user approval before delivery.',
|
|
299
|
-
inputSchema: {
|
|
300
|
-
type: 'object',
|
|
301
|
-
properties: {
|
|
302
|
-
account: { type: 'string', description: 'Sender email account' },
|
|
303
|
-
to: { type: 'array', items: { type: 'string' }, description: 'Recipient email addresses' },
|
|
304
|
-
cc: { type: 'array', items: { type: 'string' }, description: 'CC email addresses (optional)' },
|
|
305
|
-
bcc: { type: 'array', items: { type: 'string' }, description: 'BCC email addresses (optional)' },
|
|
306
|
-
subject: { type: 'string', description: 'Email subject' },
|
|
307
|
-
body: { type: 'string', description: 'Email body (plain text)' },
|
|
308
|
-
html_body: { type: 'string', description: 'Email body (HTML, optional - overrides body if set)' },
|
|
309
|
-
attachments: {
|
|
310
|
-
type: 'array',
|
|
311
|
-
items: {
|
|
312
|
-
type: 'object',
|
|
313
|
-
properties: {
|
|
314
|
-
file_path: { type: 'string', description: 'Absolute path to the file to attach' },
|
|
315
|
-
filename: { type: 'string', description: 'Override filename (optional, defaults to basename)' },
|
|
316
|
-
},
|
|
317
|
-
required: ['file_path'],
|
|
318
|
-
},
|
|
319
|
-
description: 'File attachments (optional)',
|
|
320
|
-
},
|
|
321
|
-
reply_to_message_id: { type: 'string', description: 'Gmail message ID to reply to (optional, sets In-Reply-To and References headers)' },
|
|
322
|
-
},
|
|
323
|
-
required: ['account', 'to', 'subject', 'body'],
|
|
324
|
-
},
|
|
325
|
-
},
|
|
326
296
|
],
|
|
327
297
|
}));
|
|
328
298
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
@@ -535,116 +505,6 @@ ${htmlBody}
|
|
|
535
505
|
}
|
|
536
506
|
return { content: [{ type: 'text', text: JSON.stringify(results, null, 2) }] };
|
|
537
507
|
}
|
|
538
|
-
case 'prepare_outbox': {
|
|
539
|
-
const { account, to, cc, bcc, subject, body, html_body, attachments, reply_to_message_id } = args;
|
|
540
|
-
const auth = getAuthenticatedClient(account);
|
|
541
|
-
if (!auth) {
|
|
542
|
-
return {
|
|
543
|
-
content: [{ type: 'text', text: `Account ${account} not authenticated. Use authorize_account first.` }],
|
|
544
|
-
isError: true,
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
const gmail = getGmail(auth);
|
|
548
|
-
const boundary = `boundary_${Date.now()}_${Math.random().toString(36).slice(2)}`;
|
|
549
|
-
const mimeLines = [];
|
|
550
|
-
mimeLines.push(`To: ${to.join(', ')}`);
|
|
551
|
-
if (cc?.length) mimeLines.push(`Cc: ${cc.join(', ')}`);
|
|
552
|
-
if (bcc?.length) mimeLines.push(`Bcc: ${bcc.join(', ')}`);
|
|
553
|
-
mimeLines.push(`Subject: =?UTF-8?B?${Buffer.from(subject).toString('base64')}?=`);
|
|
554
|
-
mimeLines.push('MIME-Version: 1.0');
|
|
555
|
-
if (reply_to_message_id) {
|
|
556
|
-
try {
|
|
557
|
-
const origMsg = await gmail.users.messages.get({ userId: 'me', id: reply_to_message_id, format: 'metadata', metadataHeaders: ['Message-ID'] });
|
|
558
|
-
const origMsgId = getHeader(origMsg.data.payload?.headers || [], 'Message-ID');
|
|
559
|
-
if (origMsgId) {
|
|
560
|
-
mimeLines.push(`In-Reply-To: ${origMsgId}`);
|
|
561
|
-
mimeLines.push(`References: ${origMsgId}`);
|
|
562
|
-
}
|
|
563
|
-
} catch {}
|
|
564
|
-
}
|
|
565
|
-
const hasAttachments = attachments?.length > 0;
|
|
566
|
-
if (hasAttachments) {
|
|
567
|
-
mimeLines.push(`Content-Type: multipart/mixed; boundary="${boundary}"`);
|
|
568
|
-
mimeLines.push('');
|
|
569
|
-
mimeLines.push(`--${boundary}`);
|
|
570
|
-
}
|
|
571
|
-
if (html_body) {
|
|
572
|
-
mimeLines.push('Content-Type: text/html; charset=UTF-8');
|
|
573
|
-
mimeLines.push('Content-Transfer-Encoding: base64');
|
|
574
|
-
mimeLines.push('');
|
|
575
|
-
mimeLines.push(Buffer.from(html_body).toString('base64'));
|
|
576
|
-
} else {
|
|
577
|
-
mimeLines.push('Content-Type: text/plain; charset=UTF-8');
|
|
578
|
-
mimeLines.push('Content-Transfer-Encoding: base64');
|
|
579
|
-
mimeLines.push('');
|
|
580
|
-
mimeLines.push(Buffer.from(body).toString('base64'));
|
|
581
|
-
}
|
|
582
|
-
if (hasAttachments) {
|
|
583
|
-
for (const att of attachments) {
|
|
584
|
-
const filePath = att.file_path;
|
|
585
|
-
if (!fs.existsSync(filePath)) {
|
|
586
|
-
return { content: [{ type: 'text', text: `Attachment file not found: ${filePath}` }], isError: true };
|
|
587
|
-
}
|
|
588
|
-
const fileData = fs.readFileSync(filePath);
|
|
589
|
-
const fileName = att.filename || path.basename(filePath);
|
|
590
|
-
const ext = path.extname(fileName).toLowerCase();
|
|
591
|
-
const mimeTypes = {
|
|
592
|
-
'.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
593
|
-
'.xls': 'application/vnd.ms-excel',
|
|
594
|
-
'.pdf': 'application/pdf',
|
|
595
|
-
'.csv': 'text/csv',
|
|
596
|
-
'.doc': 'application/msword',
|
|
597
|
-
'.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
598
|
-
'.zip': 'application/zip',
|
|
599
|
-
'.png': 'image/png',
|
|
600
|
-
'.jpg': 'image/jpeg',
|
|
601
|
-
'.jpeg': 'image/jpeg',
|
|
602
|
-
};
|
|
603
|
-
const mimeType = mimeTypes[ext] || 'application/octet-stream';
|
|
604
|
-
const encodedFilename = `=?UTF-8?B?${Buffer.from(fileName).toString('base64')}?=`;
|
|
605
|
-
mimeLines.push(`--${boundary}`);
|
|
606
|
-
mimeLines.push(`Content-Type: ${mimeType}; name="${encodedFilename}"`);
|
|
607
|
-
mimeLines.push(`Content-Disposition: attachment; filename="${encodedFilename}"`);
|
|
608
|
-
mimeLines.push('Content-Transfer-Encoding: base64');
|
|
609
|
-
mimeLines.push('');
|
|
610
|
-
mimeLines.push(fileData.toString('base64'));
|
|
611
|
-
}
|
|
612
|
-
mimeLines.push(`--${boundary}--`);
|
|
613
|
-
}
|
|
614
|
-
const rawMessage = mimeLines.join('\r\n');
|
|
615
|
-
const encodedMessage = Buffer.from(rawMessage)
|
|
616
|
-
.toString('base64')
|
|
617
|
-
.replace(/\+/g, '-')
|
|
618
|
-
.replace(/\//g, '_')
|
|
619
|
-
.replace(/=+$/, '');
|
|
620
|
-
const draft = await gmail.users.drafts.create({
|
|
621
|
-
userId: 'me',
|
|
622
|
-
requestBody: {
|
|
623
|
-
message: {
|
|
624
|
-
raw: encodedMessage,
|
|
625
|
-
threadId: reply_to_message_id ? (await gmail.users.messages.get({ userId: 'me', id: reply_to_message_id, format: 'minimal' })).data.threadId || undefined : undefined,
|
|
626
|
-
},
|
|
627
|
-
},
|
|
628
|
-
});
|
|
629
|
-
const attNames = hasAttachments
|
|
630
|
-
? attachments.map(a => a.filename || path.basename(a.file_path))
|
|
631
|
-
: [];
|
|
632
|
-
return {
|
|
633
|
-
content: [{
|
|
634
|
-
type: 'text',
|
|
635
|
-
text: JSON.stringify({
|
|
636
|
-
success: true,
|
|
637
|
-
draftId: draft.data.id,
|
|
638
|
-
messageId: draft.data.message?.id,
|
|
639
|
-
to,
|
|
640
|
-
cc: cc || [],
|
|
641
|
-
subject,
|
|
642
|
-
attachments: attNames,
|
|
643
|
-
message: 'Draft created successfully. Open Gmail to review and send.',
|
|
644
|
-
}, null, 2),
|
|
645
|
-
}],
|
|
646
|
-
};
|
|
647
|
-
}
|
|
648
508
|
default:
|
|
649
509
|
return {
|
|
650
510
|
content: [{ type: 'text', text: `Unknown tool: ${name}` }],
|
|
@@ -8,10 +8,10 @@ import { join } from "node:path";
|
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
9
|
import initSqlJs from "sql.js";
|
|
10
10
|
|
|
11
|
-
//
|
|
12
|
-
const TOKEN_FILE_PATH = join(homedir(), '.
|
|
11
|
+
// むすひ認証チェック
|
|
12
|
+
const TOKEN_FILE_PATH = join(homedir(), '.musuhi', 'portal-token.enc');
|
|
13
13
|
if (!existsSync(TOKEN_FILE_PATH)) {
|
|
14
|
-
console.error('❌
|
|
14
|
+
console.error('❌ むすひ認証が必要です。musuhiコマンドでログインしてください。');
|
|
15
15
|
process.exit(1);
|
|
16
16
|
}
|
|
17
17
|
const ALGORITHM = "aes-256-gcm";
|
package/lib/mcp-server/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const{Server:Server}=require("@modelcontextprotocol/sdk/server/index.js"),{StdioServerTransport:StdioServerTransport}=require("@modelcontextprotocol/sdk/server/stdio.js"),{CallToolRequestSchema:CallToolRequestSchema,ListToolsRequestSchema:ListToolsRequestSchema}=require("@modelcontextprotocol/sdk/types.js"),{getPromptFromPortal:getPromptFromPortal,
|
|
2
|
+
const{Server:Server}=require("@modelcontextprotocol/sdk/server/index.js"),{StdioServerTransport:StdioServerTransport}=require("@modelcontextprotocol/sdk/server/stdio.js"),{CallToolRequestSchema:CallToolRequestSchema,ListToolsRequestSchema:ListToolsRequestSchema}=require("@modelcontextprotocol/sdk/types.js"),{getPromptFromPortal:getPromptFromPortal,listAvailableMcps:listAvailableMcps,downloadMcpPackage:downloadMcpPackage}=require("./portal-api-client.cjs"),{logger:logger}=require("../utils/logger"),{t:t,setLanguage:setLanguage}=require("../i18n"),path=require("path"),fs=require("fs"),os=require("os"),dotenvLocalPath=path.join(__dirname,"../../.env.local"),dotenvPath=path.join(__dirname,"../../.env");fs.existsSync(dotenvLocalPath)?(require("dotenv").config({path:dotenvLocalPath}),logger.debug("[MCP Server] Loaded .env.local")):fs.existsSync(dotenvPath)&&(require("dotenv").config({path:dotenvPath}),logger.debug("[MCP Server] Loaded .env"));const KEYWORD=process.env.MUSUHI_KEYWORD||"BL-要件定義",TOKEN=process.env.MUSUHI_TOKEN,isDevEnv="development"===process.env.NODE_ENV||process.env.PORTAL_URL&&process.env.PORTAL_URL.includes("localhost"),PORTAL_URL=process.env.PORTAL_URL||(isDevEnv?"http://localhost:8432":"https://motohi-api-235426778039.asia-northeast1.run.app"),LANGUAGE=process.env.MUSUHI_LANGUAGE||"ja";setLanguage(LANGUAGE);const LOG_DIR=path.join(os.homedir(),".musuhi","logs"),LOG_FILE=path.join(LOG_DIR,"mcp.log");function log(e){const t=`[${(new Date).toISOString()}] ${e}\n`;fs.appendFileSync(LOG_FILE,t),logger.info(`[MCP Server] ${e}`)}fs.existsSync(LOG_DIR)||fs.mkdirSync(LOG_DIR,{recursive:!0}),log(`MCP Server started - Log file: ${LOG_FILE}`),log("Environment variables:"),log(` KEYWORD: ${KEYWORD}`),log(" TOKEN: "+(TOKEN?TOKEN.substring(0,20)+"...":"NOT SET")),log(` PORTAL_URL: ${PORTAL_URL}`),log(` LANGUAGE: ${LANGUAGE}`),log(` .env file exists: ${fs.existsSync(dotenvPath)}`);class MusuhiVSCodeServer{constructor(){this.server=new Server({name:"musuhi",version:"1.0.0"},{capabilities:{tools:{}}}),this.setupHandlers()}setupHandlers(){this.server.setRequestHandler(ListToolsRequestSchema,async()=>{log("[MCP Server] ListTools request received");const e={type:"object",properties:{keyword:{type:"string",description:t("mcp.keywordDescription")}},required:["keyword"]};return{tools:[{name:"load_knowledge",description:t("mcp.toolDescriptionLoadKnowledge"),annotations:{readOnlyHint:!0,idempotentHint:!0},inputSchema:e},{name:"list_mcps",description:"インストール可能なMCP一覧を取得します。カタログからアクセス可能なMCPを表示します。",annotations:{readOnlyHint:!0,idempotentHint:!0},inputSchema:{type:"object",properties:{category:{type:"string",description:"カテゴリでフィルタ(省略可)"}},required:[]}},{name:"install_mcp",description:"MCPをローカルにインストールします。list_mcpsで取得したmcpIdを指定してください。~/.claude/mcp-servers/ にファイルを展開し、~/.mcp.json に登録します。",annotations:{readOnlyHint:!1,idempotentHint:!0},inputSchema:{type:"object",properties:{mcp_id:{type:"string",description:'インストールするMCPのID(例: "my-prompts")'}},required:["mcp_id"]}}]}}),this.server.setRequestHandler(CallToolRequestSchema,async e=>{const{name:r}=e.params;if("load_knowledge"===r){const{keyword:r}=e.params.arguments;log(`[MCP Server] load_knowledge called with keyword: ${r}`),log("[MCP Server] TOKEN: "+(TOKEN?TOKEN.substring(0,20)+"...":"missing")),log(`[MCP Server] PORTAL_URL: ${PORTAL_URL}`),log(`[MCP Server] LANGUAGE: ${LANGUAGE}`);try{const e=await getPromptFromPortal(r,TOKEN,LANGUAGE);if(!e||!e.success){const n=e?.error||t("mcp.knowledgeNotFound",{keyword:r});return log(`[MCP Server] Knowledge loading failed: ${n}`),{content:[{type:"text",text:`❌ ${t("mcp.portalApiFailed",{error:n})}`}],isError:!0}}const n="ja"!==LANGUAGE?"\n\n[Note] The user's preferred language is English.":"";return{content:[{type:"text",text:`✅ ${t("mcp.knowledgeLoadSuccess")}\n\n${e.knowledge}${n}\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n${t("mcp.knowledgeApplied")}`}]}}catch(e){return log(`[MCP Server] Exception in load_knowledge: ${e.message}`),{content:[{type:"text",text:`❌ ${t("mcp.knowledgeLoadError",{error:e.message})}`}],isError:!0}}}if("list_mcps"===r){const{category:t}=e.params.arguments||{};log(`[MCP Server] list_mcps called: category=${t||"all"}`);try{const e=t?{category:t}:{},r=await listAvailableMcps(e,TOKEN,LANGUAGE);if(!r||!r.success)return{content:[{type:"text",text:`❌ MCPカタログの取得に失敗: ${r?.error||"Unknown"}`}],isError:!0};const n=r.data||[];if(0===n.length)return{content:[{type:"text",text:"📦 インストール可能なMCPはありません。"}]};let o=`📦 インストール可能なMCP一覧 (${n.length}件)\n\n`;return n.forEach(e=>{const t=e.hasAccess?"✅":"🔒",r=e.isOfficial?" [公式]":"";o+=`${t} **${e.name}**${r}\n`,o+=` ID: ${e.mcpId}\n`,o+=` ${e.description}\n`,o+=` カテゴリ: ${e.category} | ツール数: ${e.toolCount}\n\n`}),o+='\nインストールするには: install_mcp(mcp_id: "MCP_ID")',{content:[{type:"text",text:o}]}}catch(e){return log(`[MCP Server] list_mcps error: ${e.message}`),{content:[{type:"text",text:`❌ ${e.message}`}],isError:!0}}}if("install_mcp"===r){const{mcp_id:t}=e.params.arguments;log(`[MCP Server] install_mcp called: mcp_id=${t}`);try{const e=await downloadMcpPackage(t,TOKEN);if(!e||!e.success)return{content:[{type:"text",text:`❌ MCPダウンロードに失敗: ${e?.error||"Unknown"}`}],isError:!0};const r=e.data,n=r.files||[];if(0===n.length)return{content:[{type:"text",text:"❌ MCPパッケージにファイルが含まれていません。"}],isError:!0};const o=path.join(os.homedir(),".claude","mcp-servers",t);fs.mkdirSync(o,{recursive:!0});for(const e of n){const t=path.join(o,e.path),r=path.dirname(t);fs.mkdirSync(r,{recursive:!0}),fs.writeFileSync(t,e.content,"utf-8")}log(`[MCP Server] install_mcp: ${n.length} files written to ${o}`);const s=r.packageSource||{};if(s.needsNpmInstall&&fs.existsSync(path.join(o,"package.json"))){log(`[MCP Server] install_mcp: running npm install in ${o}`);const{execSync:e}=require("child_process");try{e("npm install --production",{cwd:o,timeout:6e4,stdio:"pipe"}),log("[MCP Server] install_mcp: npm install completed")}catch(e){return log(`[MCP Server] install_mcp: npm install failed: ${e.message}`),{content:[{type:"text",text:`⚠️ ファイル展開は完了しましたが、npm installに失敗しました: ${e.message}\n手動で cd ${o} && npm install を実行してください。`}]}}}const i=path.join(os.homedir(),".mcp.json");let c={mcpServers:{}};if(fs.existsSync(i))try{c=JSON.parse(fs.readFileSync(i,"utf-8")),c.mcpServers||(c.mcpServers={})}catch(e){log("[MCP Server] install_mcp: failed to parse ~/.mcp.json, creating new")}const a=s.entryPoint||"lib/index.cjs",l=s.configTarget||"home-mcp";if("home-mcp"===l){c.mcpServers[t]={command:"node",args:[path.join(o,a)],env:{}};const e=s.requiredEnvVars||[];for(const r of e)c.mcpServers[t].env[r]=process.env[r]||`<SET_YOUR_${r}>`;fs.writeFileSync(i,JSON.stringify(c,null,2),"utf-8"),log("[MCP Server] install_mcp: registered in ~/.mcp.json")}let p=`✅ MCP「${s.name||t}」をインストールしました\n\n`;p+=`📁 インストール先: ${o}\n`,p+=`📄 ファイル数: ${n.length}\n`,"home-mcp"===l&&(p+="⚙️ ~/.mcp.json に登録済み\n"),s.installNotes&&(p+=`\n📝 ${s.installNotes}\n`);const d=s.requiredEnvVars||[];if(d.length>0){const e=d.filter(e=>!process.env[e]);e.length>0&&(p+="\n⚠️ 以下の環境変数を ~/.mcp.json で設定してください:\n",e.forEach(e=>{p+=` - ${e}\n`}))}return p+="\nClaude Codeを再起動すると使用可能になります。",{content:[{type:"text",text:p}]}}catch(e){return log(`[MCP Server] install_mcp error: ${e.message}`),{content:[{type:"text",text:`❌ ${e.message}`}],isError:!0}}}return{content:[{type:"text",text:`Unknown tool: ${e.params.name}`}],isError:!0}})}async run(){const e=new StdioServerTransport;if(await this.server.connect(e),logger.info("むすひ VSCode MCP server started"),KEYWORD&&TOKEN){log(`[MCP Server] Auto-loading knowledge for keyword: ${KEYWORD} (lang: ${LANGUAGE})`);const e=await getPromptFromPortal(KEYWORD,TOKEN,LANGUAGE);e&&e.success?log(`[MCP Server] Auto-load successful: ${e.title}`):log(`[MCP Server] Auto-load failed for keyword: ${KEYWORD}`)}}}const server=new MusuhiVSCodeServer;server.run().catch(e=>logger.error(e.message));
|