Skip to content

Commit 44616d7

Browse files
authored
Merge pull request #5474 from modelcontextprotocol/v2/docs/5457-memory-docker-upgrade
docs(memory): give Docker upgrade steps that keep the container working
2 parents 7d1fcf1 + b50db6c commit 44616d7

1 file changed

Lines changed: 36 additions & 1 deletion

File tree

‎src/memory/README.md‎

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,42 @@ Docker:
383383
docker build -t mcp/memory -f src/memory/Dockerfile .
384384
```
385385

386-
For Awareness: a prior mcp/memory volume contains an index.js file that could be overwritten by the new container. If you are using a docker volume for storage, delete the old docker volume's `index.js` file before starting the new container.
386+
### Upgrading a Docker install
387+
388+
The [Docker](#docker) setup mounts the named volume `claude-memory` over `/app/dist`, the image's code directory, so the volume holds the server's code (`index.js`, `version.js`) next to your `memory.jsonl`. Docker copies an image's files into a named volume only while the volume is empty. Once the volume holds your graph, a newer image never reaches it: the container keeps running the code from the image that first filled the volume, which may not even start against the newer image's dependencies. Deleting `index.js` from the volume does not help; it leaves `/app/dist` with no entry point.
389+
390+
To upgrade, build or pull the new `mcp/memory` image, quit the MCP clients that start it, then replace the code in the volume with the new image's, keeping `memory.jsonl`:
391+
392+
```sh
393+
docker run --rm -v claude-memory:/volume --entrypoint sh mcp/memory \
394+
-c 'rm -f /volume/*.js && cp /app/dist/*.js /volume/'
395+
```
396+
397+
The volume is mounted at `/volume` rather than `/app/dist`, so the image's own `/app/dist` stays visible to copy from. Only the `.js` files are replaced; `memory.jsonl` (or a legacy `memory.json`) is left as it is. Repeat this after every image update.
398+
399+
#### Alternative: keep the graph in a volume of its own
400+
401+
Mounting a volume on a directory of its own and pointing `MEMORY_FILE_PATH` at it keeps the code out of the volume, so a new image takes effect with no copying step:
402+
403+
```json
404+
{
405+
"mcpServers": {
406+
"memory": {
407+
"command": "docker",
408+
"args": ["run", "-i", "-v", "claude-memory-data:/data", "-e", "MEMORY_FILE_PATH=/data/memory.jsonl", "--rm", "mcp/memory"]
409+
}
410+
}
411+
}
412+
```
413+
414+
To move an existing graph from the `claude-memory` volume into the new one, quit the MCP clients that start the server, then run:
415+
416+
```sh
417+
docker run --rm -v claude-memory:/old -v claude-memory-data:/data \
418+
--entrypoint cp mcp/memory /old/memory.jsonl /data/memory.jsonl
419+
```
420+
421+
If the old volume holds only a legacy `memory.json`, copy `/old/memory.json` to `/data/memory.jsonl` instead. Once the server has started on the new volume with your graph, you can remove the old volume with `docker volume rm claude-memory`.
387422

388423
## License
389424

0 commit comments

Comments
 (0)