chaimi-keep-mcp 3.3.1 → 3.3.2-beta.1

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 +102 -102
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chaimi-keep-mcp",
3
- "version": "3.3.1",
3
+ "version": "3.3.2-beta.1",
4
4
  "description": "柴米记账 MCP Server - 支持 Claude、Cursor、OpenClaw、WorkBuddy 等 AI 工具直接记账",
5
5
  "main": "server.js",
6
6
  "bin": {
package/server.js CHANGED
@@ -648,56 +648,56 @@ function getOSInfo() {
648
648
 
649
649
  // 调用 mcpHub 云函数(带日志和链路追踪)
650
650
  async function callMcpHubWithLogging(tool, params, token, traceId, startTime, osInfo, agentType, apiProvider) {
651
- // 记录即将调用云函数
652
- logMcpCall({
653
- traceId,
654
- stage: 'cloud_calling',
655
- toolName: tool,
656
- params: sanitizeLogParams(params),
657
- agentType: agentType || '',
658
- apiProvider: apiProvider || '',
659
- mcpVersion: MCP_VERSION,
660
- osType: osInfo?.osType,
661
- osVersion: osInfo?.osVersion,
662
- timestamp: new Date().toISOString(),
663
- logSource: 'mcp'
664
- });
651
+ // 记录即将调用云函数(已停用:MCP调用日志待迁移到独立云函数)
652
+ // logMcpCall({
653
+ // traceId,
654
+ // stage: 'cloud_calling',
655
+ // toolName: tool,
656
+ // params: sanitizeLogParams(params),
657
+ // agentType: agentType || '',
658
+ // apiProvider: apiProvider || '',
659
+ // mcpVersion: MCP_VERSION,
660
+ // osType: osInfo?.osType,
661
+ // osVersion: osInfo?.osVersion,
662
+ // timestamp: new Date().toISOString(),
663
+ // logSource: 'mcp'
664
+ // });
665
665
 
666
666
  try {
667
667
  const result = await callMcpHub(tool, params, token, traceId, osInfo);
668
668
 
669
- // 记录云函数调用成功
670
- logMcpCall({
671
- traceId,
672
- stage: 'cloud_success',
673
- toolName: tool,
674
- duration: Date.now() - startTime,
675
- agentType: agentType || '',
676
- apiProvider: apiProvider || '',
677
- mcpVersion: MCP_VERSION,
678
- osType: osInfo?.osType,
679
- osVersion: osInfo?.osVersion,
680
- timestamp: new Date().toISOString(),
681
- logSource: 'mcp'
682
- });
669
+ // 记录云函数调用成功(已停用:MCP调用日志待迁移到独立云函数)
670
+ // logMcpCall({
671
+ // traceId,
672
+ // stage: 'cloud_success',
673
+ // toolName: tool,
674
+ // duration: Date.now() - startTime,
675
+ // agentType: agentType || '',
676
+ // apiProvider: apiProvider || '',
677
+ // mcpVersion: MCP_VERSION,
678
+ // osType: osInfo?.osType,
679
+ // osVersion: osInfo?.osVersion,
680
+ // timestamp: new Date().toISOString(),
681
+ // logSource: 'mcp'
682
+ // });
683
683
 
684
684
  return result;
685
685
  } catch (cloudErr) {
686
- // 记录云函数调用失败
687
- logMcpCall({
688
- traceId,
689
- stage: 'cloud_failed',
690
- toolName: tool,
691
- error: cloudErr.message,
692
- duration: Date.now() - startTime,
693
- agentType: agentType || '',
694
- apiProvider: apiProvider || '',
695
- mcpVersion: MCP_VERSION,
696
- osType: osInfo?.osType,
697
- osVersion: osInfo?.osVersion,
698
- timestamp: new Date().toISOString(),
699
- logSource: 'mcp'
700
- });
686
+ // 记录云函数调用失败(已停用:MCP调用日志待迁移到独立云函数)
687
+ // logMcpCall({
688
+ // traceId,
689
+ // stage: 'cloud_failed',
690
+ // toolName: tool,
691
+ // error: cloudErr.message,
692
+ // duration: Date.now() - startTime,
693
+ // agentType: agentType || '',
694
+ // apiProvider: apiProvider || '',
695
+ // mcpVersion: MCP_VERSION,
696
+ // osType: osInfo?.osType,
697
+ // osVersion: osInfo?.osVersion,
698
+ // timestamp: new Date().toISOString(),
699
+ // logSource: 'mcp'
700
+ // });
701
701
  throw cloudErr;
702
702
  }
703
703
  }
@@ -783,20 +783,20 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
783
783
  const agentType = args.agentType || process.env.AGENT_TYPE || process.env.MCP_AGENT_TYPE || '';
784
784
  const apiProvider = args.apiProvider || process.env.API_PROVIDER || process.env.MCP_API_PROVIDER || '';
785
785
 
786
- // 记录请求到达
787
- logMcpCall({
788
- traceId,
789
- stage: 'request_received',
790
- toolName: name,
791
- params: sanitizeLogParams(args),
792
- agentType: args.agentType || process.env.AGENT_TYPE || process.env.MCP_AGENT_TYPE || '',
793
- apiProvider: args.apiProvider || process.env.API_PROVIDER || process.env.MCP_API_PROVIDER || '',
794
- mcpVersion: MCP_VERSION,
795
- osType: osInfo.osType,
796
- osVersion: osInfo.osVersion,
797
- timestamp: new Date().toISOString(),
798
- logSource: 'mcp'
799
- });
786
+ // 记录请求到达(已停用:MCP调用日志待迁移到独立云函数)
787
+ // logMcpCall({
788
+ // traceId,
789
+ // stage: 'request_received',
790
+ // toolName: name,
791
+ // params: sanitizeLogParams(args),
792
+ // agentType: args.agentType || process.env.AGENT_TYPE || process.env.MCP_AGENT_TYPE || '',
793
+ // apiProvider: args.apiProvider || process.env.API_PROVIDER || process.env.MCP_API_PROVIDER || '',
794
+ // mcpVersion: MCP_VERSION,
795
+ // osType: osInfo.osType,
796
+ // osVersion: osInfo.osVersion,
797
+ // timestamp: new Date().toISOString(),
798
+ // logSource: 'mcp'
799
+ // });
800
800
 
801
801
  // 检查频率限制
802
802
  const rateLimitResult = checkRateLimit(name);
@@ -805,21 +805,21 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
805
805
  ? `${rateLimitResult.waitSeconds} 秒`
806
806
  : `${Math.ceil(rateLimitResult.waitSeconds / 60)} 分钟`;
807
807
 
808
- // 记录限流日志
809
- logMcpCall({
810
- traceId,
811
- stage: 'rate_limited',
812
- toolName: name,
813
- error: 'RATE_LIMIT_EXCEEDED',
814
- duration: Date.now() - startTime,
815
- agentType,
816
- apiProvider,
817
- mcpVersion: MCP_VERSION,
818
- osType: osInfo.osType,
819
- osVersion: osInfo.osVersion,
820
- timestamp: new Date().toISOString(),
821
- logSource: 'mcp'
822
- });
808
+ // 记录限流日志(已停用:MCP调用日志待迁移到独立云函数)
809
+ // logMcpCall({
810
+ // traceId,
811
+ // stage: 'rate_limited',
812
+ // toolName: name,
813
+ // error: 'RATE_LIMIT_EXCEEDED',
814
+ // duration: Date.now() - startTime,
815
+ // agentType,
816
+ // apiProvider,
817
+ // mcpVersion: MCP_VERSION,
818
+ // osType: osInfo.osType,
819
+ // osVersion: osInfo.osVersion,
820
+ // timestamp: new Date().toISOString(),
821
+ // logSource: 'mcp'
822
+ // });
823
823
 
824
824
  return {
825
825
  content: [
@@ -841,21 +841,21 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
841
841
  const now = Date.now();
842
842
  const lastReadTime = getLastSkillReadTime();
843
843
  if (now - lastReadTime > SKILL_VALID_DURATION) {
844
- // 记录校验失败
845
- logMcpCall({
846
- traceId,
847
- stage: 'validation_failed',
848
- toolName: name,
849
- error: 'SKILL_NOT_READ',
850
- duration: Date.now() - startTime,
851
- agentType: args.agentType || process.env.AGENT_TYPE || process.env.MCP_AGENT_TYPE || '',
852
- apiProvider: args.apiProvider || process.env.API_PROVIDER || process.env.MCP_API_PROVIDER || '',
853
- mcpVersion: MCP_VERSION,
854
- osType: osInfo.osType,
855
- osVersion: osInfo.osVersion,
856
- timestamp: new Date().toISOString(),
857
- logSource: 'mcp'
858
- });
844
+ // 记录校验失败(已停用:MCP调用日志待迁移到独立云函数)
845
+ // logMcpCall({
846
+ // traceId,
847
+ // stage: 'validation_failed',
848
+ // toolName: name,
849
+ // error: 'SKILL_NOT_READ',
850
+ // duration: Date.now() - startTime,
851
+ // agentType: args.agentType || process.env.AGENT_TYPE || process.env.MCP_AGENT_TYPE || '',
852
+ // apiProvider: args.apiProvider || process.env.API_PROVIDER || process.env.MCP_API_PROVIDER || '',
853
+ // mcpVersion: MCP_VERSION,
854
+ // osType: osInfo.osType,
855
+ // osVersion: osInfo.osVersion,
856
+ // timestamp: new Date().toISOString(),
857
+ // logSource: 'mcp'
858
+ // });
859
859
  return {
860
860
  content: [
861
861
  {
@@ -1639,21 +1639,21 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1639
1639
  ],
1640
1640
  };
1641
1641
  } catch (error) {
1642
- // 记录异常错误
1643
- logMcpCall({
1644
- traceId,
1645
- stage: 'mcp_error',
1646
- toolName: name,
1647
- error: error.message,
1648
- duration: Date.now() - startTime,
1649
- agentType: agentType || '',
1650
- apiProvider: apiProvider || '',
1651
- mcpVersion: MCP_VERSION,
1652
- osType: osInfo.osType,
1653
- osVersion: osInfo.osVersion,
1654
- timestamp: new Date().toISOString(),
1655
- logSource: 'mcp'
1656
- });
1642
+ // 记录异常错误(已停用:MCP调用日志待迁移到独立云函数)
1643
+ // logMcpCall({
1644
+ // traceId,
1645
+ // stage: 'mcp_error',
1646
+ // toolName: name,
1647
+ // error: error.message,
1648
+ // duration: Date.now() - startTime,
1649
+ // agentType: agentType || '',
1650
+ // apiProvider: apiProvider || '',
1651
+ // mcpVersion: MCP_VERSION,
1652
+ // osType: osInfo.osType,
1653
+ // osVersion: osInfo.osVersion,
1654
+ // timestamp: new Date().toISOString(),
1655
+ // logSource: 'mcp'
1656
+ // });
1657
1657
 
1658
1658
  // 处理授权错误
1659
1659
  if (error.message.startsWith('NEED_AUTH:')) {