@henrychong-ai/mcp-neo4j-knowledge-graph 2.3.1 → 2.4.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/README.md +4 -0
- package/dist/embeddings/EmbeddingJobManager.d.ts +18 -142
- package/dist/embeddings/EmbeddingJobManager.js +79 -329
- package/dist/embeddings/EmbeddingJobManager.js.map +1 -1
- package/dist/embeddings/JobStore.d.ts +80 -0
- package/dist/embeddings/JobStore.js +9 -0
- package/dist/embeddings/JobStore.js.map +1 -0
- package/dist/embeddings/Neo4jJobStore.d.ts +34 -0
- package/dist/embeddings/Neo4jJobStore.js +242 -0
- package/dist/embeddings/Neo4jJobStore.js.map +1 -0
- package/dist/index.js +19 -60
- package/dist/index.js.map +1 -1
- package/dist/server/setup.js +1 -1
- package/dist/storage/createAdaptedStorageProvider.d.ts +15 -0
- package/dist/storage/createAdaptedStorageProvider.js +61 -0
- package/dist/storage/createAdaptedStorageProvider.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { logger } from '../utils/logger.js';
|
|
2
|
+
/**
|
|
3
|
+
* Wraps a `StorageProvider` (typically `Neo4jStorageProvider`) into the shape
|
|
4
|
+
* `EmbeddingJobManager` expects for entity access: explicit forwarders for
|
|
5
|
+
* `loadGraph`, `getEntity`, `storeEntityVector`. Queue persistence is no
|
|
6
|
+
* longer the storage provider's job — that lives on `JobStore` (v2.4.0+).
|
|
7
|
+
*
|
|
8
|
+
* Why method forwarders are explicit: object spread (`...storageProvider`)
|
|
9
|
+
* only copies OWN enumerable properties — class methods on a prototype are
|
|
10
|
+
* silently dropped. Without these forwarders,
|
|
11
|
+
* `EmbeddingJobManager.scheduleIncrementalRegeneration` would throw because
|
|
12
|
+
* `loadGraph` would be `undefined` on the wrapper. The v2.3.2 hotfix
|
|
13
|
+
* established this pattern; we keep it.
|
|
14
|
+
*/
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
export function createAdaptedStorageProvider(storageProvider) {
|
|
17
|
+
return {
|
|
18
|
+
...storageProvider,
|
|
19
|
+
loadGraph: async () => {
|
|
20
|
+
if (typeof storageProvider.loadGraph === 'function') {
|
|
21
|
+
return storageProvider.loadGraph();
|
|
22
|
+
}
|
|
23
|
+
throw new Error('Underlying storage provider has no loadGraph method');
|
|
24
|
+
},
|
|
25
|
+
getEntity: async (name) => {
|
|
26
|
+
if (typeof storageProvider.getEntity === 'function') {
|
|
27
|
+
return storageProvider.getEntity(name);
|
|
28
|
+
}
|
|
29
|
+
const result = await storageProvider.openNodes([name]);
|
|
30
|
+
return result.entities[0] || null;
|
|
31
|
+
},
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
+
storeEntityVector: async (name, embedding) => {
|
|
34
|
+
logger.debug(`Neo4j adapter: storeEntityVector called for ${name}`, {
|
|
35
|
+
embeddingType: typeof embedding,
|
|
36
|
+
vectorLength: embedding?.vector?.length || 'no vector',
|
|
37
|
+
model: embedding?.model || 'no model',
|
|
38
|
+
});
|
|
39
|
+
const formattedEmbedding = {
|
|
40
|
+
vector: embedding.vector || embedding,
|
|
41
|
+
model: embedding.model || 'unknown',
|
|
42
|
+
lastUpdated: embedding.lastUpdated || Date.now(),
|
|
43
|
+
};
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
+
if (typeof storageProvider.updateEntityEmbedding === 'function') {
|
|
46
|
+
try {
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
+
return await storageProvider.updateEntityEmbedding(name, formattedEmbedding);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
logger.error(`Neo4j adapter: Error in storeEntityVector for ${name}`, error);
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const errorMsg = `Neo4j adapter: updateEntityEmbedding not implemented for ${name}`;
|
|
56
|
+
logger.error(errorMsg);
|
|
57
|
+
throw new Error(errorMsg);
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=createAdaptedStorageProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAdaptedStorageProvider.js","sourceRoot":"","sources":["../../src/storage/createAdaptedStorageProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C;;;;;;;;;;;;GAYG;AACH,8DAA8D;AAC9D,MAAM,UAAU,4BAA4B,CAAC,eAAgC;IAC3E,OAAO;QACL,GAAG,eAAe;QAElB,SAAS,EAAE,KAAK,IAAI,EAAE;YACpB,IAAI,OAAO,eAAe,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;gBACpD,OAAO,eAAe,CAAC,SAAS,EAAE,CAAC;YACrC,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;QAED,SAAS,EAAE,KAAK,EAAE,IAAY,EAAE,EAAE;YAChC,IAAI,OAAO,eAAe,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;gBACpD,OAAO,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YACzC,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACvD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;QACpC,CAAC;QAED,8DAA8D;QAC9D,iBAAiB,EAAE,KAAK,EAAE,IAAY,EAAE,SAAc,EAAE,EAAE;YACxD,MAAM,CAAC,KAAK,CAAC,+CAA+C,IAAI,EAAE,EAAE;gBAClE,aAAa,EAAE,OAAO,SAAS;gBAC/B,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,IAAI,WAAW;gBACtD,KAAK,EAAE,SAAS,EAAE,KAAK,IAAI,UAAU;aACtC,CAAC,CAAC;YAEH,MAAM,kBAAkB,GAAG;gBACzB,MAAM,EAAE,SAAS,CAAC,MAAM,IAAI,SAAS;gBACrC,KAAK,EAAE,SAAS,CAAC,KAAK,IAAI,SAAS;gBACnC,WAAW,EAAE,SAAS,CAAC,WAAW,IAAI,IAAI,CAAC,GAAG,EAAE;aACjD,CAAC;YAEF,8DAA8D;YAC9D,IAAI,OAAQ,eAAuB,CAAC,qBAAqB,KAAK,UAAU,EAAE,CAAC;gBACzE,IAAI,CAAC;oBACH,8DAA8D;oBAC9D,OAAO,MAAO,eAAuB,CAAC,qBAAqB,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;gBACxF,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,CAAC,KAAK,CAAC,iDAAiD,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;oBAC7E,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;YACD,MAAM,QAAQ,GAAG,4DAA4D,IAAI,EAAE,CAAC;YACpF,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@henrychong-ai/mcp-neo4j-knowledge-graph",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Neo4j-based knowledge graph MCP server with temporal versioning and semantic search",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Henry Chong <henry@henrychong.ai>",
|