mem0-lite
Provides self-hosted memory management for coding agents via MCP, with local vector storage and tools for adding, searching, updating, and deleting memories.
README
mem0-lite
Self-hosted memory for coding agents via MCP. No Docker. No Mem0 Platform. No REST daemon.
The MCP wraps mem0ai Memory(), with vectors on disk under ~/.mem0/qdrant. Tool calls stay in-process. The sidecar keeps Qdrant open; a second MCP on the same dir yields via lite.lock / lite.want — no extra daemon.
Why this exists
Official Mem0 gives you three things that do not compose for a local MCP setup:
| Official path | Problem here |
|---|---|
Platform MCP (mcp.mem0.ai) |
Memory leaves your machine, costs money. |
| OSS REST server | Docker + Postgres; Heavy, hard to maintain, kills battery on non-Linux machines. |
mem0-cli |
Client only, does not include server |
mem0-lite is a liteweight local Python app that exposes the OSS mem0 library as an MCP service.
What you get
- MCP tools —
add_memory,search_memories,get_memory_by_id,list_memories,update_memory,delete_memory,delete_all_memories(how to call them is in the tool docs) - Local store — Qdrant on disk (
on_disk=True), not/tmp, with concurrency coordination - When to use them — thin AGENTS.md pointer
- MCP registration — uv launch snippet
What it stores
vector db, history, config, access log, lite.lock, and lite.want in ~/.mem0
Install
Requires uv, Python 3.11+, and OPENAI_API_KEY (or Ollama — see architecture).
- Clone this repo.
- Register the MCP server with your host (snippet below). Set
OPENAI_API_KEYin the host config or your environment; do not commit it. - Paste the AGENTS.md pointer.
Env
The MCP reads these from the process environment. If a variable is set in your system environment and the MCP is not running in a sandbox, the host passes it through — you do not need to duplicate it in the host's env block. Values in that env block override the system environment.
OPENAI_API_KEY— required unless using Ollama (see below)MEM0_DIR— data directory (default~/.mem0)MEM0_LITE_USER_ID— default user scope (default$USER)MEM0_LITE_AGENT_ID— optional agent scopeMEM0_LITE_LOCK_TIMEOUT— store lock wait in seconds (default30)MEM0_LITE_LLM_PROVIDER— e.g.ollama(default: OpenAI via mem0ai)MEM0_LITE_LLM_MODEL— LLM model name (defaultllama3.2with Ollama)MEM0_LITE_EMBEDDER_PROVIDER— e.g.openaiorollamaMEM0_LITE_EMBEDDER_MODEL— embedder model (defaultnomic-embed-textwith Ollama)
Full defaults: architecture. Opt-in rating: Feedback mode (MEM0_LITE_FEEDBACK_MODE, default off).
MCP registration
Merge into your MCP host's config. Cursor: ~/.cursor/mcp.json or project .cursor/mcp.json. Replace the directory path.
{
"mcpServers": {
"mem0-lite": {
"command": "uv",
"args": ["run", "--directory", "/ABS/PATH/TO/mem0-lite", "mem0-lite", "mcp"],
"env": { "OPENAI_API_KEY": "sk-..." }
}
}
}
AGENTS.md
Paste into AGENTS.md (or user rules). How to call tools is in the MCP schemas. This is when.
## 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.
Metrics
Every tool call appends one line to ~/.mem0/access-log.jsonl (tool, agent, connection reuse, lock wait, duration). Summarize:
uv run python scripts/access-report.py
Feedback mode
Tracks effectiveness of the memory store.
When on, tool responses include a ts field, which can be used to rate a response using the rate_memory_call tool.
When on (MEM0_LITE_FEEDBACK_MODE=1):
- Retrieval responses include
ts - Agents can call
rate_memory_call(call_ts, helpful, reason)after a useful hit, a miss, or noise - Ratings append to
~/.mem0/feedback.jsonl scripts/access-report.pyjoins ratings to access-logtsand reports coverage, helpful rate, and feedback latency (ts − call_ts)
Enable in the MCP host env block (do not put this in the default registration snippet):
"env": {
"OPENAI_API_KEY": "sk-...",
"MEM0_LITE_FEEDBACK_MODE": "1"
}
If you enable it, add this to 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 is one of: used | empty_ok | miss | noise | stale | bad_query. Skip empty-and-expected results.
Docs
| Page | Contents |
|---|---|
| Architecture | Process model, tools, data layout |
| Alternative Mem0 architectures | Platform, Docker REST, SDK-in-process, this repo |
| Alternative storage | Files, SQLite, vector DBs, hosted memory |
| Decisions | Why MCP, why infer=false, why not REST |
| Footguns | Keys in git, /tmp Qdrant, CLI-as-tool, query rewrite |
Not this repo
- A second Mem0 server implementation
- A Platform-compatible HTTP API
- A replacement for
mem0-cli - Graph memory (Platform-only in practice)
This repo is MIT. mem0ai remains Apache-2.0. This wrapper is yours to keep local.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。