@prmichaelsen/remember-mcp 1.0.7 → 2.0.0
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-factory.js +87 -253
- package/package.json +1 -1
- package/src/server-factory.ts +0 -64
package/dist/server-factory.js
CHANGED
|
@@ -12,16 +12,9 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
12
12
|
return require.apply(this, arguments);
|
|
13
13
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
14
|
});
|
|
15
|
-
var __esm = (fn, res) => function __init() {
|
|
16
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
17
|
-
};
|
|
18
15
|
var __commonJS = (cb, mod) => function __require2() {
|
|
19
16
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
20
17
|
};
|
|
21
|
-
var __export = (target, all) => {
|
|
22
|
-
for (var name in all)
|
|
23
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
24
|
-
};
|
|
25
18
|
var __copyProps = (to, from, except, desc) => {
|
|
26
19
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
20
|
for (let key of __getOwnPropNames(from))
|
|
@@ -397,56 +390,98 @@ var require_main = __commonJS({
|
|
|
397
390
|
}
|
|
398
391
|
});
|
|
399
392
|
|
|
393
|
+
// src/server-factory.ts
|
|
394
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
395
|
+
import {
|
|
396
|
+
CallToolRequestSchema,
|
|
397
|
+
ListToolsRequestSchema,
|
|
398
|
+
ErrorCode,
|
|
399
|
+
McpError
|
|
400
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
401
|
+
|
|
400
402
|
// src/config.ts
|
|
401
|
-
var import_dotenv,
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
403
|
+
var import_dotenv = __toESM(require_main(), 1);
|
|
404
|
+
import_dotenv.default.config();
|
|
405
|
+
var config = {
|
|
406
|
+
// Weaviate
|
|
407
|
+
weaviate: {
|
|
408
|
+
url: process.env.WEAVIATE_REST_URL || "http://localhost:8080",
|
|
409
|
+
apiKey: process.env.WEAVIATE_API_KEY || ""
|
|
410
|
+
},
|
|
411
|
+
// OpenAI (for embeddings)
|
|
412
|
+
openai: {
|
|
413
|
+
apiKey: process.env.OPENAI_EMBEDDINGS_API_KEY || process.env.OPENAI_APIKEY || ""
|
|
414
|
+
},
|
|
415
|
+
// Firebase (using firebase-admin-sdk-v8)
|
|
416
|
+
firebase: {
|
|
417
|
+
serviceAccount: process.env.FIREBASE_ADMIN_SERVICE_ACCOUNT_KEY || "",
|
|
418
|
+
projectId: process.env.FIREBASE_PROJECT_ID || ""
|
|
419
|
+
},
|
|
420
|
+
// Server
|
|
421
|
+
server: {
|
|
422
|
+
port: parseInt(process.env.PORT || "3000", 10),
|
|
423
|
+
nodeEnv: process.env.NODE_ENV || "development",
|
|
424
|
+
logLevel: process.env.LOG_LEVEL || "info"
|
|
425
|
+
},
|
|
426
|
+
// MCP
|
|
427
|
+
mcp: {
|
|
428
|
+
transport: process.env.MCP_TRANSPORT || "sse"
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
// src/utils/logger.ts
|
|
433
|
+
var LOG_LEVELS = {
|
|
434
|
+
debug: 0,
|
|
435
|
+
info: 1,
|
|
436
|
+
warn: 2,
|
|
437
|
+
error: 3
|
|
438
|
+
};
|
|
439
|
+
var currentLevel = LOG_LEVELS[config.server.logLevel] ?? LOG_LEVELS.info;
|
|
440
|
+
function shouldLog(level) {
|
|
441
|
+
return LOG_LEVELS[level] >= currentLevel;
|
|
442
|
+
}
|
|
443
|
+
var logger = {
|
|
444
|
+
debug: (message, data) => {
|
|
445
|
+
if (shouldLog("debug")) {
|
|
446
|
+
if (data) {
|
|
447
|
+
console.debug(JSON.stringify({ level: "DEBUG", message, ...data }));
|
|
448
|
+
} else {
|
|
449
|
+
console.debug(`[DEBUG] ${message}`);
|
|
431
450
|
}
|
|
432
|
-
}
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
info: (message, data) => {
|
|
454
|
+
if (shouldLog("info")) {
|
|
455
|
+
if (data) {
|
|
456
|
+
console.info(JSON.stringify({ level: "INFO", message, ...data }));
|
|
457
|
+
} else {
|
|
458
|
+
console.info(`[INFO] ${message}`);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
warn: (message, data) => {
|
|
463
|
+
if (shouldLog("warn")) {
|
|
464
|
+
if (data) {
|
|
465
|
+
console.warn(JSON.stringify({ level: "WARN", message, ...data }));
|
|
466
|
+
} else {
|
|
467
|
+
console.warn(`[WARN] ${message}`);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
error: (message, data) => {
|
|
472
|
+
if (shouldLog("error")) {
|
|
473
|
+
if (data) {
|
|
474
|
+
console.error(JSON.stringify({ level: "ERROR", message, ...data }));
|
|
475
|
+
} else {
|
|
476
|
+
console.error(`[ERROR] ${message}`);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
433
479
|
}
|
|
434
|
-
}
|
|
480
|
+
};
|
|
435
481
|
|
|
436
482
|
// src/weaviate/client.ts
|
|
437
|
-
var client_exports = {};
|
|
438
|
-
__export(client_exports, {
|
|
439
|
-
closeWeaviateClient: () => closeWeaviateClient,
|
|
440
|
-
collectionExists: () => collectionExists,
|
|
441
|
-
getAuditCollectionName: () => getAuditCollectionName,
|
|
442
|
-
getMemoryCollectionName: () => getMemoryCollectionName,
|
|
443
|
-
getTemplateCollectionName: () => getTemplateCollectionName,
|
|
444
|
-
getWeaviateClient: () => getWeaviateClient,
|
|
445
|
-
initWeaviateClient: () => initWeaviateClient,
|
|
446
|
-
sanitizeUserId: () => sanitizeUserId,
|
|
447
|
-
testWeaviateConnection: () => testWeaviateConnection
|
|
448
|
-
});
|
|
449
483
|
import weaviate from "weaviate-client";
|
|
484
|
+
var client = null;
|
|
450
485
|
async function initWeaviateClient() {
|
|
451
486
|
if (client) {
|
|
452
487
|
return client;
|
|
@@ -483,17 +518,6 @@ function getWeaviateClient() {
|
|
|
483
518
|
}
|
|
484
519
|
return client;
|
|
485
520
|
}
|
|
486
|
-
async function testWeaviateConnection() {
|
|
487
|
-
try {
|
|
488
|
-
const weaviateClient = getWeaviateClient();
|
|
489
|
-
const isReady = await weaviateClient.isReady();
|
|
490
|
-
console.log("[Weaviate] Connection successful, ready:", isReady);
|
|
491
|
-
return isReady;
|
|
492
|
-
} catch (error) {
|
|
493
|
-
console.error("[Weaviate] Connection failed:", error);
|
|
494
|
-
return false;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
521
|
function sanitizeUserId(userId) {
|
|
498
522
|
let sanitized = userId.replace(/[^a-zA-Z0-9]/g, "_");
|
|
499
523
|
if (/^[0-9]/.test(sanitized)) {
|
|
@@ -501,56 +525,8 @@ function sanitizeUserId(userId) {
|
|
|
501
525
|
}
|
|
502
526
|
return sanitized.charAt(0).toUpperCase() + sanitized.slice(1);
|
|
503
527
|
}
|
|
504
|
-
function getMemoryCollectionName(userId) {
|
|
505
|
-
return `Memory_${sanitizeUserId(userId)}`;
|
|
506
|
-
}
|
|
507
|
-
function getTemplateCollectionName(userId) {
|
|
508
|
-
return `Template_${sanitizeUserId(userId)}`;
|
|
509
|
-
}
|
|
510
|
-
function getAuditCollectionName(userId) {
|
|
511
|
-
return `Audit_${sanitizeUserId(userId)}`;
|
|
512
|
-
}
|
|
513
|
-
async function collectionExists(collectionName) {
|
|
514
|
-
try {
|
|
515
|
-
const weaviateClient = getWeaviateClient();
|
|
516
|
-
const exists = await weaviateClient.collections.exists(collectionName);
|
|
517
|
-
return exists;
|
|
518
|
-
} catch (error) {
|
|
519
|
-
console.error(`[Weaviate] Error checking collection ${collectionName}:`, error);
|
|
520
|
-
return false;
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
async function closeWeaviateClient() {
|
|
524
|
-
if (client) {
|
|
525
|
-
client = null;
|
|
526
|
-
console.log("[Weaviate] Client closed");
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
var client;
|
|
530
|
-
var init_client = __esm({
|
|
531
|
-
"src/weaviate/client.ts"() {
|
|
532
|
-
"use strict";
|
|
533
|
-
init_config();
|
|
534
|
-
client = null;
|
|
535
|
-
}
|
|
536
|
-
});
|
|
537
528
|
|
|
538
529
|
// src/firestore/init.ts
|
|
539
|
-
var init_exports = {};
|
|
540
|
-
__export(init_exports, {
|
|
541
|
-
FieldValue: () => FieldValue,
|
|
542
|
-
addDocument: () => addDocument,
|
|
543
|
-
batchWrite: () => batchWrite,
|
|
544
|
-
deleteDocument: () => deleteDocument,
|
|
545
|
-
getDocument: () => getDocument,
|
|
546
|
-
initFirestore: () => initFirestore,
|
|
547
|
-
isFirestoreInitialized: () => isFirestoreInitialized,
|
|
548
|
-
queryDocuments: () => queryDocuments,
|
|
549
|
-
setDocument: () => setDocument,
|
|
550
|
-
testFirestoreConnection: () => testFirestoreConnection,
|
|
551
|
-
updateDocument: () => updateDocument,
|
|
552
|
-
verifyIdToken: () => verifyIdToken
|
|
553
|
-
});
|
|
554
530
|
import { initializeApp } from "@prmichaelsen/firebase-admin-sdk-v8";
|
|
555
531
|
import {
|
|
556
532
|
getDocument,
|
|
@@ -563,6 +539,7 @@ import {
|
|
|
563
539
|
FieldValue,
|
|
564
540
|
verifyIdToken
|
|
565
541
|
} from "@prmichaelsen/firebase-admin-sdk-v8";
|
|
542
|
+
var initialized = false;
|
|
566
543
|
function initFirestore() {
|
|
567
544
|
if (initialized) {
|
|
568
545
|
return;
|
|
@@ -582,98 +559,8 @@ function initFirestore() {
|
|
|
582
559
|
throw error;
|
|
583
560
|
}
|
|
584
561
|
}
|
|
585
|
-
function isFirestoreInitialized() {
|
|
586
|
-
return initialized;
|
|
587
|
-
}
|
|
588
|
-
async function testFirestoreConnection() {
|
|
589
|
-
try {
|
|
590
|
-
if (!initialized) {
|
|
591
|
-
throw new Error("Firestore not initialized");
|
|
592
|
-
}
|
|
593
|
-
const { getDocument: getDocument2 } = await import("@prmichaelsen/firebase-admin-sdk-v8");
|
|
594
|
-
await getDocument2("_health_check", "test");
|
|
595
|
-
console.log("[Firestore] Connection successful");
|
|
596
|
-
return true;
|
|
597
|
-
} catch (error) {
|
|
598
|
-
console.error("[Firestore] Connection test failed:", error);
|
|
599
|
-
return false;
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
var initialized;
|
|
603
|
-
var init_init = __esm({
|
|
604
|
-
"src/firestore/init.ts"() {
|
|
605
|
-
"use strict";
|
|
606
|
-
init_config();
|
|
607
|
-
initialized = false;
|
|
608
|
-
}
|
|
609
|
-
});
|
|
610
|
-
|
|
611
|
-
// src/server-factory.ts
|
|
612
|
-
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
613
|
-
import {
|
|
614
|
-
CallToolRequestSchema,
|
|
615
|
-
ListToolsRequestSchema,
|
|
616
|
-
ErrorCode,
|
|
617
|
-
McpError
|
|
618
|
-
} from "@modelcontextprotocol/sdk/types.js";
|
|
619
|
-
|
|
620
|
-
// src/utils/logger.ts
|
|
621
|
-
init_config();
|
|
622
|
-
var LOG_LEVELS = {
|
|
623
|
-
debug: 0,
|
|
624
|
-
info: 1,
|
|
625
|
-
warn: 2,
|
|
626
|
-
error: 3
|
|
627
|
-
};
|
|
628
|
-
var currentLevel = LOG_LEVELS[config.server.logLevel] ?? LOG_LEVELS.info;
|
|
629
|
-
function shouldLog(level) {
|
|
630
|
-
return LOG_LEVELS[level] >= currentLevel;
|
|
631
|
-
}
|
|
632
|
-
var logger = {
|
|
633
|
-
debug: (message, data) => {
|
|
634
|
-
if (shouldLog("debug")) {
|
|
635
|
-
if (data) {
|
|
636
|
-
console.debug(JSON.stringify({ level: "DEBUG", message, ...data }));
|
|
637
|
-
} else {
|
|
638
|
-
console.debug(`[DEBUG] ${message}`);
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
},
|
|
642
|
-
info: (message, data) => {
|
|
643
|
-
if (shouldLog("info")) {
|
|
644
|
-
if (data) {
|
|
645
|
-
console.info(JSON.stringify({ level: "INFO", message, ...data }));
|
|
646
|
-
} else {
|
|
647
|
-
console.info(`[INFO] ${message}`);
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
},
|
|
651
|
-
warn: (message, data) => {
|
|
652
|
-
if (shouldLog("warn")) {
|
|
653
|
-
if (data) {
|
|
654
|
-
console.warn(JSON.stringify({ level: "WARN", message, ...data }));
|
|
655
|
-
} else {
|
|
656
|
-
console.warn(`[WARN] ${message}`);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
},
|
|
660
|
-
error: (message, data) => {
|
|
661
|
-
if (shouldLog("error")) {
|
|
662
|
-
if (data) {
|
|
663
|
-
console.error(JSON.stringify({ level: "ERROR", message, ...data }));
|
|
664
|
-
} else {
|
|
665
|
-
console.error(`[ERROR] ${message}`);
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
};
|
|
670
|
-
|
|
671
|
-
// src/server-factory.ts
|
|
672
|
-
init_client();
|
|
673
|
-
init_init();
|
|
674
562
|
|
|
675
563
|
// src/weaviate/schema.ts
|
|
676
|
-
init_client();
|
|
677
564
|
import weaviate2 from "weaviate-client";
|
|
678
565
|
async function createMemoryCollection(userId) {
|
|
679
566
|
const client2 = getWeaviateClient();
|
|
@@ -2740,9 +2627,6 @@ async function handleDeleteRelationship(args, userId) {
|
|
|
2740
2627
|
}
|
|
2741
2628
|
}
|
|
2742
2629
|
|
|
2743
|
-
// src/services/preferences-database.service.ts
|
|
2744
|
-
init_init();
|
|
2745
|
-
|
|
2746
2630
|
// src/firestore/paths.ts
|
|
2747
2631
|
var APP_NAME = "remember-mcp";
|
|
2748
2632
|
function getBasePrefix() {
|
|
@@ -3227,14 +3111,6 @@ function registerHandlers(server, userId, accessToken) {
|
|
|
3227
3111
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
3228
3112
|
return {
|
|
3229
3113
|
tools: [
|
|
3230
|
-
{
|
|
3231
|
-
name: "health_check",
|
|
3232
|
-
description: "Check server health and database connections",
|
|
3233
|
-
inputSchema: {
|
|
3234
|
-
type: "object",
|
|
3235
|
-
properties: {}
|
|
3236
|
-
}
|
|
3237
|
-
},
|
|
3238
3114
|
// Memory tools
|
|
3239
3115
|
createMemoryTool,
|
|
3240
3116
|
searchMemoryTool,
|
|
@@ -3258,9 +3134,6 @@ function registerHandlers(server, userId, accessToken) {
|
|
|
3258
3134
|
try {
|
|
3259
3135
|
let result;
|
|
3260
3136
|
switch (name) {
|
|
3261
|
-
case "health_check":
|
|
3262
|
-
result = await handleHealthCheck(userId);
|
|
3263
|
-
break;
|
|
3264
3137
|
case "remember_create_memory":
|
|
3265
3138
|
result = await handleCreateMemory(args, userId);
|
|
3266
3139
|
break;
|
|
@@ -3323,45 +3196,6 @@ function registerHandlers(server, userId, accessToken) {
|
|
|
3323
3196
|
}
|
|
3324
3197
|
});
|
|
3325
3198
|
}
|
|
3326
|
-
async function handleHealthCheck(userId) {
|
|
3327
|
-
const health = {
|
|
3328
|
-
status: "healthy",
|
|
3329
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3330
|
-
userId,
|
|
3331
|
-
server: {
|
|
3332
|
-
name: "remember-mcp",
|
|
3333
|
-
version: "0.1.0"
|
|
3334
|
-
},
|
|
3335
|
-
databases: {
|
|
3336
|
-
weaviate: {
|
|
3337
|
-
connected: false,
|
|
3338
|
-
userCollection: `Memory_${userId}`
|
|
3339
|
-
},
|
|
3340
|
-
firestore: {
|
|
3341
|
-
connected: false,
|
|
3342
|
-
userPath: `users/${userId}`
|
|
3343
|
-
}
|
|
3344
|
-
}
|
|
3345
|
-
};
|
|
3346
|
-
try {
|
|
3347
|
-
const { getWeaviateClient: getWeaviateClient2 } = await Promise.resolve().then(() => (init_client(), client_exports));
|
|
3348
|
-
const weaviateClient = getWeaviateClient2();
|
|
3349
|
-
health.databases.weaviate.connected = await weaviateClient.isReady();
|
|
3350
|
-
} catch (error) {
|
|
3351
|
-
logger.error("Weaviate health check failed:", error);
|
|
3352
|
-
health.databases.weaviate.connected = false;
|
|
3353
|
-
}
|
|
3354
|
-
try {
|
|
3355
|
-
const { testFirestoreConnection: testFirestoreConnection2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
3356
|
-
health.databases.firestore.connected = await testFirestoreConnection2();
|
|
3357
|
-
} catch (error) {
|
|
3358
|
-
logger.error("Firestore health check failed:", error);
|
|
3359
|
-
health.databases.firestore.connected = false;
|
|
3360
|
-
}
|
|
3361
|
-
const allHealthy = health.databases.weaviate.connected && health.databases.firestore.connected;
|
|
3362
|
-
health.status = allHealthy ? "healthy" : "degraded";
|
|
3363
|
-
return JSON.stringify(health, null, 2);
|
|
3364
|
-
}
|
|
3365
3199
|
export {
|
|
3366
3200
|
createServer
|
|
3367
3201
|
};
|
package/package.json
CHANGED
package/src/server-factory.ts
CHANGED
|
@@ -158,14 +158,6 @@ function registerHandlers(server: Server, userId: string, accessToken: string):
|
|
|
158
158
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
159
159
|
return {
|
|
160
160
|
tools: [
|
|
161
|
-
{
|
|
162
|
-
name: 'health_check',
|
|
163
|
-
description: 'Check server health and database connections',
|
|
164
|
-
inputSchema: {
|
|
165
|
-
type: 'object',
|
|
166
|
-
properties: {},
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
161
|
// Memory tools
|
|
170
162
|
createMemoryTool,
|
|
171
163
|
searchMemoryTool,
|
|
@@ -193,10 +185,6 @@ function registerHandlers(server: Server, userId: string, accessToken: string):
|
|
|
193
185
|
let result: string;
|
|
194
186
|
|
|
195
187
|
switch (name) {
|
|
196
|
-
case 'health_check':
|
|
197
|
-
result = await handleHealthCheck(userId);
|
|
198
|
-
break;
|
|
199
|
-
|
|
200
188
|
case 'remember_create_memory':
|
|
201
189
|
result = await handleCreateMemory(args as any, userId);
|
|
202
190
|
break;
|
|
@@ -274,55 +262,3 @@ function registerHandlers(server: Server, userId: string, accessToken: string):
|
|
|
274
262
|
});
|
|
275
263
|
}
|
|
276
264
|
|
|
277
|
-
/**
|
|
278
|
-
* Health check handler (scoped to userId)
|
|
279
|
-
*/
|
|
280
|
-
async function handleHealthCheck(userId: string): Promise<string> {
|
|
281
|
-
const health = {
|
|
282
|
-
status: 'healthy',
|
|
283
|
-
timestamp: new Date().toISOString(),
|
|
284
|
-
userId: userId,
|
|
285
|
-
server: {
|
|
286
|
-
name: 'remember-mcp',
|
|
287
|
-
version: '0.1.0',
|
|
288
|
-
},
|
|
289
|
-
databases: {
|
|
290
|
-
weaviate: {
|
|
291
|
-
connected: false,
|
|
292
|
-
userCollection: `Memory_${userId}`,
|
|
293
|
-
},
|
|
294
|
-
firestore: {
|
|
295
|
-
connected: false,
|
|
296
|
-
userPath: `users/${userId}`,
|
|
297
|
-
},
|
|
298
|
-
},
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
try {
|
|
302
|
-
// Test Weaviate connection
|
|
303
|
-
const { getWeaviateClient } = await import('./weaviate/client.js');
|
|
304
|
-
const weaviateClient = getWeaviateClient();
|
|
305
|
-
health.databases.weaviate.connected = await weaviateClient.isReady();
|
|
306
|
-
} catch (error) {
|
|
307
|
-
logger.error('Weaviate health check failed:', error);
|
|
308
|
-
health.databases.weaviate.connected = false;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
try {
|
|
312
|
-
// Test Firestore connection
|
|
313
|
-
const { testFirestoreConnection } = await import('./firestore/init.js');
|
|
314
|
-
health.databases.firestore.connected = await testFirestoreConnection();
|
|
315
|
-
} catch (error) {
|
|
316
|
-
logger.error('Firestore health check failed:', error);
|
|
317
|
-
health.databases.firestore.connected = false;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
// Overall status
|
|
321
|
-
const allHealthy =
|
|
322
|
-
health.databases.weaviate.connected &&
|
|
323
|
-
health.databases.firestore.connected;
|
|
324
|
-
|
|
325
|
-
health.status = allHealthy ? 'healthy' : 'degraded';
|
|
326
|
-
|
|
327
|
-
return JSON.stringify(health, null, 2);
|
|
328
|
-
}
|