@prmichaelsen/remember-mcp 2.5.0 → 2.5.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.
package/dist/server.js CHANGED
@@ -3283,33 +3283,72 @@ var ConfirmationTokenService = class {
3283
3283
  * @returns Request ID and token
3284
3284
  */
3285
3285
  async createRequest(userId, action, payload, targetCollection) {
3286
- const token = randomUUID();
3287
- const now = /* @__PURE__ */ new Date();
3288
- const expiresAt = new Date(now.getTime() + this.EXPIRY_MINUTES * 60 * 1e3);
3289
- const request = {
3290
- user_id: userId,
3291
- token,
3292
- action,
3293
- target_collection: targetCollection,
3294
- payload,
3295
- created_at: now.toISOString(),
3296
- expires_at: expiresAt.toISOString(),
3297
- status: "pending"
3298
- };
3299
- const collectionPath = `users/${userId}/requests`;
3300
- console.log("[ConfirmationTokenService] Creating request:", {
3301
- userId,
3302
- action,
3303
- targetCollection,
3304
- collectionPath
3305
- });
3306
- const docRef = await addDocument(collectionPath, request);
3307
- console.log("[ConfirmationTokenService] Request created:", {
3308
- requestId: docRef.id,
3309
- token,
3310
- expiresAt: request.expires_at
3311
- });
3312
- return { requestId: docRef.id, token };
3286
+ try {
3287
+ const token = randomUUID();
3288
+ const now = /* @__PURE__ */ new Date();
3289
+ const expiresAt = new Date(now.getTime() + this.EXPIRY_MINUTES * 60 * 1e3);
3290
+ const request = {
3291
+ user_id: userId,
3292
+ token,
3293
+ action,
3294
+ target_collection: targetCollection,
3295
+ payload,
3296
+ created_at: now.toISOString(),
3297
+ expires_at: expiresAt.toISOString(),
3298
+ status: "pending"
3299
+ };
3300
+ const collectionPath = `users/${userId}/requests`;
3301
+ console.log("[ConfirmationTokenService] Creating request:", {
3302
+ userId,
3303
+ action,
3304
+ targetCollection,
3305
+ collectionPath,
3306
+ requestData: {
3307
+ token,
3308
+ action,
3309
+ payloadKeys: Object.keys(payload)
3310
+ }
3311
+ });
3312
+ console.log("[ConfirmationTokenService] Calling addDocument...");
3313
+ const docRef = await addDocument(collectionPath, request);
3314
+ console.log("[ConfirmationTokenService] addDocument returned:", {
3315
+ hasDocRef: !!docRef,
3316
+ hasId: !!docRef?.id,
3317
+ docRefId: docRef?.id
3318
+ });
3319
+ if (!docRef) {
3320
+ const error = new Error("Firestore addDocument returned null/undefined");
3321
+ console.error("[ConfirmationTokenService] CRITICAL: addDocument returned null", {
3322
+ userId,
3323
+ collectionPath
3324
+ });
3325
+ throw error;
3326
+ }
3327
+ if (!docRef.id) {
3328
+ const error = new Error("Firestore addDocument returned docRef without ID");
3329
+ console.error("[ConfirmationTokenService] CRITICAL: docRef has no ID", {
3330
+ userId,
3331
+ collectionPath,
3332
+ docRef
3333
+ });
3334
+ throw error;
3335
+ }
3336
+ console.log("[ConfirmationTokenService] Request created successfully:", {
3337
+ requestId: docRef.id,
3338
+ token,
3339
+ expiresAt: request.expires_at
3340
+ });
3341
+ return { requestId: docRef.id, token };
3342
+ } catch (error) {
3343
+ console.error("[ConfirmationTokenService] FAILED to create request:", {
3344
+ error: error instanceof Error ? error.message : String(error),
3345
+ stack: error instanceof Error ? error.stack : void 0,
3346
+ userId,
3347
+ action,
3348
+ collectionPath: `users/${userId}/requests`
3349
+ });
3350
+ throw error;
3351
+ }
3313
3352
  }
3314
3353
  /**
3315
3354
  * Validate and retrieve a confirmation request
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prmichaelsen/remember-mcp",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "Multi-tenant memory system MCP server with vector search and relationships",
5
5
  "main": "dist/server.js",
6
6
  "type": "module",
@@ -50,40 +50,84 @@ export class ConfirmationTokenService {
50
50
  payload: any,
51
51
  targetCollection?: string
52
52
  ): Promise<{ requestId: string; token: string }> {
53
- const token = randomUUID();
53
+ try {
54
+ const token = randomUUID();
54
55
 
55
- const now = new Date();
56
- const expiresAt = new Date(now.getTime() + this.EXPIRY_MINUTES * 60 * 1000);
56
+ const now = new Date();
57
+ const expiresAt = new Date(now.getTime() + this.EXPIRY_MINUTES * 60 * 1000);
57
58
 
58
- const request: ConfirmationRequest = {
59
- user_id: userId,
60
- token,
61
- action,
62
- target_collection: targetCollection,
63
- payload,
64
- created_at: now.toISOString(),
65
- expires_at: expiresAt.toISOString(),
66
- status: 'pending',
67
- };
59
+ const request: ConfirmationRequest = {
60
+ user_id: userId,
61
+ token,
62
+ action,
63
+ target_collection: targetCollection,
64
+ payload,
65
+ created_at: now.toISOString(),
66
+ expires_at: expiresAt.toISOString(),
67
+ status: 'pending',
68
+ };
68
69
 
69
- // Add document to Firestore (auto-generates ID)
70
- const collectionPath = `users/${userId}/requests`;
71
- console.log('[ConfirmationTokenService] Creating request:', {
72
- userId,
73
- action,
74
- targetCollection,
75
- collectionPath,
76
- });
77
-
78
- const docRef = await addDocument(collectionPath, request);
79
-
80
- console.log('[ConfirmationTokenService] Request created:', {
81
- requestId: docRef.id,
82
- token,
83
- expiresAt: request.expires_at,
84
- });
70
+ // Add document to Firestore (auto-generates ID)
71
+ const collectionPath = `users/${userId}/requests`;
72
+ console.log('[ConfirmationTokenService] Creating request:', {
73
+ userId,
74
+ action,
75
+ targetCollection,
76
+ collectionPath,
77
+ requestData: {
78
+ token,
79
+ action,
80
+ payloadKeys: Object.keys(payload),
81
+ },
82
+ });
83
+
84
+ console.log('[ConfirmationTokenService] Calling addDocument...');
85
+ const docRef = await addDocument(collectionPath, request);
86
+ console.log('[ConfirmationTokenService] addDocument returned:', {
87
+ hasDocRef: !!docRef,
88
+ hasId: !!docRef?.id,
89
+ docRefId: docRef?.id,
90
+ });
91
+
92
+ // Validate docRef
93
+ if (!docRef) {
94
+ const error = new Error('Firestore addDocument returned null/undefined');
95
+ console.error('[ConfirmationTokenService] CRITICAL: addDocument returned null', {
96
+ userId,
97
+ collectionPath,
98
+ });
99
+ throw error;
100
+ }
101
+
102
+ if (!docRef.id) {
103
+ const error = new Error('Firestore addDocument returned docRef without ID');
104
+ console.error('[ConfirmationTokenService] CRITICAL: docRef has no ID', {
105
+ userId,
106
+ collectionPath,
107
+ docRef,
108
+ });
109
+ throw error;
110
+ }
111
+
112
+ console.log('[ConfirmationTokenService] Request created successfully:', {
113
+ requestId: docRef.id,
114
+ token,
115
+ expiresAt: request.expires_at,
116
+ });
85
117
 
86
- return { requestId: docRef.id, token };
118
+ return { requestId: docRef.id, token };
119
+ } catch (error) {
120
+ console.error('[ConfirmationTokenService] FAILED to create request:', {
121
+ error: error instanceof Error ? error.message : String(error),
122
+ stack: error instanceof Error ? error.stack : undefined,
123
+ userId,
124
+ action,
125
+ collectionPath: `users/${userId}/requests`,
126
+ });
127
+
128
+ // Re-throw so caller (tool handler) can catch and return error response
129
+ throw error;
130
+ }
87
131
  }
88
132
 
89
133
  /**