chaimi-bookkeeping-mcp 2.3.9 → 2.3.10
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 +1 -1
- package/server.js +13 -25
- package/test-parent-process.js +49 -0
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -97,7 +97,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
name: 'save_receipt',
|
|
100
|
-
description: '
|
|
100
|
+
description: '【图片小票专用】保存购物小票/发票/收据(支持单商品或多商品)。当用户提供图片形式的小票、发票时,无论商品数量多少(1条或多条),都必须使用此接口。可自动识别商家名称、商品明细、金额、优惠等信息。典型场景:超市购物小票、餐厅发票、线上订单截图、手写收据照片等',
|
|
101
101
|
inputSchema: {
|
|
102
102
|
type: 'object',
|
|
103
103
|
properties: {
|
|
@@ -313,30 +313,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
313
313
|
|
|
314
314
|
switch (name) {
|
|
315
315
|
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
316
|
const mcpParams = convertParams('save_expense', processedArgs);
|
|
341
317
|
result = await callMcpHub('addExpense', mcpParams, token);
|
|
342
318
|
|
|
@@ -375,7 +351,19 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
375
351
|
);
|
|
376
352
|
|
|
377
353
|
if (fillResult.success) {
|
|
354
|
+
const savedAgentType = processedArgs.agentType;
|
|
355
|
+
const savedApiProvider = processedArgs.apiProvider;
|
|
356
|
+
const savedRawInput = processedArgs.rawInput;
|
|
378
357
|
processedArgs = fillResult.data;
|
|
358
|
+
if (savedAgentType) {
|
|
359
|
+
processedArgs.agentType = savedAgentType;
|
|
360
|
+
}
|
|
361
|
+
if (savedApiProvider) {
|
|
362
|
+
processedArgs.apiProvider = savedApiProvider;
|
|
363
|
+
}
|
|
364
|
+
if (savedRawInput) {
|
|
365
|
+
processedArgs.rawInput = savedRawInput;
|
|
366
|
+
}
|
|
379
367
|
}
|
|
380
368
|
}
|
|
381
369
|
|
|
@@ -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));
|