Issues in "memory.json" file in Knowledge Graph Memory MCP Server
Describe the bug
- memory.json file should be a valid json file.
To Reproduce
Steps to reproduce the behavior:
- validate the memory.json file here : https://jsonlint.com/
Expected behavior
- The file is not valid JSON. It contains multiple JSON objects separated by newlines, but a valid JSON file must have a single top-level value (such as an array or object).
- To be valid JSON, all the objects should be enclosed in square brackets [] and separated by commas, forming a JSON array.
- There is an extra blank line at the end, which is not a JSON syntax error but is unnecessary. To fix the file, wrap all objects in an array and separate them with commas.
Sample memory file
Current memory file structure:
{"type":"entity","name":"Alice_Smith","entityType":"Person","observations":["Works as a software engineer","Lives in San Francisco","Speaks Mandarin fluently"]}
{"type":"entity","name":"ML_Project_X","entityType":"Project","observations":["Started in 2023","Focus on natural language processing","Currently in development phase"]}
{"type":"entity","name":"TechCorp","entityType":"Organization","observations":["Founded in 2010","Specializes in AI development","Headquartered in San Francisco"]}
{"type":"relation","from":"Alice_Smith","to":"ML_Project_X","relationType":"leads"}
{"type":"relation","from":"Alice_Smith","to":"TechCorp","relationType":"works_at"}
{"type":"relation","from":"TechCorp","to":"ML_Project_X","relationType":"owns"}
Expected memory file structure:
[
{"type":"entity","name":"Alice_Smith","entityType":"Person","observations":["Works as a software engineer","Lives in San Francisco","Speaks Mandarin fluently"]},
{"type":"entity","name":"ML_Project_X","entityType":"Project","observations":["Started in 2023","Focus on natural language processing","Currently in development phase"]},
{"type":"entity","name":"TechCorp","entityType":"Organization","observations":["Founded in 2010","Specializes in AI development","Headquartered in San Francisco"]},
{"type":"relation","from":"Alice_Smith","to":"ML_Project_X","relationType":"leads"},
{"type":"relation","from":"Alice_Smith","to":"TechCorp","relationType":"works_at"},
{"type":"relation","from":"TechCorp","to":"ML_Project_X","relationType":"owns"}
]
Additional context Also, provide the "JSON-SCHEMA" file for memory.json file so that I can validate and correct the memory.json file in case it gets corrupted. I do not want to lose my knowlege gained after long conversation with Claude.
Isn't this just https://jsonlines.org/
You could change the default filename here https://github.com/modelcontextprotocol/servers/blob/77376770852baf99d28800c82057f33e0757ae59/src/memory/index.ts#L14
Or just set the environment variable MEMORY_FILE_PATH to whatever you like, e.g. memory.jsonl