@prmichaelsen/remember-mcp 0.2.2 → 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.
- package/dist/firestore/init.d.ts +3 -0
- package/dist/server-factory.js +13 -10
- package/dist/server.js +15 -12
- package/dist/weaviate/client.d.ts +4 -2
- package/package.json +1 -1
- package/src/config.ts +3 -3
- package/src/firestore/init.ts +9 -2
- package/src/weaviate/client.ts +20 -18
package/dist/firestore/init.d.ts
CHANGED
package/dist/server-factory.js
CHANGED
|
@@ -407,7 +407,7 @@ var init_config = __esm({
|
|
|
407
407
|
config = {
|
|
408
408
|
// Weaviate
|
|
409
409
|
weaviate: {
|
|
410
|
-
url: process.env.
|
|
410
|
+
url: process.env.WEAVIATE_REST_URL || "http://localhost:8080",
|
|
411
411
|
apiKey: process.env.WEAVIATE_API_KEY || ""
|
|
412
412
|
},
|
|
413
413
|
// OpenAI (for embeddings)
|
|
@@ -453,7 +453,13 @@ async function initWeaviateClient() {
|
|
|
453
453
|
}
|
|
454
454
|
const weaviateUrl = config.weaviate.url;
|
|
455
455
|
const isLocal = weaviateUrl.includes("localhost") || weaviateUrl.includes("127.0.0.1");
|
|
456
|
-
if (isLocal) {
|
|
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 {
|
|
457
463
|
console.log("[Weaviate] Connecting to local Weaviate:", weaviateUrl);
|
|
458
464
|
const localConfig = {
|
|
459
465
|
host: weaviateUrl.replace(/^https?:\/\//, "").split(":")[0],
|
|
@@ -467,12 +473,6 @@ async function initWeaviateClient() {
|
|
|
467
473
|
localConfig.headers = { "X-OpenAI-Api-Key": config.openai.apiKey };
|
|
468
474
|
}
|
|
469
475
|
client = await weaviate.connectToLocal(localConfig);
|
|
470
|
-
} else {
|
|
471
|
-
console.log("[Weaviate] Connecting to remote Weaviate:", weaviateUrl);
|
|
472
|
-
client = await weaviate.connectToWeaviateCloud(weaviateUrl, {
|
|
473
|
-
authCredentials: config.weaviate.apiKey ? new weaviate.ApiKey(config.weaviate.apiKey) : void 0,
|
|
474
|
-
headers: config.openai.apiKey ? { "X-OpenAI-Api-Key": config.openai.apiKey } : void 0
|
|
475
|
-
});
|
|
476
476
|
}
|
|
477
477
|
console.log("[Weaviate] Client initialized successfully");
|
|
478
478
|
return client;
|
|
@@ -568,14 +568,17 @@ function initFirestore() {
|
|
|
568
568
|
return;
|
|
569
569
|
}
|
|
570
570
|
try {
|
|
571
|
+
const serviceAccount = JSON.parse(config.firebase.serviceAccount);
|
|
571
572
|
initializeApp({
|
|
572
|
-
serviceAccount
|
|
573
|
+
serviceAccount,
|
|
573
574
|
projectId: config.firebase.projectId
|
|
574
575
|
});
|
|
575
576
|
initialized = true;
|
|
576
|
-
console.log("[Firestore] Initialized");
|
|
577
|
+
console.log("[Firestore] Initialized successfully");
|
|
577
578
|
} catch (error) {
|
|
578
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");
|
|
579
582
|
throw error;
|
|
580
583
|
}
|
|
581
584
|
}
|
package/dist/server.js
CHANGED
|
@@ -407,7 +407,7 @@ import_dotenv.default.config();
|
|
|
407
407
|
var config = {
|
|
408
408
|
// Weaviate
|
|
409
409
|
weaviate: {
|
|
410
|
-
url: process.env.
|
|
410
|
+
url: process.env.WEAVIATE_REST_URL || "http://localhost:8080",
|
|
411
411
|
apiKey: process.env.WEAVIATE_API_KEY || ""
|
|
412
412
|
},
|
|
413
413
|
// OpenAI (for embeddings)
|
|
@@ -432,12 +432,12 @@ var config = {
|
|
|
432
432
|
};
|
|
433
433
|
function validateConfig() {
|
|
434
434
|
const required = [
|
|
435
|
-
{ key: "
|
|
435
|
+
{ key: "WEAVIATE_REST_URL", value: config.weaviate.url },
|
|
436
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(", ")}`
|
|
@@ -455,7 +455,13 @@ async function initWeaviateClient() {
|
|
|
455
455
|
}
|
|
456
456
|
const weaviateUrl = config.weaviate.url;
|
|
457
457
|
const isLocal = weaviateUrl.includes("localhost") || weaviateUrl.includes("127.0.0.1");
|
|
458
|
-
if (isLocal) {
|
|
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 {
|
|
459
465
|
console.log("[Weaviate] Connecting to local Weaviate:", weaviateUrl);
|
|
460
466
|
const localConfig = {
|
|
461
467
|
host: weaviateUrl.replace(/^https?:\/\//, "").split(":")[0],
|
|
@@ -469,12 +475,6 @@ async function initWeaviateClient() {
|
|
|
469
475
|
localConfig.headers = { "X-OpenAI-Api-Key": config.openai.apiKey };
|
|
470
476
|
}
|
|
471
477
|
client = await weaviate.connectToLocal(localConfig);
|
|
472
|
-
} else {
|
|
473
|
-
console.log("[Weaviate] Connecting to remote Weaviate:", weaviateUrl);
|
|
474
|
-
client = await weaviate.connectToWeaviateCloud(weaviateUrl, {
|
|
475
|
-
authCredentials: config.weaviate.apiKey ? new weaviate.ApiKey(config.weaviate.apiKey) : void 0,
|
|
476
|
-
headers: config.openai.apiKey ? { "X-OpenAI-Api-Key": config.openai.apiKey } : void 0
|
|
477
|
-
});
|
|
478
478
|
}
|
|
479
479
|
console.log("[Weaviate] Client initialized successfully");
|
|
480
480
|
return client;
|
|
@@ -523,14 +523,17 @@ function initFirestore() {
|
|
|
523
523
|
return;
|
|
524
524
|
}
|
|
525
525
|
try {
|
|
526
|
+
const serviceAccount = JSON.parse(config.firebase.serviceAccount);
|
|
526
527
|
initializeApp({
|
|
527
|
-
serviceAccount
|
|
528
|
+
serviceAccount,
|
|
528
529
|
projectId: config.firebase.projectId
|
|
529
530
|
});
|
|
530
531
|
initialized = true;
|
|
531
|
-
console.log("[Firestore] Initialized");
|
|
532
|
+
console.log("[Firestore] Initialized successfully");
|
|
532
533
|
} catch (error) {
|
|
533
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");
|
|
534
537
|
throw error;
|
|
535
538
|
}
|
|
536
539
|
}
|
|
@@ -2,8 +2,10 @@ import { WeaviateClient } from 'weaviate-client';
|
|
|
2
2
|
/**
|
|
3
3
|
* Initialize Weaviate client
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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)
|
|
7
9
|
*/
|
|
8
10
|
export declare function initWeaviateClient(): Promise<WeaviateClient>;
|
|
9
11
|
/**
|
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -5,7 +5,7 @@ dotenv.config();
|
|
|
5
5
|
export const config = {
|
|
6
6
|
// Weaviate
|
|
7
7
|
weaviate: {
|
|
8
|
-
url: process.env.
|
|
8
|
+
url: process.env.WEAVIATE_REST_URL || 'http://localhost:8080',
|
|
9
9
|
apiKey: process.env.WEAVIATE_API_KEY || '',
|
|
10
10
|
},
|
|
11
11
|
|
|
@@ -38,13 +38,13 @@ export const config = {
|
|
|
38
38
|
*/
|
|
39
39
|
export function validateConfig(): void {
|
|
40
40
|
const required = [
|
|
41
|
-
{ key: '
|
|
41
|
+
{ key: 'WEAVIATE_REST_URL', value: config.weaviate.url },
|
|
42
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(
|
package/src/firestore/init.ts
CHANGED
|
@@ -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
|
|
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
|
}
|
package/src/weaviate/client.ts
CHANGED
|
@@ -6,8 +6,10 @@ let client: WeaviateClient | null = null;
|
|
|
6
6
|
/**
|
|
7
7
|
* Initialize Weaviate client
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
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)
|
|
11
13
|
*/
|
|
12
14
|
export async function initWeaviateClient(): Promise<WeaviateClient> {
|
|
13
15
|
if (client) {
|
|
@@ -16,14 +18,25 @@ export async function initWeaviateClient(): Promise<WeaviateClient> {
|
|
|
16
18
|
|
|
17
19
|
const weaviateUrl = config.weaviate.url;
|
|
18
20
|
|
|
19
|
-
// Check if
|
|
20
|
-
|
|
21
|
-
|
|
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');
|
|
22
24
|
|
|
23
25
|
// Use appropriate connection method
|
|
24
|
-
if (isLocal) {
|
|
25
|
-
|
|
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 {
|
|
26
38
|
// connectToLocal() for localhost only
|
|
39
|
+
console.log('[Weaviate] Connecting to local Weaviate:', weaviateUrl);
|
|
27
40
|
const localConfig: any = {
|
|
28
41
|
host: weaviateUrl.replace(/^https?:\/\//, '').split(':')[0],
|
|
29
42
|
port: weaviateUrl.includes(':')
|
|
@@ -41,17 +54,6 @@ export async function initWeaviateClient(): Promise<WeaviateClient> {
|
|
|
41
54
|
}
|
|
42
55
|
|
|
43
56
|
client = await weaviate.connectToLocal(localConfig);
|
|
44
|
-
} else {
|
|
45
|
-
// Use connectToWeaviateCloud() for ALL remote instances (cloud or self-hosted)
|
|
46
|
-
console.log('[Weaviate] Connecting to remote Weaviate:', weaviateUrl);
|
|
47
|
-
client = await weaviate.connectToWeaviateCloud(weaviateUrl, {
|
|
48
|
-
authCredentials: config.weaviate.apiKey
|
|
49
|
-
? new weaviate.ApiKey(config.weaviate.apiKey)
|
|
50
|
-
: undefined,
|
|
51
|
-
headers: config.openai.apiKey
|
|
52
|
-
? { 'X-OpenAI-Api-Key': config.openai.apiKey }
|
|
53
|
-
: undefined,
|
|
54
|
-
});
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
console.log('[Weaviate] Client initialized successfully');
|