modelcontextprotocol / modelcontextprotocol/servers

Memory MCP ignores custom storage path setting

Open
#692 15 comments 15 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
90.5k
Forks
11.7k
Avg merge
2d 2h
Merged PRs (30d)
5

Description

I've been trying to configure the MCP memory server to store data in a custom location, but it continues to store the memory.json file in the NPX temporary directory instead.

Configuration

In my Claude desktop config file, I've specified a custom path:

"memory": {
  "command": "npx",
  "args": [
    "-y",
    "@modelcontextprotocol/server-memory"
  ],
  "env": {
    "MEMORY_FILE_PATH": "/Users/XX/Library/Application Support/Claude/mcp/memory.json"
  }
}
Actual Behavior

Despite setting the MEMORY_FILE_PATH environment variable, the memory.json file is still being created in the NPX temporary directory:

/Users/XX/.npm/_npx/15b07286cbcc3329/node_modules/@modelcontextprotocol/server-memory/dist/memory.json
Additional Information
  • I've created the target directory and ensured it has appropriate permissions
  • The memory functionality works correctly, but uses the wrong file location
  • Claude can read/write to the temporary file location, but this isn't persistent

Can someone help explain why the environment variable isn't being recognized, or if there's a different way to specify a custom storage location? This is concerning because NPX temporary directories may be cleaned up, potentially losing all memory data.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the server-memory implementation for MEMORY_FILE_PATH handling and reproduce the launch through the shown npx configuration. Done means the environment variable is honored and memory.json is written to the configured path rather than the NPX directory, with coverage for the custom-path case.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.