Skip to content

fix(memory): honor MEMORY_FILE_PATH relative to cwd and prepare storage dir#4327

Open
KirtiRamchandani wants to merge 1 commit into
modelcontextprotocol:mainfrom
KirtiRamchandani:fix/memory-file-path-mkdir
Open

fix(memory): honor MEMORY_FILE_PATH relative to cwd and prepare storage dir#4327
KirtiRamchandani wants to merge 1 commit into
modelcontextprotocol:mainfrom
KirtiRamchandani:fix/memory-file-path-mkdir

Conversation

@KirtiRamchandani

Copy link
Copy Markdown

Problem

MEMORY_FILE_PATH was resolved relative to the installed package directory when a relative path was provided, so MCP clients configuring a workspace-local path still wrote into the npx cache directory (#692).

Custom absolute paths also failed when parent directories did not exist yet.

Root cause

  • Relative env paths joined against import.meta.url instead of process.cwd()
  • No directory creation before first write
  • Custom .json paths were not migrated to JSONL like the default path

Fix

  • Resolve relative MEMORY_FILE_PATH with path.resolve(process.cwd(), ...)
  • mkdir parent directories for custom storage paths
  • Migrate legacy custom memory.json to memory.jsonl
  • Tests for cwd resolution, mkdir, and custom-path migration

Fixes #692

…ge dir

Resolve relative MEMORY_FILE_PATH against process.cwd() instead of the
installed package directory, create parent directories for custom paths,
and migrate legacy .json custom paths to .jsonl.

Fixes modelcontextprotocol#692
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory MCP ignores custom storage path setting

1 participant