chaimi-bookkeeping-mcp 2.3.9 → 2.3.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chaimi-bookkeeping-mcp",
3
- "version": "2.3.9",
3
+ "version": "2.3.11",
4
4
  "description": "柴米记账 MCP Server - 支持 Claude、Cursor、OpenClaw、WorkBuddy 等 AI 工具直接记账",
5
5
  "main": "server.js",
6
6
  "bin": {
package/server.js CHANGED
@@ -86,6 +86,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
86
86
  amount: { type: 'number', description: '金额(必填)' },
87
87
  category: { type: 'string', description: '分类(可选,如:餐饮、食品、交通)' },
88
88
  store: { type: 'string', description: '商家名称(可选)' },
89
+ date: { type: 'string', description: '消费时间(ISO格式)(可选)' },
89
90
  note: { type: 'string', description: '备注(可选)' },
90
91
  agentType: { type: 'string', description: '【推荐自动填充】Agent类型,如:claude-desktop、cursor、openclaw、workbuddy、trae' },
91
92
  apiProvider: { type: 'string', description: '【推荐自动填充】AI服务提供商,如:anthropic、openai、doubao、aliyun' },
@@ -97,7 +98,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
97
98
  },
98
99
  {
99
100
  name: 'save_receipt',
100
- description: '【图片小票专用】保存购物小票/发票/收据(支持单商品或多商品)。当用户提供图片形式的小票、发票、收据、购物清单时,无论商品数量多少(1条或多条),都必须使用此接口。可自动识别商家名称、商品明细、金额、优惠等信息。典型场景:超市购物小票、餐厅发票、线上订单截图、手写收据照片等',
101
+ description: '【图片小票专用】保存购物小票/发票/收据(支持单商品或多商品)。当用户提供图片形式的小票、发票时,无论商品数量多少(1条或多条),都必须使用此接口。可自动识别商家名称、商品明细、金额、优惠等信息。典型场景:超市购物小票、餐厅发票、线上订单截图、手写收据照片等',
101
102
  inputSchema: {
102
103
  type: 'object',
103
104
  properties: {
@@ -179,6 +180,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
179
180
  amount: { type: 'number', description: '收入金额' },
180
181
  category: { type: 'string', description: '收入分类(如:工资、奖金、投资)' },
181
182
  store: { type: 'string', description: '付款方(如:公司名称)' },
183
+ date: { type: 'string', description: '收入时间(ISO格式)(可选)' },
182
184
  note: { type: 'string', description: '备注' },
183
185
  agentType: { type: 'string', description: '【推荐自动填充】Agent类型,如:claude-desktop、cursor、openclaw、workbuddy、trae' },
184
186
  apiProvider: { type: 'string', description: '【推荐自动填充】AI服务提供商,如:anthropic、openai、doubao、aliyun' },
@@ -313,30 +315,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
313
315
 
314
316
  switch (name) {
315
317
  case 'save_expense': {
316
- const validationResult = await callMcpPrompt(
317
- 'validateResult',
318
- {
319
- data: processedArgs,
320
- type: 'parseText'
321
- },
322
- token
323
- );
324
-
325
- if (validationResult.success && !validationResult.data.valid) {
326
- const fillResult = await callMcpPrompt(
327
- 'fillDefaults',
328
- {
329
- data: processedArgs,
330
- type: 'parseText'
331
- },
332
- token
333
- );
334
-
335
- if (fillResult.success) {
336
- processedArgs = fillResult.data;
337
- }
338
- }
339
-
340
318
  const mcpParams = convertParams('save_expense', processedArgs);
341
319
  result = await callMcpHub('addExpense', mcpParams, token);
342
320
 
@@ -375,7 +353,23 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
375
353
  );
376
354
 
377
355
  if (fillResult.success) {
356
+ const savedAgentType = processedArgs.agentType;
357
+ const savedApiProvider = processedArgs.apiProvider;
358
+ const savedRawInput = processedArgs.rawInput;
359
+ const savedDate = processedArgs.date;
378
360
  processedArgs = fillResult.data;
361
+ if (savedAgentType) {
362
+ processedArgs.agentType = savedAgentType;
363
+ }
364
+ if (savedApiProvider) {
365
+ processedArgs.apiProvider = savedApiProvider;
366
+ }
367
+ if (savedRawInput) {
368
+ processedArgs.rawInput = savedRawInput;
369
+ }
370
+ if (savedDate) {
371
+ processedArgs.date = savedDate;
372
+ }
379
373
  }
380
374
  }
381
375
 
@@ -539,6 +533,7 @@ function convertParams(toolName, args) {
539
533
  unit: '',
540
534
  weight: '',
541
535
  marketPrice: '',
536
+ date: args.date,
542
537
  note: sanitizeString(args.note, 500) || '',
543
538
  rawInput: sanitizeString(args.rawInput, 1000) || '',
544
539
  agentType: args.agentType || '',
@@ -593,6 +588,7 @@ function convertParams(toolName, args) {
593
588
  memberCardNo: sanitizeString(args.memberCardNo, 50),
594
589
  currentPoints: parseInt(args.currentPoints) || 0,
595
590
  totalPoints: parseInt(args.totalPoints) || 0,
591
+ date: args.date,
596
592
  rawInput: sanitizeString(args.rawInput, 2000),
597
593
  agentType: args.agentType || '',
598
594
  apiProvider: args.apiProvider || '',
@@ -620,6 +616,7 @@ function convertParams(toolName, args) {
620
616
  amount: validateAmount(args.amount),
621
617
  category: sanitizeString(args.category, 50) || '其他',
622
618
  store: sanitizeString(args.store, 100),
619
+ date: args.date,
623
620
  note: sanitizeString(args.note, 500),
624
621
  transactionType: 'income',
625
622
  rawInput: sanitizeString(args.rawInput, 1000),
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require('child_process');
4
+ const os = require('os');
5
+
6
+ console.log('='.repeat(60));
7
+ console.log('父进程信息检测工具');
8
+ console.log('='.repeat(60));
9
+
10
+ console.log('\n1. 当前进程信息:');
11
+ console.log(` PID: ${process.pid}`);
12
+ console.log(` 父进程 PID (PPID): ${process.ppid}`);
13
+ console.log(` 当前平台: ${process.platform}`);
14
+
15
+ console.log('\n2. 尝试获取父进程信息:');
16
+
17
+ if (process.platform === 'darwin' || process.platform === 'linux') {
18
+ try {
19
+ const psOutput = execSync(`ps -p ${process.ppid} -o pid,ppid,command`, { encoding: 'utf8' });
20
+ console.log(' ' + psOutput.replace(/\n/g, '\n '));
21
+
22
+ const ppidOutput = execSync(`ps -p ${process.ppid} -o command=`, { encoding: 'utf8' }).trim();
23
+ console.log(`\n 父进程命令: ${ppidOutput}`);
24
+
25
+ const guessAgentType = (cmd) => {
26
+ if (/claude/i.test(cmd)) return 'claude-desktop';
27
+ if (/cursor/i.test(cmd)) return 'cursor';
28
+ if (/continue/i.test(cmd)) return 'continue';
29
+ if (/zed/i.test(cmd)) return 'zed';
30
+ if (/workbuddy/i.test(cmd)) return 'workbuddy';
31
+ if (/openclaw/i.test(cmd)) return 'openclaw';
32
+ return 'unknown';
33
+ };
34
+
35
+ console.log(` 猜测的 Agent 类型: ${guessAgentType(ppidOutput)}`);
36
+
37
+ } catch (e) {
38
+ console.log(` 获取父进程信息失败: ${e.message}`);
39
+ }
40
+ } else if (process.platform === 'win32') {
41
+ try {
42
+ const wmicOutput = execSync(`wmic process where processid=${process.ppid} get processid,parentprocessid,commandline`, { encoding: 'utf8' });
43
+ console.log(' ' + wmicOutput.replace(/\n/g, '\n '));
44
+ } catch (e) {
45
+ console.log(` 获取父进程信息失败: ${e.message}`);
46
+ }
47
+ }
48
+
49
+ console.log('\n' + '='.repeat(60));