mcp-mem0

mcp-mem0

An MCP server for mem0 memory management backed by Qdrant, with per-collection isolation via HTTP headers. Enables storing, searching, updating, and deleting memories through natural language.

Category
访问服务器

README

mcp-mem0

An MCP server for mem0 (self-hosted / open source) backed by Qdrant. Each request targets a Qdrant collection named by an HTTP header, so clients that send the same name share memories and different names stay isolated.

Tools

Tool Purpose
add_memory Store memories (LLM fact-extraction, or raw with infer=false)
search_memory Semantic search within the request's collection
update_memory Replace a memory's content by id
delete_memory Delete a memory by id
get_memory Fetch one memory by id
list_memories List memories for a scope
memory_history Change history of a memory
delete_all_memories Delete all memories for a scope

How collection routing works

  • The collection name is read from an HTTP header (X-Collection by default) and mapped to the Qdrant collection mem0_<name> (prefix configurable; set it empty to use the value verbatim). The header value is validated against ^[A-Za-z0-9_-]{1,64}$.
  • Sharing: any clients that send the same collection name share the same memories. Different names are isolated.
  • One AsyncMemory instance is built and cached per collection.
  • The collection is chosen solely by the header — user_id / agent_id / run_id never affect which collection is used; they only narrow within a collection and are optional. Searching / listing without any of them spans the whole collection.
  • add_memory still needs one id to store (mem0 requirement); a default user_id (MEM0_DEFAULT_USER_ID) is applied when the caller omits all three on a write.

Quick start

# 1. Start Qdrant
docker compose up -d qdrant

# 2. Configure
cp .env.example .env
# edit .env: set OPENAI_API_KEY (or switch to the Ollama block for a key-free setup)

# 3. Run the server (streamable-HTTP on :8080/mcp)
uv run -m mcp_mem0

Health check: curl localhost:8080/health

Docker

The Dockerfile is multi-stage with two targets: runtime (the server) and test (the suite).

With docker compose (recommended)

cp .env.example .env          # set OPENAI_API_KEY (or the Ollama block)

# Qdrant + server together
docker compose up -d --build qdrant server
curl localhost:8080/health

# Run unit tests (no Qdrant / keys needed)
docker compose run --rm tests

# End-to-end smoke against the running server (needs an embedder key)
docker compose run --rm tests python tests/smoke.py

Inside the compose network the server reaches Qdrant at QDRANT_HOST=qdrant (set automatically); tests reach the server at MCP_URL=http://server:8080/mcp.

With plain docker

# Service image
docker build --target runtime -t mcp-mem0 .
docker run --rm -p 8080:8080 --env-file .env -e QDRANT_HOST=host.docker.internal mcp-mem0

# Test image
docker build --target test -t mcp-mem0-test .
docker run --rm mcp-mem0-test            # pytest -q

Verify

# Unit tests (no Qdrant needed)
uv run pytest -q

# End-to-end smoke test (server + Qdrant + embedder must be running)
uv run python tests/smoke.py

# Confirm per-client collections were created
curl localhost:6333/collections

Configuration

All settings come from environment variables / .env — see .env.example. Key ones: MEM0_COLLECTION_HEADER, MEM0_COLLECTION_PREFIX, QDRANT_HOST/QDRANT_PORT (or QDRANT_URL+QDRANT_API_KEY), MEM0_EMBEDDING_DIMS (must match the embedder), and the MEM0_LLM_* / MEM0_EMBEDDER_* provider blocks (openai / ollama / …).

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选