本项目借助广泛研究的优化记忆技术,为大型语言模型赋予持久内存功能,并且专门与Claude桌面应用程序实现了集成,为Claude的使用提供了更强大的支持。
git clone [repository-url]
cd claude-memory-mcp-server
pip install -r requirements.txt
python mcp/server.py
在Claude Desktop的配置文件中添加以下内容:
{
"mcp_server": {
"host": "localhost",
"port": 5000,
"memory_file_path": "path/to/memory.json"
}
}
pytest
git clone [repository-url]
cd claude-memory-mcp-server
pip install -r requirements.txt
python mcp/server.py
python mcp/server.py
query_memoryupdate_memorydelete_memory_entry内存数据以JSON格式存储,示例如下:
{
"metadata": {
"version": "1.0.0",
"timestamp": "2023-10-26T12:00:00Z"
},
"memory_entries": [
{
"id": 1,
"content": "今天天气很好,我们去公园散步。",
"context": ["weather", "park"],
"timestamp": "2023-10-26T12:05:00Z"
},
{
"id": 2,
"content": "记得带伞,下午可能下雨。",
"context": ["weather", "umbrella"],
"timestamp": "2023-10-26T12:10:00Z"
}
]
}
claude-memory-mcp-server/
├── mcp/
│ ├── server.py # MCP服务器实现
│ ├── tools.py # MCP工具定义
│ └── handler.py # 请求处理程序
├── security/
│ └── validation.py # 输入验证
└── utils/
├── embeddings.py # 向量嵌入工具
└── schema.py # 架构验证
MCP服务器采用功能域-based架构,包含以下组件:
┌─────────────────────────────────────────────────────────┐
│ Claude 桌面 │
└───────────────────────────┬─────────────────────────────┘
│
┌───────────────────────────▼─────────────────────────────┐
│ MCP 接口 │
│ ┌─────────────────┐ ┌─────────────────┐ ┌──────────┐ │
│ │ 工具定义 │ │ 请求处理程序 │ │ 安全性 │ │
│ └─────────────────┘ └─────────────────┘ └──────────┘ │
└───────────────────────────┬─────────────────────────────┘
│
┌───────────────────────────▼─────────────────────────────┐
│ 内存域管理器 │
├─────────────────┬─────────────────┬────────────────────┤
│ 连篇记忆领域 │ 语义领域 │ 时间领域 │
├─────────────────┴─────────────────┴─────────────────────┤
└ ┓
本实现基于广泛研究的大型语言模型持久记忆技术:
本项目在MIT License下开源,详情请参阅LICENSE文件。
欢迎贡献!请随意提交Pull Request。