@aeriondyseti/vector-memory-mcp 0.2.0 → 0.2.1

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/README.md CHANGED
@@ -179,7 +179,7 @@ vector-memory-mcp/
179
179
 
180
180
  - **MCP Framework**: @modelcontextprotocol/sdk (official SDK)
181
181
  - **Vector Database**: LanceDB (fast, local, vector search)
182
- - **Embeddings**: @xenova/transformers (Xenova/all-MiniLM-L6-v2, 384 dimensions)
182
+ - **Embeddings**: [@huggingface/transformers](https://huggingface.co/docs/transformers.js) (Xenova/all-MiniLM-L6-v2, 384 dimensions)
183
183
  - **Language**: TypeScript 5.0+
184
184
  - **Runtime**: Bun 1.0+
185
185
  - **Testing**: Bun test
@@ -193,7 +193,7 @@ vector-memory-mcp/
193
193
  ```
194
194
  Claude Code calls store_memory tool
195
195
 
196
- Content → @xenova/transformers → 384d vector
196
+ Content → @huggingface/transformers → 384d vector
197
197
 
198
198
  Store in LanceDB with metadata
199
199
 
@@ -205,7 +205,7 @@ Store in LanceDB with metadata
205
205
  ```
206
206
  Claude Code calls search_memories
207
207
 
208
- Query → @xenova/transformers → 384d vector
208
+ Query → @huggingface/transformers → 384d vector
209
209
 
210
210
  Vector search in LanceDB
211
211
 
@@ -346,7 +346,7 @@ MIT License - see [LICENSE](LICENSE) for details.
346
346
 
347
347
  - Built with [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/typescript-sdk) - Official MCP TypeScript SDK
348
348
  - Uses [LanceDB](https://lancedb.com/) for fast, local vector search
349
- - Powered by [@xenova/transformers](https://github.com/xenova/transformers.js) for local embeddings
349
+ - Powered by [@huggingface/transformers](https://huggingface.co/docs/transformers.js) for local embeddings
350
350
  - Database layer via [Drizzle ORM](https://orm.drizzle.team/)
351
351
  - Inspired by [doobidoo's mcp-memory-service](https://github.com/doobidoo/mcp-memory-service)
352
352
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriondyseti/vector-memory-mcp",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "A zero-configuration RAG memory server for MCP clients",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@lancedb/lancedb": "^0.22.3",
35
35
  "@modelcontextprotocol/sdk": "^1.0.0",
36
- "@xenova/transformers": "^2.17.0",
36
+ "@huggingface/transformers": "^3.8.0",
37
37
  "apache-arrow": "^21.1.0"
38
38
  },
39
39
  "devDependencies": {
@@ -1,9 +1,9 @@
1
- import { pipeline, type FeatureExtractionPipeline } from "@xenova/transformers";
1
+ import { pipeline, type FeatureExtractionPipeline } from "@huggingface/transformers";
2
2
 
3
3
  export class EmbeddingsService {
4
4
  private modelName: string;
5
5
  private extractor: FeatureExtractionPipeline | null = null;
6
- private initPromise: Promise<FeatureExtractionPipeline> | null = null;
6
+ private initPromise: Promise<void> | null = null;
7
7
  private _dimension: number;
8
8
 
9
9
  constructor(modelName: string, dimension: number) {
@@ -15,32 +15,52 @@ export class EmbeddingsService {
15
15
  return this._dimension;
16
16
  }
17
17
 
18
- private async getExtractor(): Promise<FeatureExtractionPipeline> {
18
+ private async init(): Promise<void> {
19
19
  if (this.extractor) {
20
- return this.extractor;
20
+ return; // Already initialized
21
21
  }
22
22
 
23
23
  if (!this.initPromise) {
24
- this.initPromise = pipeline("feature-extraction", this.modelName, {
25
- quantized: true,
26
- }) as Promise<FeatureExtractionPipeline>;
24
+ this.initPromise = (async () => {
25
+ this.extractor = await pipeline("feature-extraction", this.modelName, {
26
+ dtype: "fp32",
27
+ });
28
+ })();
27
29
  }
28
-
29
- this.extractor = await this.initPromise;
30
- return this.extractor;
30
+ await this.initPromise;
31
31
  }
32
32
 
33
33
  async embed(text: string): Promise<number[]> {
34
- const extractor = await this.getExtractor();
35
- const output = await extractor(text, { pooling: "mean", normalize: true });
36
- return Array.from(output.data as Float32Array);
34
+ await this.init();
35
+ if (!this.extractor) {
36
+ throw new Error("Extractor not initialized.");
37
+ }
38
+
39
+ const output = await this.extractor(text, {
40
+ pooling: "mean",
41
+ normalize: true,
42
+ });
43
+
44
+ // output.tolist() returns number[][] for single input, we want the first element
45
+ const embeddings = output.tolist() as number[][];
46
+ return embeddings[0];
37
47
  }
38
48
 
39
49
  async embedBatch(texts: string[]): Promise<number[][]> {
40
- const results: number[][] = [];
41
- for (const text of texts) {
42
- results.push(await this.embed(text));
50
+ await this.init();
51
+ if (!this.extractor) {
52
+ throw new Error("Extractor not initialized.");
43
53
  }
44
- return results;
54
+
55
+ if (texts.length === 0) {
56
+ return [];
57
+ }
58
+
59
+ const output = await this.extractor(texts, {
60
+ pooling: "mean",
61
+ normalize: true,
62
+ });
63
+
64
+ return output.tolist() as number[][];
45
65
  }
46
66
  }