Skip to content

Conversation

@olaservo
Copy link
Member

The Memory MCP server uses JSONL format (JSON Lines) where each line contains a separate JSON object, but was using a .json file extension. This caused IDE lint errors and confusion since the file is not valid JSON.

Changes:

  • Update default filename in index.ts from memory.json to memory.jsonl
  • Update documentation references in README.md
  • Maintain backward compatibility for existing MEMORY_FILE_PATH configs

Fixes #2361

Generated with Claude Code

….jsonl

The Memory MCP server uses JSONL format (JSON Lines) where each line
contains a separate JSON object, but was using a .json file extension.
This caused IDE lint errors and confusion since the file is not valid JSON.

Changes:
- Update default filename in index.ts from memory.json to memory.jsonl
- Update documentation references in README.md
- Maintain backward compatibility for existing MEMORY_FILE_PATH configs

Fixes #2361

Co-authored-by: Ola Hungerford <olaservo@users.noreply.github.com>
@olaservo olaservo added the server-memory Reference implementation for the Memory MCP server - src/memory label Aug 17, 2025

// Define memory file path using environment variable with fallback
const defaultMemoryPath = path.join(path.dirname(fileURLToPath(import.meta.url)), 'memory.json');
const defaultMemoryPath = path.join(path.dirname(fileURLToPath(import.meta.url)), 'memory.jsonl');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might this cause some weird backwards compatibility problems, e.g. if people have npx -y @modelcontextprotocol/server-memory in config, suddenly it'll seem to them like all their memories have disappeared.

Maybe we could also check before this: if no custom path is set AND memory.json exists AND memory.jsonl does not exist, move memory.json to memory.jsonl.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this change.

domdomegg
domdomegg previously approved these changes Aug 17, 2025
Copy link
Member

@domdomegg domdomegg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, although maybe want to address the backwards compatibility comment above

@olaservo
Copy link
Member Author

@claude could you take a look at the latest comments and incorporate these suggestions?

@claude
Copy link
Contributor

claude bot commented Aug 24, 2025

Claude finished @olaservo's task —— View job


Implementing backward compatibility suggestion ✅

I've successfully implemented the reviewer's suggestion to add backward compatibility for existing memory.json files.

Tasks:

  • Read repository setup instructions (CLAUDE.md) - No repo-specific instructions found
  • Examine current memory server implementation
  • Implement file migration logic (memory.json → memory.jsonl)
  • Test the implementation (builds successfully)
  • Commit and push changes
Implementation Details

Added backward compatibility logic that:

  1. When no custom MEMORY_FILE_PATH is set: Checks if memory.json exists and memory.jsonl doesn't exist
  2. If migration is needed: Renames memory.json to memory.jsonl and logs the migration
  3. Maintains existing behavior: Custom paths work exactly as before
  4. Safe migration: Only migrates when new file doesn't exist to avoid data loss

The migration happens during server startup in the main() function, before any file operations occur.

Key changes to src/memory/index.ts:14-49:

  • Added ensureMemoryFilePath() async function for migration logic
  • Changed MEMORY_FILE_PATH to be initialized at runtime instead of module load
  • Added migration logic that safely renames old file to new format

Commit: 53104a6 - Add backward compatibility for memory.json -> memory.jsonl migration

The backward compatibility feature is now implemented! Users with existing memory.json files will have them automatically migrated to memory.jsonl on their first run, ensuring no data loss while fixing the IDE linting issues.


When no custom MEMORY_FILE_PATH is set and memory.json exists but
memory.jsonl doesn't exist, automatically migrate the old file to
the new format with proper file extension.

This ensures existing users don't lose their data when upgrading
to the version with the corrected .jsonl extension.

Co-authored-by: Ola Hungerford <olaservo@users.noreply.github.com>
claude bot and others added 3 commits August 24, 2025 03:01
- Added DETECTED message when legacy memory.json file is found
- Added COMPLETED message when migration finishes successfully
- Improves visibility of backward compatibility migration process

Co-authored-by: Ola Hungerford <olaservo@users.noreply.github.com>
@olaservo olaservo requested a review from domdomegg August 27, 2025 12:11
@cliffhall cliffhall merged commit dc21983 into main Oct 20, 2025
23 checks passed
@cliffhall cliffhall deleted the claude/issue-2361-20250817-1626 branch October 20, 2025 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server-memory Reference implementation for the Memory MCP server - src/memory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory MCP uses JSONL for 'memory.json' as each line is a json format but not the entire file

4 participants