chaimi-bookkeeping-mcp 2.4.4 → 3.0.2

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/package.json +1 -1
  2. package/server.js +34 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chaimi-bookkeeping-mcp",
3
- "version": "2.4.4",
3
+ "version": "3.0.2",
4
4
  "description": "柴米记账 MCP Server - 支持 Claude、Cursor、OpenClaw、WorkBuddy 等 AI 工具直接记账",
5
5
  "main": "server.js",
6
6
  "bin": {
package/server.js CHANGED
@@ -190,6 +190,16 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
190
190
  required: ['name', 'amount'],
191
191
  },
192
192
  },
193
+ {
194
+ name: 'get_parse_prompt',
195
+ description: '获取小票图片解析的Prompt模板,用于指导大模型如何格式化输出小票信息。返回的Prompt应作为system message,配合小票图片作为user message调用大模型',
196
+ inputSchema: {
197
+ type: 'object',
198
+ properties: {
199
+ type: { type: 'string', description: 'Prompt类型,如:parseReceipt', default: 'parseReceipt' },
200
+ },
201
+ },
202
+ },
193
203
  ],
194
204
  };
195
205
  });
@@ -424,6 +434,30 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
424
434
  break;
425
435
  }
426
436
 
437
+ case 'get_parse_prompt': {
438
+ const promptType = args.type || 'parseReceipt';
439
+ const promptResult = await callMcpPrompt('getPrompt', { type: promptType }, token);
440
+
441
+ if (promptResult.success) {
442
+ result = {
443
+ success: true,
444
+ data: {
445
+ type: promptType,
446
+ version: promptResult.data.version,
447
+ systemPrompt: promptResult.data.systemPrompt,
448
+ userPromptTemplate: promptResult.data.userPromptTemplate,
449
+ examples: promptResult.data.examples,
450
+ instructions: '请将 systemPrompt 作为 system message,把小票图片作为 user message,调用你的大模型进行解析。解析完成后,调用 save_receipt 工具保存结果。'
451
+ }
452
+ };
453
+ userMessage = `✅ 获取解析Prompt成功\n\n版本: ${promptResult.data.version}\n\n## System Prompt\n\n请将以下内容作为 system message 发送给大模型:\n\n\`\`\`\n${promptResult.data.systemPrompt}\n\`\`\`\n\n## 使用说明\n\n1. 将上面的 System Prompt 作为 system message\n2. 将小票图片作为 user message\n3. 调用大模型解析\n4. 解析完成后,调用 save_receipt 工具保存结果\n\n## 示例\n\n${JSON.stringify(promptResult.data.examples, null, 2)}`;
454
+ } else {
455
+ result = { success: false, error: promptResult.error };
456
+ userMessage = `❌ 获取Prompt失败:${promptResult.error}`;
457
+ }
458
+ break;
459
+ }
460
+
427
461
  default:
428
462
  throw new Error(`未知工具: ${name}`);
429
463
  }