chaimi-keep-mcp 3.1.26 → 3.1.28

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 (3) hide show
  1. package/README.md +1 -3
  2. package/bin/cli.js +87 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -13,9 +13,7 @@
13
13
  **如果您是 AI Agent 开发者,请注意:**
14
14
 
15
15
  1. **不要缓存工具定义**:MCP 工具定义可能会更新,请在每次调用前通过 `mcporter list` 获取最新定义
16
- 2. **关注版本号**:工具描述中包含版本号(如【v3.1.21】),版本变化时请更新您的 Skill
17
- 3. **save_receipt 工具要求**:items 数组中每个商品必须包含完整的4个字段:`name`、`amount`、`price`、`quantity`
18
- 4. **自动填充字段**:`agentType`、`apiProvider`、`rawInput`、`mcp_version` 为自动填充字段,无需用户输入
16
+ 2. **save_receipt 工具要求**:items 数组中每个商品必须包含完整的4个字段:`name`、`amount`、`price`、`quantity`
19
17
 
20
18
  ## 快速安装
21
19
 
package/bin/cli.js CHANGED
@@ -31,7 +31,7 @@ const DEFAULT_CHAIMI_CONFIG = {
31
31
  lifecycle: 'keep-alive'
32
32
  };
33
33
 
34
- // 支持的 Agent 列表
34
+ // 支持的 Agent 列表(MCP 配置)
35
35
  const SUPPORTED_AGENTS = [
36
36
  {
37
37
  name: 'MCPorter (WorkBuddy/OpenClaw)',
@@ -74,6 +74,30 @@ const SUPPORTED_AGENTS = [
74
74
  }
75
75
  ];
76
76
 
77
+ // 支持的 Skill 目录(OpenClaw/WorkBuddy 架构)
78
+ const SKILL_DIRECTORIES = [
79
+ {
80
+ name: 'OpenClaw',
81
+ skillPath: path.join(os.homedir(), '.openclaw', 'skills', 'chaimi-keep-mcp'),
82
+ platform: 'darwin'
83
+ },
84
+ {
85
+ name: 'OpenClaw (Linux)',
86
+ skillPath: path.join(os.homedir(), '.openclaw', 'skills', 'chaimi-keep-mcp'),
87
+ platform: 'linux'
88
+ },
89
+ {
90
+ name: 'WorkBuddy',
91
+ skillPath: path.join(os.homedir(), '.workbuddy', 'skills', 'chaimi-keep-mcp'),
92
+ platform: 'darwin'
93
+ },
94
+ {
95
+ name: 'WorkBuddy (Windows)',
96
+ skillPath: path.join(os.homedir(), 'workbuddy', 'skills', 'chaimi-keep-mcp'),
97
+ platform: 'win32'
98
+ }
99
+ ];
100
+
77
101
  /**
78
102
  * 安全读取 JSON 文件
79
103
  */
@@ -156,6 +180,62 @@ function installToAgent(agent) {
156
180
  }
157
181
  }
158
182
 
183
+ /**
184
+ * 同步 SKILL.md 到 Skill 目录
185
+ * 用于 OpenClaw/WorkBuddy 等支持 Skill 文件的 Agent
186
+ */
187
+ function syncSkillFiles() {
188
+ const skillSourcePath = path.join(__dirname, '..', 'SKILL.md');
189
+
190
+ if (!fs.existsSync(skillSourcePath)) {
191
+ return { success: false, reason: 'source-not-found' };
192
+ }
193
+
194
+ const results = [];
195
+
196
+ for (const skillDir of SKILL_DIRECTORIES) {
197
+ try {
198
+ // 平台检查
199
+ if (skillDir.platform && skillDir.platform !== os.platform()) {
200
+ continue;
201
+ }
202
+
203
+ // 检查父目录是否存在(Agent 是否安装)
204
+ const parentDir = path.dirname(skillDir.skillPath);
205
+ if (!fs.existsSync(parentDir)) {
206
+ continue; // Agent 未安装,跳过
207
+ }
208
+
209
+ // 创建 skill 目录
210
+ if (!fs.existsSync(skillDir.skillPath)) {
211
+ fs.mkdirSync(skillDir.skillPath, { recursive: true });
212
+ }
213
+
214
+ // 复制 SKILL.md
215
+ const targetPath = path.join(skillDir.skillPath, 'SKILL.md');
216
+ fs.copyFileSync(skillSourcePath, targetPath);
217
+
218
+ results.push({
219
+ agent: skillDir.name,
220
+ success: true,
221
+ path: targetPath
222
+ });
223
+
224
+ console.error(`✓ ${skillDir.name}: Skill 文件已同步`);
225
+
226
+ } catch (error) {
227
+ results.push({
228
+ agent: skillDir.name,
229
+ success: false,
230
+ error: error.message
231
+ });
232
+ console.error(`✗ ${skillDir.name}: Skill 同步失败 (${error.message})`);
233
+ }
234
+ }
235
+
236
+ return results;
237
+ }
238
+
159
239
  /**
160
240
  * 配置所有支持的 Agent
161
241
  * 注意:所有输出使用 console.error,避免污染 stdout(MCP 协议通信使用 stdout)
@@ -165,6 +245,7 @@ function configureAllAgents() {
165
245
 
166
246
  const results = [];
167
247
 
248
+ // 1. 配置 MCP Server
168
249
  for (const agent of SUPPORTED_AGENTS) {
169
250
  const result = installToAgent(agent);
170
251
  results.push({ agent: agent.name, ...result });
@@ -187,13 +268,17 @@ function configureAllAgents() {
187
268
  }
188
269
  }
189
270
 
271
+ // 2. 同步 Skill 文件
272
+ console.error('\n📋 正在同步 Skill 文件...\n');
273
+ syncSkillFiles();
274
+
190
275
  // 统计
191
276
  const configured = results.filter(r => r.success && r.action !== 'skipped').length;
192
277
  const skipped = results.filter(r => r.success && r.action === 'skipped').length;
193
278
  const failed = results.filter(r => !r.success).length;
194
279
 
195
280
  console.error('\n📊 配置统计:');
196
- console.error(` 新增配置: ${configured} 个`);
281
+ console.error(` 新增 MCP 配置: ${configured} 个`);
197
282
  console.error(` 已存在: ${skipped} 个`);
198
283
  if (failed > 0) {
199
284
  console.error(` 失败: ${failed} 个`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chaimi-keep-mcp",
3
- "version": "3.1.26",
3
+ "version": "3.1.28",
4
4
  "description": "柴米记账 MCP Server - 支持 Claude、Cursor、OpenClaw、WorkBuddy 等 AI 工具直接记账",
5
5
  "main": "server.js",
6
6
  "bin": {