mem0-lite
mem0-lite
コーディングエージェント向けのセルフホスト型メモリ(MCP経由)。Docker不要。Mem0 Platform不要。RESTデーモン不要。
MCPはmem0aiのMemory()をラップし、ベクトルデータは~/.mem0/qdrantにディスク保存されます。ツール呼び出しはプロセス内で実行されます。サイドカーがQdrantを開いたままにし、同じディレクトリ上の2つ目のMCPはlite.lock / lite.want経由で連携します — 追加のデーモンは不要です。
存在理由
公式のMem0が提供するものは、ローカルMCPのセットアップには適さない3つの選択肢です:
公式パス | ここでの問題点 |
Platform MCP ( | メモリがマシンの外に出て行き、コストがかかる。 |
OSS RESTサーバー | Docker + Postgres;重く、メンテナンスが難しく、非Linuxマシンではバッテリーを消耗する。 |
| クライアントのみ、サーバーは含まない。 |
mem0-liteは、OSSのmem0ライブラリをMCPサービスとして公開する軽量ローカルPythonアプリです。
Related MCP server: int
提供機能
MCPツール —
add_memory、search_memories、get_memory_by_id、list_memories、update_memory、delete_memory、delete_all_memories(呼び出し方法はツールドキュメント参照)ローカルストア — ディスク上のQdrant(
on_disk=True)、/tmpは不使用、同時実行調整機能付き使用タイミング — 簡潔なAGENTS.mdポインタ
MCP登録 — uv起動スニペット
保存内容
ベクトルDB、履歴、設定、アクセスログ、lite.lock、lite.wantを~/.mem0に保存
インストール
uv、Python 3.11以上、およびOPENAI_API_KEY(またはOllama — アーキテクチャ参照)が必要です。
このリポジトリをクローンします。
MCPサーバーをホストに登録します(以下のスニペット参照)。ホスト設定または環境に
OPENAI_API_KEYを設定します。コミットしないでください。AGENTS.mdポインタを貼り付けます。
環境変数
MCPはプロセス環境からこれらを読み取ります。変数がシステム環境に設定されており、MCPがサンドボックスで実行されていない場合、ホストがそれを引き継ぎます — ホストのenvブロックに重複して設定する必要はありません。そのenvブロック内の値はシステム環境を上書きします。
OPENAI_API_KEY— 必須(Ollamaを使用する場合は不要。下記参照)MEM0_DIR— データディレクトリ(デフォルト~/.mem0)MEM0_LITE_USER_ID— デフォルトのユーザースコープ(デフォルト$USER)MEM0_LITE_AGENT_ID— オプションのエージェントスコープMEM0_LITE_LOCK_TIMEOUT— ストアロック待機時間(秒、デフォルト30)MEM0_LITE_LLM_PROVIDER— 例:ollama(デフォルト:mem0ai経由のOpenAI)MEM0_LITE_LLM_MODEL— LLMモデル名(Ollamaの場合のデフォルトllama3.2)MEM0_LITE_EMBEDDER_PROVIDER— 例:openaiまたはollamaMEM0_LITE_EMBEDDER_MODEL— 埋め込みモデル(Ollamaの場合のデフォルトnomic-embed-text)
完全なデフォルト:アーキテクチャ。オプトイン評価:フィードバックモード(MEM0_LITE_FEEDBACK_MODE、デフォルトはオフ)
MCP登録
MCPホストの設定にマージします。Cursor:~/.cursor/mcp.jsonまたはプロジェクト.cursor/mcp.json。ディレクトリパスを置き換えてください。
{
"mcpServers": {
"mem0-lite": {
"command": "uv",
"args": ["run", "--directory", "/ABS/PATH/TO/mem0-lite", "mem0-lite", "mcp"],
"env": { "OPENAI_API_KEY": "sk-..." }
}
}
}AGENTS.md
AGENTS.md(またはユーザールール)に貼り付けます。ツールの呼び出し方法はMCPスキーマにあります。これはいつ使うかです。
## 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.メトリクス
すべてのツール呼び出しは、~/.mem0/access-log.jsonlに1行追加します(ツール、エージェント、接続再利用、ロック待機時間、期間)。要約:
uv run python scripts/access-report.pyフィードバックモード
メモリストアの有効性を追跡します。
オンにすると、ツールの応答にtsフィールドが含まれ、rate_memory_callツールを使用して応答を評価できます。
オン(MEM0_LITE_FEEDBACK_MODE=1)の場合:
検索応答に
tsが含まれるエージェントは、有用なヒット、ミス、ノイズの後に
rate_memory_call(call_ts, helpful, reason)を呼び出せる評価は
~/.mem0/feedback.jsonlに追記されるscripts/access-report.pyは評価をアクセスログのtsと結合し、カバレッジ、有用率、フィードバックレイテンシ(ts − call_ts)を報告する
MCPホストのenvブロックで有効にします(デフォルトの登録スニペットには入れないでください):
"env": {
"OPENAI_API_KEY": "sk-...",
"MEM0_LITE_FEEDBACK_MODE": "1"
}有効にする場合は、これをAGENTS.mdに追加してください。
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は次のいずれかです:used | empty_ok | miss | noise | stale | bad_query。空で予想通りの結果はスキップしてください。
ドキュメント
ページ | 内容 |
プロセスモデル、ツール、データレイアウト | |
プラットフォーム、Docker REST、SDKインプロセス、このリポジトリ | |
ファイル、SQLite、ベクトルDB、ホスト型メモリ | |
なぜMCPか、なぜ | |
Git内のキー、 |
このリポジトリの範囲外
2つ目のMem0サーバー実装
Platform互換のHTTP API
mem0-cliの代替グラフメモリ(実際上はPlatformのみ)
このリポジトリはMITライセンスです。mem0aiはApache-2.0のままです。このラッパーはローカルで自由にお使いいただけます。
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.-