Back to MCP directory
publicPublicdnsLocal runtime

Claude Memory

一个为Claude桌面应用设计的MCP服务器实现,提供持久化记忆功能,包含分层记忆架构、多种记忆类型和语义搜索等特性。

article

README

🚀 Claude 内存 MCP 服务器

该项目实现了一个 MCP(模型上下文协议)服务器,为大型语言模型提供持久内存功能。它专为集成到 Claude 桌面应用程序而设计,能为 Claude 提供标准化方式,以维护对话和会话间的持续内存。

🚀 快速开始

安装

pip install .

Claude 集成

将以下内容添加到 claudia.json

{
    "mcp_server": {
        "host": "localhost",
        "port": 1234,
        "api_key": "your_api_key"
    }
}

运行

python -m mcp.server

运行测试

pytest

✨ 主要特性

  • 分层存储架构:具备短期、长期和存档内存层级。
  • 多种记忆类型:支持对话、知识、实体和反思等记忆类型。
  • 语义搜索:可基于语义相似性检索记忆。
  • 内存巩固:能自动将短期记忆合并到长期记忆。
  • 内存管理:依据重要性进行记忆保留和遗忘。
  • Claude 集成:可直接与 Claude 桌面应用程序集成。
  • MCP 协议支持:兼容模型上下文协议。

🏗️ 架构

MCP 服务器遵循功能性领域基于架构,包含以下组件:

┌─────────────────────────────────────────────────────────┐
│                   Claude Desktop                        │
└───────────────────────────┬─────────────────────────────┘
                            │
┌───────────────────────────▼─────────────────────────────┐
│                     MCP 接口                       │
│  ┌─────────────────┐  ┌─────────────────┐  ┌──────────┐ │
│  │ 工具定义         │  │ 请求处理程序     │  │ 安全性   │ │
│  └─────────────────┘  └─────────────────┘  └──────────┘ │
└───────────────────────────┬─────────────────────────────┘
                            │
┌───────────────────────────▼─────────────────────────────┐
│                内存领域管理器                   │
├─────────────────┬─────────────────┬────────────────────┤
│  连锁记忆域     │  语义记忆域      │  时间记忆域        │
├─────────────────┴─────────────────┴────────────────────┤
│                  持久性记忆域                     │
└─────────────────────────────────────────────────────────┘

🔧 技术细节

此实现基于对当前 LLM 持久记忆技术的全面研究:

  • OS 启发式内存管理:类似于 MemGPT 的分层存储架构。
  • 生物启发式连锁记忆:可进行上下文敏感的记忆检索。
  • 向量嵌入:语义搜索受到向量数据库方法的启发。
  • 自我反思:通过定期回顾进行记忆巩固。

🤝 贡献

欢迎贡献!请随意提交 Pull Request。

📄 许可证

本项目在 MIT 许可证下,详情请参阅 LICENSE 文件。

🙏 致谢

  • 基于对 LLM 优化记忆技术的研究。
  • 实现模型上下文协议以与 Claude 集成。
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client