Skip to content

Commit 18594c2

Browse files
committed
(mcp-neo4j-memory) load/save entire kg
1 parent 8ad8242 commit 18594c2

File tree

9 files changed

+505
-84
lines changed

9 files changed

+505
-84
lines changed

package-lock.json

Lines changed: 63 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"private": true,
77
"dependencies": {
88
"@modelcontextprotocol/sdk": "^1.0.1",
9-
"axios": "^1.6.0"
9+
"axios": "^1.6.0",
10+
"neo4j-driver": "^5.27.0"
1011
},
1112
"devDependencies": {
1213
"@eslint/js": "^9.8.0",

servers/mcp-json-memory/src/json-memory.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import path from 'path';
33
import { fileURLToPath } from 'url';
44
import { promises as fs } from 'fs';
5-
// import { KnowledgeGraphMemory, Entity, KnowledgeGraph, Relation } from "./types";
65
import { KnowledgeGraphMemory, Entity, KnowledgeGraph, Relation } from "@neo4j/graphrag-memory";
76

87
// Default path to the JSONL file, you can change this to your desired local path
@@ -18,7 +17,6 @@ export class JsonMemory implements KnowledgeGraphMemory {
1817
}
1918

2019
private async loadGraph(): Promise<KnowledgeGraph> {
21-
console.log(`loadGraph(${this.memoryFilePath})`);
2220
try {
2321
const data = await fs.readFile(this.memoryFilePath, "utf-8");
2422
const lines = data.split("\n").filter(line => line.trim() !== "");

servers/mcp-json-memory/src/main.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
CallToolRequestSchema,
55
ListToolsRequestSchema,
66
} from "@modelcontextprotocol/sdk/types.js";
7-
// import { KnowledgeGraphMemory, Entity, KnowledgeGraph, Relation } from "./types.js";
87
import { KnowledgeGraphMemory, Entity, KnowledgeGraph, Relation } from "@neo4j/graphrag-memory";
98
import { JsonMemory } from './json-memory.js'
109

@@ -238,7 +237,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
238237
async function main() {
239238
const transport = new StdioServerTransport();
240239
await server.connect(transport);
241-
console.error("MCP Knowledge Graph Memory using JSON running on stdio");
240+
console.error("MCP Knowledge Graph Memory using Neo4j running on stdio");
242241
}
243242

244243
main().catch((error) => {

servers/mcp-json-memory/src/types.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.

servers/mcp-json-memory/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"files": [],
44
"include": [],
55
"references": [
6-
// @ts-ignore -> https://github.com/nrwl/nx/issues/27292
76
{
87
"path": "./tsconfig.app.json"
98
},

servers/mcp-neo4j-memory/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"options": {
1313
"platform": "node",
1414
"outputPath": "dist/servers/mcp-neo4j-memory",
15-
"format": ["cjs"],
15+
"format": ["esm"],
1616
"bundle": false,
1717
"main": "servers/mcp-neo4j-memory/src/main.ts",
1818
"tsConfig": "servers/mcp-neo4j-memory/tsconfig.app.json",

0 commit comments

Comments
 (0)