@prmichaelsen/remember-mcp 0.2.1 → 0.2.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-factory.js +26 -7
- package/dist/server.js +27 -8
- package/dist/weaviate/client.d.ts +3 -0
- package/package.json +1 -1
- package/src/config.ts +3 -3
- package/src/weaviate/client.ts +43 -10
package/dist/server-factory.js
CHANGED
|
@@ -410,9 +410,9 @@ var init_config = __esm({
|
|
|
410
410
|
url: process.env.WEAVIATE_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
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
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 local Weaviate:", weaviateUrl);
|
|
458
|
+
const localConfig = {
|
|
459
|
+
host: weaviateUrl.replace(/^https?:\/\//, "").split(":")[0],
|
|
460
|
+
port: weaviateUrl.includes(":") ? parseInt(weaviateUrl.split(":").pop() || "8080") : 8080,
|
|
461
|
+
scheme: weaviateUrl.startsWith("https") ? "https" : "http"
|
|
462
|
+
};
|
|
463
|
+
if (config.weaviate.apiKey) {
|
|
464
|
+
localConfig.authClientSecret = new weaviate.ApiKey(config.weaviate.apiKey);
|
|
465
|
+
}
|
|
466
|
+
if (config.openai.apiKey) {
|
|
467
|
+
localConfig.headers = { "X-OpenAI-Api-Key": config.openai.apiKey };
|
|
468
|
+
}
|
|
469
|
+
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
|
+
}
|
|
477
|
+
console.log("[Weaviate] Client initialized successfully");
|
|
459
478
|
return client;
|
|
460
479
|
}
|
|
461
480
|
function getWeaviateClient() {
|
package/dist/server.js
CHANGED
|
@@ -410,9 +410,9 @@ var config = {
|
|
|
410
410
|
url: process.env.WEAVIATE_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: {
|
|
@@ -433,7 +433,7 @@ var config = {
|
|
|
433
433
|
function validateConfig() {
|
|
434
434
|
const required = [
|
|
435
435
|
{ key: "WEAVIATE_URL", value: config.weaviate.url },
|
|
436
|
-
{ key: "
|
|
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
|
];
|
|
@@ -453,11 +453,30 @@ async function initWeaviateClient() {
|
|
|
453
453
|
if (client) {
|
|
454
454
|
return client;
|
|
455
455
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
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 local Weaviate:", weaviateUrl);
|
|
460
|
+
const localConfig = {
|
|
461
|
+
host: weaviateUrl.replace(/^https?:\/\//, "").split(":")[0],
|
|
462
|
+
port: weaviateUrl.includes(":") ? parseInt(weaviateUrl.split(":").pop() || "8080") : 8080,
|
|
463
|
+
scheme: weaviateUrl.startsWith("https") ? "https" : "http"
|
|
464
|
+
};
|
|
465
|
+
if (config.weaviate.apiKey) {
|
|
466
|
+
localConfig.authClientSecret = new weaviate.ApiKey(config.weaviate.apiKey);
|
|
467
|
+
}
|
|
468
|
+
if (config.openai.apiKey) {
|
|
469
|
+
localConfig.headers = { "X-OpenAI-Api-Key": config.openai.apiKey };
|
|
470
|
+
}
|
|
471
|
+
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
|
+
}
|
|
479
|
+
console.log("[Weaviate] Client initialized successfully");
|
|
461
480
|
return client;
|
|
462
481
|
}
|
|
463
482
|
function getWeaviateClient() {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { WeaviateClient } from 'weaviate-client';
|
|
2
2
|
/**
|
|
3
3
|
* Initialize Weaviate client
|
|
4
|
+
*
|
|
5
|
+
* Note: connectToWeaviateCloud() works for ANY remote Weaviate (cloud or self-hosted)
|
|
6
|
+
* Only use connectToLocal() for localhost development
|
|
4
7
|
*/
|
|
5
8
|
export declare function initWeaviateClient(): Promise<WeaviateClient>;
|
|
6
9
|
/**
|
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -9,9 +9,9 @@ export const config = {
|
|
|
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)
|
|
@@ -39,7 +39,7 @@ export const config = {
|
|
|
39
39
|
export function validateConfig(): void {
|
|
40
40
|
const required = [
|
|
41
41
|
{ key: 'WEAVIATE_URL', value: config.weaviate.url },
|
|
42
|
-
{ key: '
|
|
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
|
];
|
package/src/weaviate/client.ts
CHANGED
|
@@ -5,23 +5,56 @@ let client: WeaviateClient | null = null;
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Initialize Weaviate client
|
|
8
|
+
*
|
|
9
|
+
* Note: connectToWeaviateCloud() works for ANY remote Weaviate (cloud or self-hosted)
|
|
10
|
+
* Only use connectToLocal() for localhost development
|
|
8
11
|
*/
|
|
9
12
|
export async function initWeaviateClient(): Promise<WeaviateClient> {
|
|
10
13
|
if (client) {
|
|
11
14
|
return client;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
const weaviateUrl = config.weaviate.url;
|
|
18
|
+
|
|
19
|
+
// Check if this is localhost (use connectToLocal)
|
|
20
|
+
const isLocal = weaviateUrl.includes('localhost') ||
|
|
21
|
+
weaviateUrl.includes('127.0.0.1');
|
|
22
|
+
|
|
23
|
+
// Use appropriate connection method
|
|
24
|
+
if (isLocal) {
|
|
25
|
+
console.log('[Weaviate] Connecting to local Weaviate:', weaviateUrl);
|
|
26
|
+
// connectToLocal() for localhost only
|
|
27
|
+
const localConfig: any = {
|
|
28
|
+
host: weaviateUrl.replace(/^https?:\/\//, '').split(':')[0],
|
|
29
|
+
port: weaviateUrl.includes(':')
|
|
30
|
+
? parseInt(weaviateUrl.split(':').pop() || '8080')
|
|
31
|
+
: 8080,
|
|
32
|
+
scheme: weaviateUrl.startsWith('https') ? 'https' : 'http',
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
if (config.weaviate.apiKey) {
|
|
36
|
+
localConfig.authClientSecret = new weaviate.ApiKey(config.weaviate.apiKey);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (config.openai.apiKey) {
|
|
40
|
+
localConfig.headers = { 'X-OpenAI-Api-Key': config.openai.apiKey };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
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
|
+
}
|
|
23
56
|
|
|
24
|
-
console.log('[Weaviate] Client initialized');
|
|
57
|
+
console.log('[Weaviate] Client initialized successfully');
|
|
25
58
|
return client;
|
|
26
59
|
}
|
|
27
60
|
|