chaimi-keep-mcp 3.3.0-beta.2 → 3.3.0-beta.3

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 +19 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chaimi-keep-mcp",
3
- "version": "3.3.0-beta.2",
3
+ "version": "3.3.0-beta.3",
4
4
  "description": "柴米记账 MCP Server - 支持 Claude、Cursor、OpenClaw、WorkBuddy 等 AI 工具直接记账",
5
5
  "main": "server.js",
6
6
  "bin": {
package/server.js CHANGED
@@ -475,10 +475,27 @@ async function getToken() {
475
475
 
476
476
  // 【优化2】尝试从文件加载 token(优先级高于授权状态检查)
477
477
  try {
478
+ console.error('🔍 [DEBUG] 尝试从文件加载 Token...');
478
479
  const existingToken = await oauthManager.tokenStorage.load();
480
+ console.error('🔍 [DEBUG] Token 加载结果:', existingToken ? '成功' : '为空');
481
+ if (existingToken) {
482
+ console.error('🔍 [DEBUG] Token 字段检查:', {
483
+ hasAccessToken: !!existingToken.accessToken,
484
+ hasExpiresAt: !!existingToken.expiresAt,
485
+ expiresAt: existingToken.expiresAt
486
+ });
487
+ }
479
488
  if (existingToken && existingToken.accessToken && existingToken.expiresAt) {
480
489
  const expiresAt = new Date(existingToken.expiresAt).getTime();
481
- if (expiresAt > Date.now() + 5 * 60 * 1000) {
490
+ const now = Date.now();
491
+ const threshold = now + 5 * 60 * 1000;
492
+ console.error('🔍 [DEBUG] 过期时间检查:', {
493
+ expiresAt,
494
+ now,
495
+ threshold,
496
+ isValid: expiresAt > threshold
497
+ });
498
+ if (expiresAt > threshold) {
482
499
  // Token 有效,直接使用
483
500
  cachedToken = existingToken.accessToken;
484
501
  tokenExpireTime = expiresAt;
@@ -492,6 +509,7 @@ async function getToken() {
492
509
  }
493
510
  } catch (err) {
494
511
  console.error('⚠️ 加载保存的 Token 失败:', err.message);
512
+ console.error('⚠️ 错误堆栈:', err.stack);
495
513
  }
496
514
 
497
515
  // 【优化3】Token 不存在或已过期,检查是否需要授权