@prmichaelsen/remember-mcp 0.2.1 → 0.2.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.
@@ -1,5 +1,8 @@
1
1
  /**
2
2
  * Initialize Firebase Admin SDK
3
+ *
4
+ * FIREBASE_ADMIN_SERVICE_ACCOUNT_KEY should be a JSON string containing the service account.
5
+ * Make sure it's properly escaped in your .env file.
3
6
  */
4
7
  export declare function initFirestore(): void;
5
8
  /**
@@ -407,12 +407,12 @@ var init_config = __esm({
407
407
  config = {
408
408
  // Weaviate
409
409
  weaviate: {
410
- url: process.env.WEAVIATE_URL || "http://localhost:8080",
410
+ url: process.env.WEAVIATE_REST_URL || "http://localhost:8080",
411
411
  apiKey: process.env.WEAVIATE_API_KEY || ""
412
412
  },
413
- // OpenAI
413
+ // OpenAI (for embeddings)
414
414
  openai: {
415
- apiKey: process.env.OPENAI_APIKEY || ""
415
+ apiKey: process.env.OPENAI_EMBEDDINGS_API_KEY || process.env.OPENAI_APIKEY || ""
416
416
  },
417
417
  // Firebase (using firebase-admin-sdk-v8)
418
418
  firebase: {
@@ -451,11 +451,30 @@ async function initWeaviateClient() {
451
451
  if (client) {
452
452
  return client;
453
453
  }
454
- client = await weaviate.connectToWeaviateCloud(config.weaviate.url, {
455
- authCredentials: config.weaviate.apiKey ? new weaviate.ApiKey(config.weaviate.apiKey) : void 0,
456
- headers: config.openai.apiKey ? { "X-OpenAI-Api-Key": config.openai.apiKey } : void 0
457
- });
458
- console.log("[Weaviate] Client initialized");
454
+ const weaviateUrl = config.weaviate.url;
455
+ const isLocal = weaviateUrl.includes("localhost") || weaviateUrl.includes("127.0.0.1");
456
+ if (!isLocal) {
457
+ console.log("[Weaviate] Connecting to remote Weaviate:", weaviateUrl);
458
+ client = await weaviate.connectToWeaviateCloud(weaviateUrl, {
459
+ authCredentials: config.weaviate.apiKey ? new weaviate.ApiKey(config.weaviate.apiKey) : void 0,
460
+ headers: config.openai.apiKey ? { "X-OpenAI-Api-Key": config.openai.apiKey } : void 0
461
+ });
462
+ } else {
463
+ console.log("[Weaviate] Connecting to local Weaviate:", weaviateUrl);
464
+ const localConfig = {
465
+ host: weaviateUrl.replace(/^https?:\/\//, "").split(":")[0],
466
+ port: weaviateUrl.includes(":") ? parseInt(weaviateUrl.split(":").pop() || "8080") : 8080,
467
+ scheme: weaviateUrl.startsWith("https") ? "https" : "http"
468
+ };
469
+ if (config.weaviate.apiKey) {
470
+ localConfig.authClientSecret = new weaviate.ApiKey(config.weaviate.apiKey);
471
+ }
472
+ if (config.openai.apiKey) {
473
+ localConfig.headers = { "X-OpenAI-Api-Key": config.openai.apiKey };
474
+ }
475
+ client = await weaviate.connectToLocal(localConfig);
476
+ }
477
+ console.log("[Weaviate] Client initialized successfully");
459
478
  return client;
460
479
  }
461
480
  function getWeaviateClient() {
@@ -549,14 +568,17 @@ function initFirestore() {
549
568
  return;
550
569
  }
551
570
  try {
571
+ const serviceAccount = JSON.parse(config.firebase.serviceAccount);
552
572
  initializeApp({
553
- serviceAccount: JSON.parse(config.firebase.serviceAccount),
573
+ serviceAccount,
554
574
  projectId: config.firebase.projectId
555
575
  });
556
576
  initialized = true;
557
- console.log("[Firestore] Initialized");
577
+ console.log("[Firestore] Initialized successfully");
558
578
  } catch (error) {
559
579
  console.error("[Firestore] Initialization failed:", error);
580
+ console.error("[Firestore] Make sure FIREBASE_ADMIN_SERVICE_ACCOUNT_KEY is valid JSON");
581
+ console.error("[Firestore] Check for proper escaping in .env file");
560
582
  throw error;
561
583
  }
562
584
  }
package/dist/server.js CHANGED
@@ -407,12 +407,12 @@ import_dotenv.default.config();
407
407
  var config = {
408
408
  // Weaviate
409
409
  weaviate: {
410
- url: process.env.WEAVIATE_URL || "http://localhost:8080",
410
+ url: process.env.WEAVIATE_REST_URL || "http://localhost:8080",
411
411
  apiKey: process.env.WEAVIATE_API_KEY || ""
412
412
  },
413
- // OpenAI
413
+ // OpenAI (for embeddings)
414
414
  openai: {
415
- apiKey: process.env.OPENAI_APIKEY || ""
415
+ apiKey: process.env.OPENAI_EMBEDDINGS_API_KEY || process.env.OPENAI_APIKEY || ""
416
416
  },
417
417
  // Firebase (using firebase-admin-sdk-v8)
418
418
  firebase: {
@@ -432,12 +432,12 @@ var config = {
432
432
  };
433
433
  function validateConfig() {
434
434
  const required = [
435
- { key: "WEAVIATE_URL", value: config.weaviate.url },
436
- { key: "OPENAI_APIKEY", value: config.openai.apiKey },
435
+ { key: "WEAVIATE_REST_URL", value: config.weaviate.url },
436
+ { key: "OPENAI_EMBEDDINGS_API_KEY", value: config.openai.apiKey },
437
437
  { key: "FIREBASE_ADMIN_SERVICE_ACCOUNT_KEY", value: config.firebase.serviceAccount },
438
438
  { key: "FIREBASE_PROJECT_ID", value: config.firebase.projectId }
439
439
  ];
440
- const missing = required.filter((r) => !r.value);
440
+ const missing = required.filter((r) => !r.value || r.value === "http://localhost:8080");
441
441
  if (missing.length > 0) {
442
442
  throw new Error(
443
443
  `Missing required environment variables: ${missing.map((m) => m.key).join(", ")}`
@@ -453,11 +453,30 @@ async function initWeaviateClient() {
453
453
  if (client) {
454
454
  return client;
455
455
  }
456
- client = await weaviate.connectToWeaviateCloud(config.weaviate.url, {
457
- authCredentials: config.weaviate.apiKey ? new weaviate.ApiKey(config.weaviate.apiKey) : void 0,
458
- headers: config.openai.apiKey ? { "X-OpenAI-Api-Key": config.openai.apiKey } : void 0
459
- });
460
- console.log("[Weaviate] Client initialized");
456
+ const weaviateUrl = config.weaviate.url;
457
+ const isLocal = weaviateUrl.includes("localhost") || weaviateUrl.includes("127.0.0.1");
458
+ if (!isLocal) {
459
+ console.log("[Weaviate] Connecting to remote Weaviate:", weaviateUrl);
460
+ client = await weaviate.connectToWeaviateCloud(weaviateUrl, {
461
+ authCredentials: config.weaviate.apiKey ? new weaviate.ApiKey(config.weaviate.apiKey) : void 0,
462
+ headers: config.openai.apiKey ? { "X-OpenAI-Api-Key": config.openai.apiKey } : void 0
463
+ });
464
+ } else {
465
+ console.log("[Weaviate] Connecting to local Weaviate:", weaviateUrl);
466
+ const localConfig = {
467
+ host: weaviateUrl.replace(/^https?:\/\//, "").split(":")[0],
468
+ port: weaviateUrl.includes(":") ? parseInt(weaviateUrl.split(":").pop() || "8080") : 8080,
469
+ scheme: weaviateUrl.startsWith("https") ? "https" : "http"
470
+ };
471
+ if (config.weaviate.apiKey) {
472
+ localConfig.authClientSecret = new weaviate.ApiKey(config.weaviate.apiKey);
473
+ }
474
+ if (config.openai.apiKey) {
475
+ localConfig.headers = { "X-OpenAI-Api-Key": config.openai.apiKey };
476
+ }
477
+ client = await weaviate.connectToLocal(localConfig);
478
+ }
479
+ console.log("[Weaviate] Client initialized successfully");
461
480
  return client;
462
481
  }
463
482
  function getWeaviateClient() {
@@ -504,14 +523,17 @@ function initFirestore() {
504
523
  return;
505
524
  }
506
525
  try {
526
+ const serviceAccount = JSON.parse(config.firebase.serviceAccount);
507
527
  initializeApp({
508
- serviceAccount: JSON.parse(config.firebase.serviceAccount),
528
+ serviceAccount,
509
529
  projectId: config.firebase.projectId
510
530
  });
511
531
  initialized = true;
512
- console.log("[Firestore] Initialized");
532
+ console.log("[Firestore] Initialized successfully");
513
533
  } catch (error) {
514
534
  console.error("[Firestore] Initialization failed:", error);
535
+ console.error("[Firestore] Make sure FIREBASE_ADMIN_SERVICE_ACCOUNT_KEY is valid JSON");
536
+ console.error("[Firestore] Check for proper escaping in .env file");
515
537
  throw error;
516
538
  }
517
539
  }
@@ -1,6 +1,11 @@
1
1
  import { WeaviateClient } from 'weaviate-client';
2
2
  /**
3
3
  * Initialize Weaviate client
4
+ *
5
+ * Connection strategy:
6
+ * - If WEAVIATE_REST_URL is set → use cloud connection (remote/self-hosted)
7
+ * - If URL contains localhost/127.0.0.1 → use local connection
8
+ * - Otherwise → use cloud connection (remote/self-hosted)
4
9
  */
5
10
  export declare function initWeaviateClient(): Promise<WeaviateClient>;
6
11
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prmichaelsen/remember-mcp",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Multi-tenant memory system MCP server with vector search and relationships",
5
5
  "main": "dist/server.js",
6
6
  "type": "module",
package/src/config.ts CHANGED
@@ -5,13 +5,13 @@ dotenv.config();
5
5
  export const config = {
6
6
  // Weaviate
7
7
  weaviate: {
8
- url: process.env.WEAVIATE_URL || 'http://localhost:8080',
8
+ url: process.env.WEAVIATE_REST_URL || 'http://localhost:8080',
9
9
  apiKey: process.env.WEAVIATE_API_KEY || '',
10
10
  },
11
11
 
12
- // OpenAI
12
+ // OpenAI (for embeddings)
13
13
  openai: {
14
- apiKey: process.env.OPENAI_APIKEY || '',
14
+ apiKey: process.env.OPENAI_EMBEDDINGS_API_KEY || process.env.OPENAI_APIKEY || '',
15
15
  },
16
16
 
17
17
  // Firebase (using firebase-admin-sdk-v8)
@@ -38,13 +38,13 @@ export const config = {
38
38
  */
39
39
  export function validateConfig(): void {
40
40
  const required = [
41
- { key: 'WEAVIATE_URL', value: config.weaviate.url },
42
- { key: 'OPENAI_APIKEY', value: config.openai.apiKey },
41
+ { key: 'WEAVIATE_REST_URL', value: config.weaviate.url },
42
+ { key: 'OPENAI_EMBEDDINGS_API_KEY', value: config.openai.apiKey },
43
43
  { key: 'FIREBASE_ADMIN_SERVICE_ACCOUNT_KEY', value: config.firebase.serviceAccount },
44
44
  { key: 'FIREBASE_PROJECT_ID', value: config.firebase.projectId },
45
45
  ];
46
46
 
47
- const missing = required.filter((r) => !r.value);
47
+ const missing = required.filter((r) => !r.value || r.value === 'http://localhost:8080');
48
48
 
49
49
  if (missing.length > 0) {
50
50
  throw new Error(
@@ -5,6 +5,9 @@ let initialized = false;
5
5
 
6
6
  /**
7
7
  * Initialize Firebase Admin SDK
8
+ *
9
+ * FIREBASE_ADMIN_SERVICE_ACCOUNT_KEY should be a JSON string containing the service account.
10
+ * Make sure it's properly escaped in your .env file.
8
11
  */
9
12
  export function initFirestore(): void {
10
13
  if (initialized) {
@@ -12,15 +15,19 @@ export function initFirestore(): void {
12
15
  }
13
16
 
14
17
  try {
18
+ const serviceAccount = JSON.parse(config.firebase.serviceAccount);
19
+
15
20
  initializeApp({
16
- serviceAccount: JSON.parse(config.firebase.serviceAccount),
21
+ serviceAccount,
17
22
  projectId: config.firebase.projectId,
18
23
  });
19
24
 
20
25
  initialized = true;
21
- console.log('[Firestore] Initialized');
26
+ console.log('[Firestore] Initialized successfully');
22
27
  } catch (error) {
23
28
  console.error('[Firestore] Initialization failed:', error);
29
+ console.error('[Firestore] Make sure FIREBASE_ADMIN_SERVICE_ACCOUNT_KEY is valid JSON');
30
+ console.error('[Firestore] Check for proper escaping in .env file');
24
31
  throw error;
25
32
  }
26
33
  }
@@ -5,23 +5,58 @@ let client: WeaviateClient | null = null;
5
5
 
6
6
  /**
7
7
  * Initialize Weaviate client
8
+ *
9
+ * Connection strategy:
10
+ * - If WEAVIATE_REST_URL is set → use cloud connection (remote/self-hosted)
11
+ * - If URL contains localhost/127.0.0.1 → use local connection
12
+ * - Otherwise → use cloud connection (remote/self-hosted)
8
13
  */
9
14
  export async function initWeaviateClient(): Promise<WeaviateClient> {
10
15
  if (client) {
11
16
  return client;
12
17
  }
13
18
 
14
- // Weaviate v3 client initialization
15
- client = await weaviate.connectToWeaviateCloud(config.weaviate.url, {
16
- authCredentials: config.weaviate.apiKey
17
- ? new weaviate.ApiKey(config.weaviate.apiKey)
18
- : undefined,
19
- headers: config.openai.apiKey
20
- ? { 'X-OpenAI-Api-Key': config.openai.apiKey }
21
- : undefined,
22
- });
19
+ const weaviateUrl = config.weaviate.url;
20
+
21
+ // Check if URL is localhost (use local connection)
22
+ // Everything else uses cloud connection (remote/self-hosted)
23
+ const isLocal = weaviateUrl.includes('localhost') || weaviateUrl.includes('127.0.0.1');
24
+
25
+ // Use appropriate connection method
26
+ if (!isLocal) {
27
+ // Use connectToWeaviateCloud() for ALL remote instances (cloud or self-hosted)
28
+ console.log('[Weaviate] Connecting to remote Weaviate:', weaviateUrl);
29
+ client = await weaviate.connectToWeaviateCloud(weaviateUrl, {
30
+ authCredentials: config.weaviate.apiKey
31
+ ? new weaviate.ApiKey(config.weaviate.apiKey)
32
+ : undefined,
33
+ headers: config.openai.apiKey
34
+ ? { 'X-OpenAI-Api-Key': config.openai.apiKey }
35
+ : undefined,
36
+ });
37
+ } else {
38
+ // connectToLocal() for localhost only
39
+ console.log('[Weaviate] Connecting to local Weaviate:', weaviateUrl);
40
+ const localConfig: any = {
41
+ host: weaviateUrl.replace(/^https?:\/\//, '').split(':')[0],
42
+ port: weaviateUrl.includes(':')
43
+ ? parseInt(weaviateUrl.split(':').pop() || '8080')
44
+ : 8080,
45
+ scheme: weaviateUrl.startsWith('https') ? 'https' : 'http',
46
+ };
47
+
48
+ if (config.weaviate.apiKey) {
49
+ localConfig.authClientSecret = new weaviate.ApiKey(config.weaviate.apiKey);
50
+ }
51
+
52
+ if (config.openai.apiKey) {
53
+ localConfig.headers = { 'X-OpenAI-Api-Key': config.openai.apiKey };
54
+ }
55
+
56
+ client = await weaviate.connectToLocal(localConfig);
57
+ }
23
58
 
24
- console.log('[Weaviate] Client initialized');
59
+ console.log('[Weaviate] Client initialized successfully');
25
60
  return client;
26
61
  }
27
62