Skip to main content
Glama

Mem0 MCP 服务器

用于将 AI 助手与 Mem0.ai 的持久内存系统集成的模型上下文协议 (MCP) 服务器。

概述

该服务器提供与 MCP 兼容的工具,允许任何兼容的 AI 助手访问和管理存储在 Mem0 中的持久内存。它充当 AI 模型和 Mem0 内存系统之间的桥梁,使助手能够:

  • 存储和检索记忆

  • 搜索具有语义相似性的记忆

  • 管理不同类型的记忆(情景记忆、语义记忆、程序记忆)

  • 利用短期记忆来了解对话内容

  • 应用选择性记忆模式

  • 根据记忆创建知识图谱

Related MCP server: RL-MCP

项目结构

项目代码位于src/mcp_mem0_general/目录内。

入门(无需安装!)

该服务器可以使用uvx直接从 GitHub 运行,而无需克隆存储库或在本地安装。

运行服务器

确保已安装uvpipx install uvbrew install uv )。

您可以直接在终端中测试服务器:

# Make sure MEM0_API_KEY is set in your environment export MEM0_API_KEY="your-mem0-api-key-here" # Run the server using uvx uvx git+https://github.com/ryaker/mcp-mem0-general.git mcp-mem0-general

服务器应该启动并记录其初始化步骤。

在 Cursor 或 Claude Desktop 中设置

  1. **查找uvx路径:**像 Claude Desktop 这样的 GUI 应用程序通常不使用与终端相同的PATH 。在终端中运行以下命令,查找uvx可执行文件的完整路径:

    which uvx

    复制输出路径(例如, /Users/yourname/.local/bin/uvx/opt/homebrew/bin/uvx )。

  2. **配置 MCP:**将以下配置添加到您的 MCP 配置文件中,为您在步骤 1 中找到的实际路径。

    • **游标:**在~/.cursor/mcp.json中添加/更新:

    • **Claude Desktop:**在您的设置中添加/更新类似的配置。

    "mem0-memory-general": { "command": "/full/path/to/uvx", # <-- IMPORTANT: Use the full path from 'which uvx' "args": [ "git+https://github.com/ryaker/mcp-mem0-general.git", "mcp-mem0-general" ], "env": { "MEM0_API_KEY": "your-mem0-api-key-here" } }
  3. **重启:**重启 Cursor 或 Claude Desktop 以应用更改。服务器现在应该可以在应用程序中正确启动。

关于mem0ai[neo4j]警告的说明

您可能会看到类似这样的warning: The package mem0ai==0.1.96 does not have an extra named neo4j

  • **如果使用托管的 Mem0.ai 平台:**可以放心忽略此警告。必要的图形处理在 Mem0 平台的服务器端进行。

  • **如果使用 Neo4j 自托管 Mem0:**此警告表示特定的mem0ai版本未自动安装 Neo4j 相关的 Python 库( langchain-neo4jneo4j )。如果您使用图表功能,则需要确保在自托管环境中手动安装这些库。

将使用指南加载到内存中(推荐)

为了方便您的 AI 助手引用服务器的功能,您可以将USAGE_GUIDE.md内容加载到 Mem0 中。请按照以下步骤操作:

**先决条件:**确保 Mem0 MCP 服务器正在运行并在您的 AI 助手(Claude/Cursor)中正确配置,如上面“入门”部分所述。

  1. **复制指南内容:**打开USAGE_GUIDE.md文件。选择并复制其全部文本内容。

  2. **请求助手添加记忆:**前往你的 AI 助手 (Claude/Cursor),使用类似如下的提示,将你复制的指南内容粘贴到指定位置。请确保使用与你一致的user_id (例如“default_user”)。

请记住以下 Mem0 MCP 服务器的使用指南。使用 user_id 为“default_user”,并添加元数据{"title": "Mem0 MCP Usage Guide", "source": "README Instruction"}

[--- 将整个 USAGE_GUIDE.md 内容粘贴到这里 ---]

The assistant should call the `mem0_add_memory` tool. 3. **Find the Memory ID:** Once the assistant confirms the memory is added, ask it to find the specific ID for that memory: ``` Please search my memories for user_id "default_user" using the query "Mem0 MCP Usage Guide" and tell me the exact memory ID of that guide memory you just added.
The assistant should use the `mem0_search_memory` tool and provide you with an ID string (e.g., `76100ac4-896e-488b-90ad-036c0dfaaa80`). **Note down this ID!**

4.**稍后检索指南:**现在您有了 ID,您可以随时使用如下提示快速要求您的助手调用完整指南:

``` First execute Retrieve memory ID *your-guide-id-here* using mem0_get_memory_by_id. Then return control to me. ``` (Replace *`your-guide-id-here`* with the actual ID you noted down in step 3).

内存类型

该服务器支持按持续时间和功能组织的不同内存类型:

短期记忆

  • 对话记忆:回忆最近的信息交流

  • 工作记忆:被积极使用的临时信息

  • 注意力记忆:当前关注的信息

长期记忆

  • 情景记忆:具体事件和经历

  • 语义记忆:事实、概念和知识

  • 程序记忆:技能和操作方法信息

高级功能

  • 自定义类别:定义和管理您自己的内存类别

  • 记忆指令:设定如何处理记忆的指导方针

  • 图形关系:访问实体之间的知识图关系

  • 选择性记忆:存储之前使用包含/排除模式过滤文本

  • 反馈机制:提供记忆质量的反馈

用法

系统中的所有存储器都使用“default_user”作为默认的user_id。

有关详细的使用示例,请参阅USAGE_GUIDE.md

文档

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

致谢

-
security - not tested
A
license - permissive license
-
quality - not tested

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/ryaker/mcp-mem0-general'

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