Skip to main content
Glama

mcp-mem0

面向 mem0(自托管 / 开源)的 MCP 服务器,由 Qdrant 提供支持。每个请求都针对一个 以 HTTP 标头命名的 Qdrant 集合,因此发送相同名称的客户端可以共享记忆,而不同的名称则会相互隔离。

工具

工具

用途

add_memory

存储记忆(LLM 事实提取,或使用 infer=false 时存储原始内容)

search_memory

在请求的集合内进行语义搜索

update_memory

按 id 替换记忆的内容

delete_memory

按 id 删除记忆

get_memory

按 id 获取一条记忆

list_memories

列出某作用域下的记忆

memory_history

记忆的变更历史

delete_all_memories

删除某作用域下的所有记忆

Related MCP server: mem0-open-mcp

集合路由的工作原理

  • 集合名称 从 HTTP 请求的标头(默认 X-Collection)中读取,并映射到 Qdrant 集合 mem0_<name>(前缀可配置;将其留空则以原样使用该值)。标头值会针对 ^[A-Za-z0-9_-]{1,64}$ 进行验证。

  • 共享: 发送相同集合名称的任何客户端都共享相同的记忆。不同的名称相互隔离。

  • 每个集合都会构建并缓存一个 AsyncMemory 实例。

  • 集合 仅由标头决定user_id / agent_id / run_id 绝不会影响使用哪个集合;它们只是在 集合内部 进行收窄,并且是可选的。不带并集合进行搜索 / 列出将覆盖整个集合。

  • add_memory 仍然需要至少一个 id 才能存储(mem0 的要求);当调用方在写入时省略全部三个时,会应用默认的 user_idMEM0_DEFAULT_USER_ID)。

快速开始

# 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

健康检查:curl localhost:8080/health

Docker

Dockerfile 是多阶段构建,有两个目标:runtime(服务器)和 test(测试套件)。

使用 docker compose(推荐)

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

在 compose 网络内部,服务器通过 QDRANT_HOST=qdrant(自动设置)访问 Qdrant;测试通过 MCP_URL=http://server:8080/mcp 访问服务器。

使用纯 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

验证

# 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

配置

所有设置都来自环境变量 / .env — 请参阅 .env.example。 关键项:MEM0_COLLECTION_HEADERMEM0_COLLECTION_PREFIXQDRANT_HOST/QDRANT_PORT(或 QDRANT_URL+QDRANT_API_KEY)、MEM0_EMBEDDING_DIMS(必须与嵌入器匹配),以及 MEM0_LLM_* / MEM0_EMBEDDER_* 提供商配置块(openai / ollama / …)。

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • An MCP memory server. One memory your agents share — across models, devices and apps.

  • Cloud-hosted MCP server for durable AI memory

  • Shared, governed long-term memory for AI agents across tools and sessions via MCP and REST.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/schwarzesonne13/mem0-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server