DeepMem

io.github.deepmemteam由 GitHub 账号 deepmemteam 发布v0.1.0更新于 Oct 24, 2026

Mem0-compatible persistent memory for AI agents: write facts once, recall them semantically.

已验证Streamable HTTP可网页运行知识与记忆AI 与机器学习

概览

AI 生成的概览

DeepMem 是兼容 Mem0 的托管持久记忆服务,其 MCP 端点让助手写入事实并在后续会话中按语义检索。

可以做什么
  • 写入记忆:按 user_id 保存对话消息或原始文本,可选由 LLM 抽取事实。
  • 检索记忆:融合向量相似度、关键词匹配、实体加权与时间衰减的语义搜索。
  • 删除记忆:删除已存记忆,支持软删除与按用户重置。
  • 管理与迁移记忆:按用户、代理或运行范围隔离数据,并以 JSON 导出或导入。
适用场景
当你希望助手在会话之间记住用户、项目或偏好的长期事实,又不想自建记忆服务时使用。也适合已使用 Mem0 风格 API、想换成可直接替换方案的团队。
运行要求
需要 deepmem.dev 上的远程 MCP 端点(streamable HTTP)。必须提供 DeepMem API 密钥,通过 Authorization 头以 bearer 方式发送。免费额度之外可能需要付费套餐。
安装前请注意
API 密钥属于机密,经 Authorization 头发送,不要写入共享配置文件。记忆内容会发送到 DeepMem 云端,避免写入敏感个人数据。写入与删除工具会改动已存数据,重置会永久删除某用户的全部记忆。

安装

在 SourceWeft 中

  1. 打开 控制台中的 DeepMem,将其添加到工作区。
  2. 连接 Authorization token 凭据。它们会被私密存储,绝不会在公开页面上展示。
  3. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.deepmemteam%2Fdeepmem/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "deepmem": {
      "type": "http",
      "url": "https://deepmem.dev/mcp",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      }
    }
  }
}

README

DeepMem

Drop-in AI memory layer with 2× faster response and 10× lower cost.
Fully compatible with Mem0 API. Migrate in 5 minutes - one import line.

Self-hostable. No auth, no payment, no lock-in. Or use the managed cloud at deepmem.dev.

[Docker Image] [DeepMem Cloud] [License: MIT]

Cloud · Self-host · Benchmarks · Reproduce them

[DeepMem quickstart demo]


Migrate from Mem0 in one line - same MemoryClient, same method signatures:

python
# Before - Mem0from mem0 import MemoryClientclient = MemoryClient(api_key="m0-...")
# After - DeepMem (only the import changes)from deepmem import MemoryClientclient = MemoryClient(api_key="dm_live-...")   # get a key at deepmem.dev
bash
pip install deepmem-client

Turn conversations into searchable long-term memory: a FastAPI HTTP API in front of a Qdrant vector store, with LLM fact extraction, hybrid retrieval (vector + BM25 + entity boost + time-decay), semantic caching, async batched distillation, GDPR controls, and a built-in MCP server. It runs in open mode - no API key, no user registration - so you can deploy it for your own agents in minutes. Multi-tenant isolation is driven by user_id in the request body.

Prefer not to self-host? DeepMem Cloud is the managed version of this exact engine at deepmem.dev - same API, no infra. Sign up, grab a key (dm_live_...), point your base URL at https://deepmem.dev, done. The cloud and the open-source server speak the same Mem0-compatible API, so client code is identical.

Migrate from Mem0

Already using Mem0? Switch to DeepMem cloud in one line. The deepmem-client package mirrors mem0.MemoryClient - same class name, same method signatures, same filters={"user_id": ...} style - so everything after the import stays untouched.

bash
pip install deepmem-client
python
# before (Mem0)from mem0 import MemoryClientclient = MemoryClient(api_key="m0-...")client.add(messages, user_id="alex")client.search("What can Alex cook?", filters={"user_id": "alex"})
# after (DeepMem cloud) - change one import linefrom deepmem import MemoryClientclient = MemoryClient(api_key="dm_live_...")        # key at https://deepmem.devclient.add(messages, user_id="alex")                # identical callsclient.search("What can Alex cook?", filters={"user_id": "alex"})
Behavioral notes
  • add(infer=True) (the default) is asynchronous on DeepMem cloud - it returns pending=True with results=[] and extracted facts land a few seconds later. (Mem0 cloud's add is async too - it returns PENDING.) Pass infer=False for synchronous raw-text storage that's immediately searchable.
  • No graph relations - DeepMem uses hybrid vector retrieval (vector + BM25
    • time-decay), so relations is always []. Mem0's graph features aren't replicated.
  • reset differs - Mem0's is account-wide; DeepMem's is per-user_id with a confirm guard.

Pricing

DeepMem Cloud is 10x cheaper than Mem0 at every paid tier - the same shape of plans, a tenth of the price.

TierDeepMemMem0 cloud
HobbyFreeFree
Starter$1.9/mo$19/mo
Growth$7.9/mo$79/mo
Professional$24.9/mo$249/mo

Self-host instead and it's $0 - you pay only your own LLM/embedding provider (the same LLM cost Mem0 charges on top of its plan price), with no memory-service markup. Batched distillation also cuts LLM calls ~80%, so even your provider bill is smaller than per-message extractors.

Plans and limits: deepmem.dev · mem0.ai.

Benchmarks

No cherry-picked headline. The scripts and workload ship in /benchmarks - run them yourself. Here's what we measured and the exact config that produced it:

MetricDeepMem self-hosted ¹DeepMem cloudMem0 cloud
Search p5073 ms643 ms653 ms
Search p9586 ms811 ms710 ms
Search hits (40 queries)-19584
Add p50 (raw store)899 ms ²792 ms695 ms ³

¹ BGE-M3 on a GTX 1070 GPU (2016-era), local file Qdrant, infer=False, 100 ops, concurrency 1. ² Dominated by local-file Qdrant I/O - a Qdrant server cuts this sharply. ³ Mem0 has no raw-store mode; add always runs LLM extraction, so this row isn't apples-to-apples.

  • Self-hosted is where intrinsic latency lives - no internet RTT, your embedder, your Qdrant. 73 ms p50 search on an old consumer GPU.
  • DeepMem cloud beats Mem0 cloud on search p50 (643 ms vs 653 ms) and returns ~2.3x more candidates per search (195 vs 84 hits across 40 queries).
  • Cloud latency is RTT-dominated - both cloud columns were measured through a proxy from mainland China; run-to-run jitter is ~±10%. Run /benchmarks from a low-RTT location for your own numbers.

Why DeepMem

Agent frameworks keep re-discovering that they need persistent, retrievable memory. The hosted options bill per call and send your data to someone else's cloud. DeepMem is the self-hostable alternative: the same Mem0-shaped API you can drop in, but it runs on your box, with your embedder, your LLM key, and your Qdrant - and the code is right here to verify it.

How does DeepMem compare to other Mem0 alternatives? Most are hosted-only or layer memory on top of someone else's vector DB. DeepMem combines three things at once: it's self-hostable (your data stays on your box - $0 beyond your own LLM key), MCP-native (Claude Desktop / Cursor read and write memories directly as tools), and fully open-source - and the managed cloud runs the exact same engine, so cloud and self-host are one API, not two products.

Without DeepMemWith DeepMem
Re-explain who you are and what you're working on every sessionThe agent recalls identity, projects, and preferences automatically
Lose debugging and research context between sessionsPast root causes, dead ends, and findings are recalled, so work isn't repeated
Manually restate preferences every sessionPreferences persist across sessions, agents, and projects
Hosted memory services that bill per call and hold your dataSelf-host on your infra, or use the cloud - your call, same API

What it is (honestly)

  • Hybrid retrieval, not a knowledge graph. Search fuses vector similarity, BM25 keyword match, entity boost, and time-decay scoring. There is no temporal graph layer; if that's what you need, look at Zep.
  • Stores preferences, not code dumps. Large fenced code blocks are stripped before LLM extraction, so the store fills with durable user/project facts instead of pasted implementations.
  • BYOK, multi-provider. Bring your own LLM (OpenAI / Anthropic / any OpenAI-compatible endpoint) and embedding (BGE-M3 / Google / OpenAI-compatible).
  • MCP-native. Ships an MCP server so Claude Desktop / Cursor can read and write memories directly.

Quick start

Three ways to run. All speak the same Mem0-compatible API.

1. Cloud (zero ops)

bash
export DEEPMEM_API_KEY=dm_live_...      # from https://deepmem.devcurl https://deepmem.dev/v1/memories \  -H "Authorization: Bearer $DEEPMEM_API_KEY" -H "Content-Type: application/json" \  -d '{"messages":[{"role":"user","content":"I am Pat, I live in Lisbon."}],"user_id":"pat","infer":false}'curl https://deepmem.dev/v1/memories/search \  -H "Authorization: Bearer $DEEPMEM_API_KEY" -H "Content-Type: application/json" \  -d '{"query":"Where does Pat live?","user_id":"pat"}'

2. Docker (one command)

bash
cp .env.example .env          # add an LLM keydocker compose up --build     # DeepMem (HTTP :8000 + MCP :8001) + Qdrant sidecarcurl http://localhost:8000/health

Or pull the published image:

bash
docker pull langdeepmem/deepmem:latestdocker run -p 8000:8000 -p 8001:8001 -e DEEPSEEK_API_KEY=sk-... langdeepmem/deepmem:latest

The image exposes :8000 (HTTP) and :8001 (MCP). The Dockerfile and docker-compose.yml cover the GPU variant (CUDA torch + BGE_DEVICE=cuda) and BGE-M3 model-download options (HF mirror, proxy, or local mount).

3. From source

bash
git clone https://github.com/deepmemteam/deepmem.git && cd deepmempip install -r requirements.txtcp .env.example .env          # add an LLM key + embedder configpython server/start.py        # HTTP :8000 + MCP :8001

Write and search in three lines:

python
import httpxhttpx.post("http://localhost:8000/v1/memories",    json={"messages":[{"role":"user","content":"I'm Pat, I live in Lisbon."}],          "user_id":"pat"})print(httpx.post("http://localhost:8000/v1/memories/search",    json={"query":"Where does Pat live?","user_id":"pat"}).json()["results"])

user_id is optional (defaults to "default"); send different user_ids to isolate end-users. infer: false stores raw text immediately (test-friendly); the default infer: true queues for LLM fact extraction.

Feature highlights

Multi-provider by config, not code. Both layers switch on env vars:

LayerOptionsSelector
LLM (fact extraction)OpenAI · Anthropic (native SDK) · any OpenAI-compatible (DeepSeek / vLLM / Ollama / Groq / LM Studio)LLM_PROVIDER + LLM_API_KEY / ANTHROPIC_API_KEY / DEEPSEEK_API_KEY
EmbeddingsBGE-M3 (local, GPU/CPU) · Google Gemini · any OpenAI-compatibleEMBEDDING_PROVIDER + BGE_M3_PATH / GOOGLE_API_KEY / OPENAI_API_KEY

BGE_DEVICE=auto|cpu|cuda picks GPU when available, else CPU (force cpu on small-VRAM cards to avoid multi-process contention). BYOK overrides the LLM per-request.

Hybrid retrieval. Vector similarity + BM25 keyword + entity boost + time-decay, fused into one score. Over-fetch, re-rank, return.

Async batched distillation. Writes queue behind a silence window and are extracted in batches - ~80% fewer LLM calls than per-message extraction.

Semantic cache. Repeat adds/searches hit a similarity-gated cache and return cached facts without re-embedding or re-querying Qdrant.

Stores preferences, not code. extraction_filter strips large fenced code blocks before LLM extraction, so the store fills with durable facts, not pasted implementations.

MCP server. deepmem_write / deepmem_search / deepmem_delete tools for Claude Desktop, Cursor, and any MCP client.

GDPR. Soft-delete with retention window, hard-delete reset, SHA-256 id masking in logs, export/import for portability.

API

MethodPathDescription
POST/v1/memoriesWrite messages; LLM-extract facts (infer=false stores raw)
POST/v1/memories/searchSemantic search (vector + BM25 + entity + time-decay)
GET/v1/memoriesList all for a user_id (paginated)
GET/v1/memories/{id}Get one by ID
PUT/v1/memories/{id}Update one memory's text
DELETE/v1/memories/{id}Soft-delete one
DELETE/v1/memoriesSoft-delete all for a user_id (GDPR)
GET/v1/memories/{id}/historyADD/UPDATE/DELETE audit log
POST/v1/resetHard-delete all + history (needs confirm_user_id)
GET/v1/export · POST /v1/importPortable JSON export / import
GET/health · /readyLiveness / readiness probes

agent_id / run_id optionally scope writes/reads (mirrors Mem0's three-level isolation: user -> agent -> run). Interactive docs at /docs.

MCP integration

The cloud exposes a remote MCP endpoint (streamable HTTP):

URL:    https://deepmem.dev/mcpAuth:   Authorization: Bearer dm_live_...   (your deepmem.dev API key)Tools:  deepmem_write / deepmem_search

Works with Claude Code, Claude Desktop, Cursor, and any MCP-compatible client.

Claude Code - one command:

bash
claude mcp add --transport http deepmem https://deepmem.dev/mcp \  --header "Authorization: Bearer dm_live_..."

Or install the plugin (bundles a /deepmem:setup command that guides API-key configuration):

/plugin marketplace add deepmemteam/deepmem-claude-plugin/plugin install deepmem@deepmem

Cursor → Settings → MCP → Add new MCP server, or edit ~/.cursor/mcp.json (global) / .cursor/mcp.json (per project). Cursor resolves ${env:NAME} variables in url and headers, so the key can live in an environment variable instead of the config file:

json
{  "mcpServers": {    "deepmem": {      "url": "https://deepmem.dev/mcp",      "headers": { "Authorization": "Bearer ${env:DEEPMEM_API_KEY}" }    }  }}

(with DEEPMEM_API_KEY=dm_live_... exported in your shell, or paste the literal key if you prefer). Community MCP listings with one-click "Add to Cursor" live on cursor.directory; official plugins ship in the Cursor Marketplace.

DeepSeek Harness (dsh) - one overlay file, no dsh plugin needed (dsh connects any MCP server through its generic dsh-mcp-client bridge):

sh
export DEEPMEM_API_KEY=dm_live_...dsh web --patch "$PWD/examples/dsh/deepmem.cordis.yml"

See examples/dsh for details and self-hosted variants.

Self-hosted (stdio, bundled server, no key needed in open mode):

json
{  "mcpServers": {    "deepmem": {      "command": "python",      "args": ["server/mcp_server.py"],      "env": { "DEEPMEMORY_BASE_URL": "http://localhost:8000" }    }  }}

This repo ships a .cursor/mcp.json preconfigured for the self-hosted server - open the repo in Cursor and enable it under Settings → MCP.

Architecture

client (HTTP / MCP)  -> FastAPI (:8000)       -> rate-limit middleware (per-IP token bucket on add/search)       -> SemanticCache.check            (return cached facts on similarity hit)       -> AsyncBatchDistiller.enqueue    (POST /v1/memories, infer=true)            ↳ silence-window or max_batch triggers on_batch_ready                ↳ VectorStore.process_batch  (LLM extraction -> Qdrant upsert)       -> VectorStore.search             (vector + BM25 + entity + time-decay)  -> LLM: OpenAI / Anthropic / OpenAI-compatible (fact extraction)  -> BGE-M3 / Gemini / OpenAI-compatible (embeddings)  -> Qdrant (vectors)  +  SQLite (audit history)  -> MCP server (:8001)  deepmem_write / deepmem_search / deepmem_delete

Single Qdrant collection (memories), hard-filtered by user_id payload. TenantValidator NFC-normalizes and enforces a [A-Za-z0-9._:-]{1,256} charset on user_id - never trust the raw request value.

Configuration

Config loads once from env vars (.env, auto-loaded) > config.json > defaults. Key variables:

VariableRequiredDescription
DEEPSEEK_API_KEY / LLM_API_KEY / ANTHROPIC_API_KEYone LLM keyLLM for fact extraction
LLM_PROVIDERnoauto / openai / anthropic / openai_compatible (default auto)
EMBEDDING_PROVIDERnobge-m3 / google / openai (default bge-m3)
BGE_M3_PATHnolocal BGE-M3 dir or HF model id (default BAAI/bge-m3)
BGE_DEVICEnoauto / cpu / cuda (default auto)
QDRANT_URL / QDRANT_API_KEYnoremote Qdrant; omit for local file store
CORS_ORIGINSyescomma-separated allowed origins (no * in prod)
RATE_LIMIT_ADD / RATE_LIMIT_SEARCHnoper-minute limits (default 30 / 60)

Backends auto-switch on env vars - no code changes:

  • QDRANT_URL set -> remote Qdrant; unset -> local file Qdrant under ./data/qdrant.
  • CORS_ORIGINS=* is refused at boot unless DEEPMEMORY_DEBUG=1.

Production (systemd)

bash
systemctl restart deepmem.service     # scripts/start.sh -> uvicorn :8000journalctl -u deepmem -f

For HTTPS, put Caddy or Nginx in front; scripts/start.sh runs under systemd or any process manager.

Benchmarks

Two reproducible scripts in /benchmarks:

  • Cloud vs cloud - DeepMem cloud vs Mem0 cloud. Register keys at deepmem.dev + mem0.ai, then python benchmarks/benchmark_cloud.py.
  • Self-hosted - your DeepMem, your hardware (no key, no external service): python benchmarks/run_benchmark.py.

Both ship a self-contained workload and report P50/P95/P99 + throughput. The numbers at the top of this README were produced with these scripts - rerun them and read your own percentiles.

FAQ

Do I need the cloud? No. The open-source server is fully functional on its own. The cloud (deepmem.dev) is the zero-ops option - same API.

Does it work offline? Retrieval and raw-store (infer=false) work with no network. LLM fact extraction (infer=true) needs an LLM key - or run a local OpenAI-compatible model (Ollama / vLLM / LM Studio) and point LLM_BASE_URL at it.

Where is my data? In your Qdrant (local file or server) + a SQLite audit log. Nothing leaves your machine except the LLM/embedding calls you configure.

Multi-tenant? Yes - single Qdrant collection hard-filtered by user_id. agent_id / run_id add agent and session scope.

Is it production-ready? Used in production under systemd with a remote Qdrant. Local file Qdrant is fine for dev/single-worker; use a Qdrant server for multi-worker or high-throughput.

Development

bash
pip install -r requirements.txtDEEPMEMORY_DEBUG=1 python -m uvicorn server.main:app --reload --host 0.0.0.0 --port 8000pytest tests/ -x -v

License

MIT.

来源:README.md,提交 d63016a

工具

0
SourceWeft 尚未读取此服务器的工具。

版本历史

1
  1. v0.1.0最新Sep 16, 2026

评分

已满足适用检查项的 85%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分