Claude Code Memory Server (MCP)
729
A Docker-based MCP (Model Context Protocol) server that provides persistent memory capabilities for Claude Code using the official Anthropic MCP SDK, Mem0, and Qdrant vector database.
Version 2.1.0 - Production-ready with multi-project memory support and automatic project detection.
Create a docker-compose.yml file for the Qdrant vector database:
version: '3.8'
services:
# Qdrant Vector Database (only service needed for MCP)
qdrant:
image: qdrant/qdrant:latest
ports:
- "6333:6333"
- "6334:6334"
volumes:
- ./volume-qdrant:/qdrant/storage
environment:
- QDRANT__SERVICE__HTTP_PORT=6333
- QDRANT__SERVICE__GRPC_PORT=6334
Start the database:
# Start Qdrant database
docker compose up -d
# Verify it's running
curl http://YOUR_QDRANT_IP:6333
Add Ollama to your docker-compose.yml:
services:
ollama:
image: ollama/ollama
ports: ["11434:11434"]
volumes: ["./volume-ollama:/root/.ollama"]
runtime: nvidia
restart: unless-stopped
Pull required models:
docker compose up -d ollama
docker exec ollama ollama pull nomic-embed-text:v1.5
claude mcp add mem0-memory -- docker run --rm -i \
--name mem0-memory-mcp \
--network host \
-e OLLAMA_URL=http://YOUR_OLLAMA_IP:11434 \
-e QDRANT_HOST=YOUR_QDRANT_IP \
-e EMBED_MODEL=nomic-embed-text:v1.5 \
dogkeeper886/claude-code-memory-mcp-server:latest
# Check MCP connection
claude mcp list
# Should show: mem0-memory: docker run ... - ✓ Connected
# Test in Claude Code
# Type: "Remember that I prefer using TypeScript for new projects"
# Then: "What do you remember about my preferences?"
| Variable | Description | Default | Required |
|---|---|---|---|
OLLAMA_URL | Ollama server URL | - | ✅ |
QDRANT_HOST | Qdrant host IP/hostname | - | ✅ |
EMBED_MODEL | Embedding model | nomic-embed-text | ✅ |
QDRANT_PORT | Qdrant port | 6333 | ❌ |
Ensure these models are available in your Ollama instance:
# Pull required models
ollama pull llama3.2:3b
ollama pull nomic-embed-text
Claude Code ←→ MCP Server ←→ Ollama (LLM/Embeddings)
↓
Qdrant (Vector DB)
The server automatically detects your current project and isolates memories:
process.cwd()# Working in /home/user/my-react-app
"Remember to use hooks instead of class components"
# → Stored with project: my-react-app
# Later, working in /home/user/my-vue-app
"What do you remember about React?"
# → No results (different project)
# Search globally across all projects
"Search globally: React patterns"
# → Finds memories from all projects
| Tool | Description | Scope |
|---|---|---|
add_memory | Add memories with auto-tagging | Current project |
search_memory | Search current project | Project-scoped |
search_memory_global | Search all projects | Global |
list_memories | List all memories | User-wide |
list_project_memories | List project memories | Project-specific |
get_project_context | Get current project info | Current project |
delete_memory | Delete specific memory | By ID |
reset_memory | Reset all memories | User-wide |
claude mcp list
claude mcp remove mem0-memory
# Remove old server
claude mcp remove mem0-memory
# Pull latest image
docker pull dogkeeper886/claude-code-memory-mcp-server:latest
# Re-add with same command as installation
claude mcp add mem0-memory -- docker run --rm -i \
--name mem0-memory-mcp --network host \
-e OLLAMA_URL=http://YOUR_OLLAMA_IP:11434 \
-e QDRANT_HOST=YOUR_QDRANT_IP \
dogkeeper886/claude-code-memory-mcp-server:latest
All data is automatically persisted in Docker volumes:
# Backup Qdrant database
docker run --rm -v qdrant_data:/data -v $(pwd):/backup alpine \
tar czf /backup/qdrant-backup.tar.gz -C /data .
# Restore from backup
docker run --rm -v qdrant_data:/data -v $(pwd):/backup alpine \
tar xzf /backup/qdrant-backup.tar.gz -C /data
The server provides health endpoints for monitoring:
# Check if Qdrant is accessible (when running with exposed port)
curl http://YOUR_QDRANT_IP:6333/health
# For MCP server health, check Claude Code connection:
claude mcp list # Should show ✓ Connected
MCP server not connecting:
# Check if Ollama is running
curl http://YOUR_OLLAMA_IP:11434/api/tags
# Check if Qdrant is running
curl http://YOUR_QDRANT_IP:6333/health
# Verify Claude Code can access Docker
claude mcp list
Slow memory search:
# Check Ollama model is downloaded
ollama list | grep nomic-embed-text
# Verify network connectivity
docker run --rm --network host alpine ping YOUR_OLLAMA_IP
Memory not persisting:
# Check Qdrant data volume exists
docker volume ls | grep qdrant_data
# Verify Qdrant is storing data
curl http://YOUR_QDRANT_IP:6333/collections
docker logs mem0-memory-mcp (if running detached)claude mcp list shows ✓ Connected# Clone repository
git clone https://github.com/dogkeeper886/claude-code-memory.git
cd claude-code-memory
# Build image
docker build -t claude-code-memory-mcp-server .
# Use your local image
claude mcp add mem0-memory -- docker run --rm -i \
--name mem0-memory-mcp --network host \
-e OLLAMA_URL=http://YOUR_OLLAMA_IP:11434 \
-e QDRANT_HOST=YOUR_QDRANT_IP \
claude-code-memory-mcp-server
# Install dependencies
npm install
# Start development server
npm run dev
# Build TypeScript
npm run build
# Run tests
npm test
MIT License - see LICENSE file for details.
Ready to enhance your Claude Code experience with persistent memory? Pull the Docker image and get started in minutes!
Content type
Image
Digest
sha256:972ef4181…
Size
91.5 MB
Last updated
about 1 year ago
docker pull dogkeeper886/claude-code-memory-mcp-server