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)
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
Option A: Configure for Claude Code (Docker)
To allow Claude Code to access the MemMachine MCP, create or edit the Ensure Persistence: To ensure the connection remains active across sessions, verify or add these settings to your local Claude settings file located at
.mcp.json file in your project root:Crucial for Claude Code: You must verify that your connection settings in
.mcp.json match the bridge configuration in ./.claude/settings.local.json. Claude Code uses the latter to maintain persistent authorization for the MCP server../.claude/settings.local.json.Configuration Details:
To ensure the MCP server communicates correctly with your environment, verify the following parameters in your .mcp.json and .claude/settings.local.json files:| Parameter | Value / Description |
|---|---|
command | Use docker for containerized setups or memmachine-mcp-stdio for local installs. |
MEMORY_CONFIG | Path to your configuration.yml. Note: Use absolute paths for local (Option B) setups. |
userId | Your unique identifier for memory sessions (corresponds to MM_USER_ID). |
PYTHONUNBUFFERED | Always set to 1 to ensure immediate output and logging from Python. |
Option B: Configure with Direct Command
Reference Implementation: This method follows the standard MCP stdio pattern. While it uses the same configuration files as the Docker method, ensure your local Python environment is correctly mapped.
.mcp.json file in your project root:uv, use the following configuration in your .mcp.json:MEMORY_CONFIG to avoid path resolution issues.Crucial for Claude Code: You must verify that your connection settings in
.mcp.json match the bridge configuration in ./.claude/settings.local.json. Claude Code uses the latter to maintain persistent authorization for the MCP server.Test the Integration
Once configured, start Claude Code in your project directory:Verify the connection by checking the active MCP servers:If MemMachine is listed, Claude will automatically use the Claude should use the Claude should search memory and recall your TypeScript preference.
add_memory and search_memory tools to manage your project context.add_memory tool to store this preference.Test memory recall by starting a new conversation and asking: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
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

