Getting Started with MemMachine in Claude Code
This guide will help you integrate MemMachine into Claude Code, Anthropic’s official CLI tool for software engineering tasks. With MemMachine, Claude Code can remember context across sessions, making it more helpful for ongoing projects.What is Claude Code?
Claude Code is a command-line interface that provides Claude with powerful tools for software development, including file operations, code execution, and now—with MemMachine—persistent memory across conversations.Prerequisites
Before you begin, ensure you have:- Claude Code installed and configured
- MemMachine running (either via Docker or as a Python package)
- A MemMachine configuration file (
config.yml)
1
Choose Your Setup Method
MemMachine can be integrated with Claude Code in two ways:Option A: Using Docker (Recommended)
- Best for isolated, reproducible environments
- MemMachine runs in a container
- Requires Docker installed and running
- Simpler setup if you have MemMachine installed locally
- Uses your system Python environment
- Requires MemMachine installed via pip or uv
2
Option A: Configure with Docker
If you’re running MemMachine in Docker, create or edit the Configuration Details:
.mcp.json file in your project root:memmachine-app: The name of your Docker container (adjust if different)MEMORY_CONFIG: Path to your config file inside the containerMM_USER_ID: Your user identifier for memory sessions (customize this)PYTHONUNBUFFERED: Ensures immediate output from Python
3
Option B: Configure with Direct Command
Reference Implementation: This method has not been fully tested with Claude Code. It follows the standard MCP stdio pattern and should work, but if you encounter issues, please use Option A (Docker) or report your findings.
.mcp.json file in your project root:MEMORY_CONFIG to avoid path resolution issues.4
Test the Integration
Once configured, start Claude Code in your project directory:Claude Code will automatically detect the Claude should use the Claude should search memory and recall your TypeScript preference.
.mcp.json file and connect to MemMachine.Verify the connection by checking /mcp or asking Claude to store something in memory:add_memory tool to store this preference.Test memory recall by starting a new conversation and asking:5
Using Memory with Claude Code
MemMachine provides two main tools that Claude Code can use:add_memory: Stores new information
- Called automatically when you share facts, preferences, or important context
- Stores both episodic (conversation) and profile (long-term) memory
- Called automatically when context from previous sessions might be helpful
- Searches both conversation history and user profile
6
Troubleshooting
Claude Code can’t connect to MemMachine:Or if running directly, check the stderr output in your terminal.
- Verify your Docker container is running:
docker ps | grep memmachine - Check the container name matches your config
- Review Claude Code logs for connection errors
- Ensure
MEMORY_CONFIGpoints to a valid configuration file - Check that your Neo4j and PostgreSQL databases are running
- Verify
MM_USER_IDis consistent across sessions
- If using Docker, ensure the container has proper volume mounts
- Check file permissions on your configuration file
- Verify the path to
memmachine-mcp-stdiois correct

