The MCP memory server forgets everything: where it saves and how to fix it
You set up the official Memory server, your AI stored a pile of useful facts, and a few weeks later it remembers nothing. Nothing crashed. The file it saved to was deleted along with a package update. Here is where that file lives, what removes it, and the one setting that fixes it. We tested each step on Windows in September 2026.
The short fix: tell the server where to save by adding a MEMORY_FILE_PATH setting that points at a folder you control. The folder must already exist. Copy-paste config is below.
Where the memory file is
By default the server writes a file called memory.jsonl inside its own package folder. When you run it the usual way, with npx -y @modelcontextprotocol/server-memory, that package folder is part of npm's _npx cache. On our Windows machine the file appeared at:
%LOCALAPPDATA%\npm-cache\_npx\<random-looking folder>\node_modules\@modelcontextprotocol\server-memory\dist\memory.jsonl
To find yours, run this. It uses npm's own answer for where its cache is, so it works on any system (we only tested Windows, and expect macOS and Linux to keep the cache under ~/.npm):
npm config get cache
Then look for memory.jsonl under the _npx folder inside that path. In a Git Bash, macOS or Linux terminal:
find "$(npm config get cache)/_npx" -name memory.jsonl
In Windows PowerShell:
Get-ChildItem (Join-Path (npm config get cache) "_npx") -Recurse -Filter memory.jsonl
What deletes it
We tested this in a throwaway npm cache, so nothing of ours was touched. Three things matter:
- A package update deletes it. We installed an older release (2026.1.26) and let it save a memory. Then we ran the normal
npx -y @modelcontextprotocol/server-memorycommand. npx upgraded the package to the newest release (2026.8.31) in the same folder, andmemory.jsonlwas gone. Becausenpx -ywithout a version number follows the newest release, every new release is a chance to lose everything the AI stored. - Deleting the
_npxfolder deletes it. People often clear that folder to fix a misbehaving npx server, and doing so takes the memory file with it. This follows directly from where the file lives, so we did not need to test it. npm cache clean --forcedoes not delete it. We ran it and the file was still there. That command clears a different part of the cache.
The fix: choose where it saves
The server's README documents an environment variable, MEMORY_FILE_PATH, for the location of the memory file. We confirmed it: with it set, the file was written to the path we gave and nowhere else. Add it to the env block of the memory server. The setting is not secret, so the value goes straight into the file.
This works the same in Claude Code (.mcp.json), Claude Desktop and Cursor:
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"],
"env": {
"MEMORY_FILE_PATH": "/path/to/existing/folder/memory.jsonl"
}
}
}
}
Pick a folder that will not get cleaned up, such as one in your documents or a folder you already back up. On Windows, write forward slashes (C:/Users/you/notes/memory.jsonl) or double each backslash.
The folder has to exist. We pointed the setting at a folder that did not exist. The server started normally and looked healthy, but every attempt to save came back with a "no such file or directory" error. Create the folder first.
Keep what you already have
If the file is still there, copy it out before the next update. Run the search command above, copy the memory.jsonl it finds to your chosen folder, and use that path in MEMORY_FILE_PATH. The file is plain text with one entry per line, so you can also open it and read what the AI has stored.
Check that it works
- Restart your client so it reads the new config.
- Ask the AI: "Remember that my project uses pnpm."
- Open the file at your chosen path. You should see a line mentioning it.
Privacy
The memory file holds whatever the AI decided to store, in readable text. Keep it out of git repositories you share, and do not let it collect secrets such as passwords or API keys. See keeping API keys out of MCP config.