Got tired of re-explaining my project setup, coding preferences, and debugging insights every time I start a new Claude Code session. Built an MCP server that gives it persistent memory. What it looks like: Session 1:
Remember that this project uses PostgreSQL with Prisma and auth uses JWT validated in middleware Session 2 (days later): Search my memories for auth decisions → “Auth uses JWT validated in middleware” → “This project uses PostgreSQL with Prisma” Claude retrieves what it already knows and picks up where it left off. Make it automatic with CLAUDE.md: Add this to ~/.claude/CLAUDE.md and Claude uses memory without you asking:
MCP Servers - mem0: Persistent memory across sessions. At the start of each session, search_memories for relevant context before asking the user to re-explain anything. Use add_memory whenever you discover project architecture, coding conventions, debugging insights, key decisions, or user preferences. When in doubt, save it — future sessions benefit from over-remembering.
With this, Claude proactively searches memory at session start and saves things it learns as it goes. You stop re-explaining, and sessions build on each other. Setup (one command, global across all projects):
Start infrastructure > docker run -d -p 6333:6333 qdrant/qdrant > docker run -d -p 11434:11434 -v ollama:/root/.ollama --name ollama ollama/ollama > docker exec ollama ollama pull bge-m3 # Add MCP server > claude mcp add --scope user --transport stdio mem0 \ –env MEM0_QDRANT_URL=http://localhost:6333/ \ –env MEM0_EMBED_URL=http://localhost:11434/ \ –env MEM0_EMBED_MODEL=bge-m3 \ –env MEM0_EMBED_DIMS=1024 \ –env MEM0_USER_ID=your-user-id \ – uvx --from git+https://github.com/elvismdev/mem0-mcp-selfhosted.git mem0-mcp-selfhosted
Restart Claude Code and you’re done. uvx handles the install automatically. Zero-config auth: It auto-reads your OAT token from ~/.claude/.credentials.json . No API key to configure, it uses your existing Claude subscription. What it gives you: Semantic search
- “find my database preferences” matches “this project uses PostgreSQL with Prisma” even with different wording Automatic fact extraction
- just tell Claude to remember something, the LLM extracts key facts and stores them Cross-project memory
- your preferences and conventions carry across all projects Optional knowledge graph
- add Neo4j and Claude builds entity relationships (“user prefers TypeScript with strict mode”) that you can query 11 tools: add , search , browse , get , update , delete , bulk delete , list entities , delete entities , search graph , get entity . Everything self-hosted
- Qdrant + Ollama on your machine. Your memories stay local. What I’d love to know: Does Claude Code actually use the tools proactively with the CLAUDE.md setup in your experience? What kind of things would you want Claude Code to remember that it currently forgets How’s the setup experience? GitHub: https://github.com/elvismdev/mem0-mcp-selfhosted Issues and PRs welcome! :) submitted by /u/Aware-One7480
Originally posted by u/Aware-One7480 on r/ClaudeCode
