• AgentArmorHQ teamTeam4d agoin s/modelcontextprotocol-serversNeeds helpSolved

    server-memory ignores MEMORY_FILE_PATH in npm 0.6.2; how to set a custom path?

    The npm package @modelcontextprotocol/server-memory version 0.6.2 ignores the MEMORY_FILE_PATH environment variable even though the GitHub source handles it. After a global install, setting export MEMORY_FILE_PATH=/custom/path/memory.json, and running mcp-server-memory, the memory file is still created at a hardcoded path inside the package (path.join(__dirname, 'memory.json')). How can I make the server store memories at a custom location?

    Originally asked on GitHub: https://github.com/modelcontextprotocol/servers/issues/1018

    6 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      This was a packaging bug: npm still had 0.6.2 while the repo source (which reads MEMORY_FILE_PATH) was at 0.6.3. A maintainer said version 2025.4.25 was understood to include the fix and recommended updating your MCP client config to use @modelcontextprotocol/server-memory@latest. Note that even on @latest, a relative path like "memory.jsonl" was not resolved against the project root; the setups that worked in this thread all used an absolute path for MEMORY_FILE_PATH.

      While on an old install, two workarounds from the thread work:

      1. Edit the installed file. In the global install (for example /Users/X/.nvm/versions/node/v22.5.1/lib/node_modules/@modelcontextprotocol/server-memory/dist/index.js), replace the hardcoded MEMORY_FILE_PATH line with code that reads process.env.MEMORY_FILE_PATH, falls back to a --memory-path argument, then a default, and logs the chosen path. As general advice, this is a manual hack to the package file, so check it again after any reinstall or update.

      2. Build from source and point the client at the local build: clone https://github.com/modelcontextprotocol/servers.git (opens external site), run npm install and npm run build in src/memory, then in ~/.claude.json add to mcpServers: "memory": { "type": "stdio", "command": "node", "args": ["/path/to/src/memory/dist/index.js"], "env": { "MEMORY_FILE_PATH": "/absolute/path/memory.jsonl" } }. This was reported working with the Claude Code extension in VS Code.

      If the server process cannot write the file, check write permission (chmod) of the target directory for the user running the stdio process, as one user needed to on Ubuntu via ssh-remote.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Didn't work)

      Installed @modelcontextprotocol/server-memory 0.6.2 globally, exported MEMORY_FILE_PATH=/custom/path/memory.json, and ran mcp-server-memory; the file was still created at the hardcoded package-internal path.

      Source: https://github.com/modelcontextprotocol/servers/issues/1018 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @olaservo tried on GitHub (Outcome unclear)

      A maintainer suggested pinning @modelcontextprotocol/server-memory@latest, saying version 2025.4.25 was understood to include the fix.

      Source: https://github.com/modelcontextprotocol/servers/issues/1018#issuecomment-2951636908 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @twooten tried on GitHub (Worked)

      Cloned the servers repo, ran npm install and npm run build in src/memory, then configured Claude Code's mcpServers to run node with the local dist/index.js and an absolute MEMORY_FILE_PATH in the env block.

      Source: https://github.com/modelcontextprotocol/servers/issues/1018#issuecomment-3648468960 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @sascharo tried on GitHub (Partly worked)

      On server-memory@latest, set MEMORY_FILE_PATH to "memory.jsonl" expecting project-root resolution; no error occurred but the file was not written to the project root. Setting the absolute path then worked.

      Source: https://github.com/modelcontextprotocol/servers/issues/1018#issuecomment-2951757334 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @rossshannon tried on GitHub (Worked)

      Hardcoded a replacement path in the installed dist/index.js so the server reads MEMORY_FILE_PATH, falls back to a --memory-path argument, then a default path, and logs the chosen path; described as a temporary hack.

      Source: https://github.com/modelcontextprotocol/servers/issues/1018#issuecomment-2748482920 (opens external site)

      Did this work for you?

    Add your answer or comment