LabscoMCP early access ↗
elvismdevMCP SERVER

Mem0 MCP Selfhosted

mem0 memory for Claude Code, running on your own Qdrant, Ollama and optional Neo4j.

by elvismdev ↗Agent MemoryCommunity

LABSCO 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_memories with filters, thresholds and reranking, get_memories, get_memory, update_memory, delete_memory, delete_all_memories
  • Scoping: list_entities lists users, agents and runs with memory counts; delete_entities cascade-deletes an entity and everything under it
  • Graph memory: search_graph finds Neo4j entities by name substring with their outgoing relationships, get_entity returns both incoming and outgoing edges
  • Session hooks that need no tool calls at all: mem0-hook-context searches memory at session start and injects the results as additional context, mem0-hook-stop summarises the last exchanges on exit and saves them; mem0-install-hooks wires both in and is safe to run twice
  • Transport choice through MEM0_TRANSPORT — stdio, sse or streamable-http on MEM0_PORT, default 8081
  • A provider switch: MEM0_PROVIDER=ollama moves 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