mem0-lite
mem0-lite
Selbst gehosteter Speicher für Coding-Agenten über MCP. Kein Docker. Keine Mem0-Plattform. Kein REST-Daemon.
Das MCP kapselt mem0ai Memory(), mit Vektoren auf der Festplatte unter ~/.mem0/qdrant. Tool-Aufrufe bleiben im Prozess. Der Sidecar hält Qdrant offen; ein zweites MCP im selben Verzeichnis gibt über lite.lock / lite.want nach — kein zusätzlicher Daemon.
Warum es das gibt
Offizielles Mem0 bietet drei Dinge, die sich für ein lokales MCP-Setup nicht zusammensetzen lassen:
Offizieller Pfad | Problem hier |
Plattform MCP ( | Speicher verlässt Ihren Rechner, kostet Geld. |
OSS REST-Server | Docker + Postgres; Schwer, schwer zu warten, tötet Akku auf Nicht-Linux-Maschinen. |
| Nur Client, enthält keinen Server. |
mem0-lite ist eine leichte lokale Python-App, die die OSS-mem0-Bibliothek als MCP-Dienst bereitstellt.
Related MCP server: int
Was Sie bekommen
MCP-Tools —
add_memory,search_memories,get_memory_by_id,list_memories,update_memory,delete_memory,delete_all_memories(Wie man sie aufruft, steht in der Tool-Dokumentation)Lokaler Speicher — Qdrant auf der Festplatte (
on_disk=True), nicht/tmp, mit NebenläufigkeitskoordinationWann man sie verwendet — dünner AGENTS.md-Hinweis
MCP-Registrierung — uv-Start-Snippet
Was es speichert
Vektordatenbank, Verlauf, Konfiguration, Zugriffslog, lite.lock und lite.want in ~/.mem0
Installation
Erfordert uv, Python 3.11+ und OPENAI_API_KEY (oder Ollama — siehe Architektur).
Klonen Sie dieses Repository.
Registrieren Sie den MCP-Server bei Ihrem Host (Snippet unten). Setzen Sie
OPENAI_API_KEYin der Host-Konfiguration oder Ihrer Umgebung; committen Sie ihn nicht.Fügen Sie den AGENTS.md-Hinweis ein.
Umgebungsvariablen
Das MCP liest diese aus der Prozessumgebung. Wenn eine Variable in Ihrer Systemumgebung gesetzt ist und das MCP nicht in einer Sandbox läuft, gibt der Host sie durch — Sie müssen sie nicht im env-Block des Hosts duplizieren. Werte in diesem env-Block überschreiben die Systemumgebung.
OPENAI_API_KEY— erforderlich, es sei denn, Sie verwenden Ollama (siehe unten)MEM0_DIR— Datenverzeichnis (Standard~/.mem0)MEM0_LITE_USER_ID— Standard-Benutzerbereich (Standard$USER)MEM0_LITE_AGENT_ID— optionaler AgentenbereichMEM0_LITE_LOCK_TIMEOUT— Wartezeit für Store-Lock in Sekunden (Standard30)MEM0_LITE_LLM_PROVIDER— z.B.ollama(Standard: OpenAI via mem0ai)MEM0_LITE_LLM_MODEL— LLM-Modellname (Standardllama3.2mit Ollama)MEM0_LITE_EMBEDDER_PROVIDER— z.B.openaioderollamaMEM0_LITE_EMBEDDER_MODEL— Embedder-Modell (Standardnomic-embed-textmit Ollama)
Vollständige Standardwerte: Architektur. Opt-in-Bewertung: Feedback-Modus (MEM0_LITE_FEEDBACK_MODE, Standard aus).
MCP-Registrierung
Fügen Sie in die Konfiguration Ihres MCP-Hosts ein. Cursor: ~/.cursor/mcp.json oder Projekt .cursor/mcp.json. Ersetzen Sie den Verzeichnispfad.
{
"mcpServers": {
"mem0-lite": {
"command": "uv",
"args": ["run", "--directory", "/ABS/PATH/TO/mem0-lite", "mem0-lite", "mcp"],
"env": { "OPENAI_API_KEY": "sk-..." }
}
}
}AGENTS.md
Fügen Sie in AGENTS.md (oder Benutzerregeln) ein. Wie man Tools aufruft, steht in den MCP-Schemas. Dies ist das Wann.
## Memory
MCP `mem0-lite` is registered. Search at task start, context switch, or when the user references past work. After the reply, write only if a new agent would benefit in days/weeks (future utility, novelty, factual, no secrets). Do not announce recall. Prefer `update_memory`. Most turns write nothing.Metriken
Jeder Tool-Aufruf fügt eine Zeile an ~/.mem0/access-log.jsonl an (Tool, Agent, Verbindungswiederverwendung, Lock-Wartezeit, Dauer). Zusammenfassung:
uv run python scripts/access-report.pyFeedback-Modus
Verfolgt die Effektivität des Speichers.
Wenn eingeschaltet, enthalten Tool-Antworten ein ts-Feld, das verwendet werden kann, um eine Antwort mit dem Tool rate_memory_call zu bewerten.
Wenn eingeschaltet (MEM0_LITE_FEEDBACK_MODE=1):
Retrieval-Antworten enthalten
tsAgenten können
rate_memory_call(call_ts, helpful, reason)nach einem nützlichen Treffer, einem Fehlschlag oder Rauschen aufrufenBewertungen werden an
~/.mem0/feedback.jsonlangehängtscripts/access-report.pyverknüpft Bewertungen mit Zugriffslog-tsund meldet Abdeckung, Hilfsrate und Feedback-Latenz (ts − call_ts)
Aktivieren Sie im env-Block des MCP-Hosts (nicht in das Standard-Registrierungs-Snippet einfügen):
"env": {
"OPENAI_API_KEY": "sk-...",
"MEM0_LITE_FEEDBACK_MODE": "1"
}Wenn Sie es aktivieren, fügen Sie dies zu AGENTS.md hinzu.
After a retrieval call, if you used a hit, clearly missed a fact, or got noise, call rate_memory_call with that response's ts.reason ist einer von: used | empty_ok | miss | noise | stale | bad_query. Überspringen Sie leere und erwartete Ergebnisse.
Dokumentation
Seite | Inhalt |
Prozessmodell, Tools, Datenlayout | |
Plattform, Docker REST, SDK-in-Prozess, dieses Repository | |
Dateien, SQLite, Vektordatenbanken, gehosteter Speicher | |
Warum MCP, warum | |
Schlüssel in Git, |
Nicht dieses Repository
Eine zweite Mem0-Server-Implementierung
Eine plattformkompatible HTTP-API
Ein Ersatz für
mem0-cliGraph-Speicher (in der Praxis nur Plattform)
Dieses Repository ist MIT. mem0ai bleibt Apache-2.0. Dieser Wrapper gehört Ihnen, um ihn lokal zu behalten.
Available Tools
8 toolsadd_memoryA
Store a memory. Prefer infer=false with a self-contained third-person fact.
memory_type: decision | convention | anti_pattern | user_preference | task_learning | environmental | identity | rule | project
infer=true lets mem0 extract facts from raw conversation; skip for explicit facts.
Never store secrets. Skip small talk, tool dumps, and one-shot commands.
Inputs: text (required), infer, user_id, agent_id, +2 more. Returns: result
delete_all_memoriesC
Delete all memories in scope. Requires confirm=true.
Inputs: confirm, user_id, agent_id. Returns: result
delete_memoryC
Delete one memory by id.
Inputs: memory_id (required). Returns: result
get_memory_by_idA
Fetch one memory by id. When MEM0_LITE_FEEDBACK_MODE is enabled, rate via rate_memory_call(call_ts).
Inputs: memory_id (required). Returns: result
list_memoriesC
List memories in scope. Not a substitute for search_memories. When MEM0_LITE_FEEDBACK_MODE is enabled, responses include ts; rate useful/miss/noise via rate_memory_call.
Inputs: top_k, user_id, agent_id, memory_type. Returns: result
rate_memory_callA
Rate a prior retrieval by call_ts (from response ts when MEM0_LITE_FEEDBACK_MODE is enabled).
Call when you used a hit, clearly missed a fact, or got irrelevant noise. Skip empty-and-expected results.
reason: used | empty_ok | miss | noise | stale | bad_query
Inputs: reason (required), call_ts (required), helpful (required), note. Returns: result
search_memoriesA
Semantic search. Rewrite the query to 3-6 keywords matching stored third-person facts.
Do not pass the user's raw message. Drop pronouns and question words.
When useful, run 2-4 parallel searches with memory_type: decision, convention, anti_pattern, or omit for catch-all.
When MEM0_LITE_FEEDBACK_MODE is enabled, responses include ts; rate useful/miss/noise via rate_memory_call.
Inputs: query (required), top_k, user_id, agent_id, +1 more. Returns: result
update_memoryA
Replace memory text in place. Prefer this over delete+add when a fact changed.
Inputs: text (required), memory_id (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool has a clearly distinct purpose: add, update, search, get by ID, list, delete single, delete all, and rate. Potential confusion between search_memories and list_memories is addressed in descriptions, ensuring no ambiguity.
All tool names follow a consistent verb_noun pattern in snake_case (e.g., update_memory, search_memories, delete_all_memories). The naming is predictable and uniform across the set.
With 8 tools, the server is well-scoped for a memory management system. The count covers essential operations without being excessive or insufficient.
The tool surface provides complete coverage for memory CRUD (add, get, update, delete) plus search, listing, bulk deletion, and a feedback rating mechanism. No obvious gaps for the declared purpose.
Maintenance
Related MCP Connectors
Hosted MCP memory for coding agents: persistent across sessions, editable markdown, team sharing.
Hosted memory for AI agents over MCP. One memory shared by all your agents.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Persistent, inspectable memory for AI agents with lineage, correction, and a hosted MCP endpoint.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceProvides persistent memory for AI coding agents via MCP, enabling agents to store and semantically recall facts, events, and lessons across sessions, all running locally without cloud dependencies.Apache 2.0
- FlicenseNot gradedqualityCmaintenanceSelf-hosted AI memory system for coding assistants, providing project-scoped memory storage and retrieval via MCP tools (add, search, list, delete) to recall prior learnings without re-running discovery.1-
- AlicenseNot gradedqualityBmaintenanceProvides persistent memory for AI coding agents, enabling them to save, search (hybrid vector/BM25/concept graph), list sessions, and forget memories via MCP tools.11 npmApache 2.0
- FlicenseNot gradedqualityAmaintenanceEnables AI coding agents to store, search, and recall persistent project and cross-project memories locally over MCP, keeping architectural decisions, conventions, and error patterns available across sessions. Also optionally exposes a task server for autonomous task execution driven by that same memory store.-