add_memoryLABSCO SUMMARY
The hooks are the part that actually changes a session.
Tools only help when the assistant remembers to call them. Wiring memory into SessionStart and Stop means context arrives before the first question and a summary is written after the last one, with no discipline required from you. Both hooks fail quietly if the stack is unreachable, so a stopped Qdrant slows nothing down — it just means that session has no memory.
What it is
A self-hosted memory server that uses the mem0ai package directly as a library and exposes 11 tools for full memory management. Nothing is stored in a vendor's cloud: vectors live in your Qdrant, embeddings come from your Ollama, and the knowledge graph, if you enable one, is your Neo4j.
What you get
- Memory management:
add_memory,search_memorieswith filters, thresholds and reranking,get_memories,get_memory,update_memory,delete_memory,delete_all_memories - Scoping:
list_entitieslists users, agents and runs with memory counts;delete_entitiescascade-deletes an entity and everything under it - Graph memory:
search_graphfinds Neo4j entities by name substring with their outgoing relationships,get_entityreturns both incoming and outgoing edges - Session hooks that need no tool calls at all:
mem0-hook-contextsearches memory at session start and injects the results as additional context,mem0-hook-stopsummarises the last exchanges on exit and saves them;mem0-install-hookswires both in and is safe to run twice - Transport choice through
MEM0_TRANSPORT—stdio,sseorstreamable-httponMEM0_PORT, default 8081 - A provider switch:
MEM0_PROVIDER=ollamamoves both the main and graph LLM local, while the default reads your Claude Code session token automatically
Requirements
Python 3.10 or higher and uv. Qdrant is required and defaults to http://localhost:6333; Ollama is required for embeddings and defaults to http://localhost:11434 with bge-m3 at 1024 dimensions. Neo4j 5+ is optional and only used when MEM0_ENABLE_GRAPH is on. In the default configuration no API key is needed — the server reads your Claude Code token from ~/.claude/.credentials.json — while MEM0_ANTHROPIC_TOKEN, ANTHROPIC_API_KEY and GOOGLE_API_KEY cover the other provider paths. MEM0_USER_ID scopes what a session can see. The package is mem0-mcp-selfhosted.
Setup effort
One command — claude mcp add --scope user --transport stdio mem0 --env MEM0_USER_ID=your-user-id -- uvx --from git+https://github.com/elvismdev/mem0-mcp-selfhosted.git mem0-mcp-selfhosted
USE CASES
Not re-explaining the project every morning
The session-start hook searches for architecture and recent summaries and injects them before you type anything.
Capturing a decision the moment it is made
Have the assistant store the convention or the gotcha as a memory mid-session, with metadata for later filtering.
Asking how two things relate
Turn on graph memory and query the entity's incoming and outgoing relationships rather than a flat list of notes.
Running with nothing leaving the machine
Set the provider to Ollama so the main LLM, the graph LLM and the embeddings are all local.
11 tools
Listed in project docs. Your client may show a different list.
search_memoriesget_memoriesget_memoryupdate_memorydelete_memorydelete_all_memorieslist_entitiesdelete_entitiessearch_graphget_entityBEFORE YOU INSTALL
What to know first
Tools you get
11 tools named in the project's documentation.
Requires
Python >= 3.10
INSTALLATION
Connect your client
Server setup
Claude Code — user scope
claude mcp add --scope user --transport stdio mem0 \
--env MEM0_USER_ID=<YOUR_MEM0_USER_ID> \
-- uvx --from git+https://github.com/elvismdev/mem0-mcp-selfhosted.git mem0-mcp-selfhosted