内容
# 代理内存 MCP
用于维护代理内存的独立 MCP 服务器。
内存默认存储在 `~/.agents/memories` 目录下。你可以通过设置 `AGENT_MEMORY_ROOT` 环境变量来使用其他目录。
## 安装
```sh
npx -y @msr0806/agent-memory-mcp
```
## 游标 / 克劳德桌面
```json
{
"mcpServers": {
"agent-memory": {
"command": "npx",
"args": ["-y", "--package=@msr0806/agent-memory-mcp", "agent-memory-mcp"]
}
}
}
```
如果 `npx` 出现 `command not found` 错误,请清除缓存并重试:
```sh
npx clear-npx-cache
npx -y --package=@msr0806/agent-memory-mcp agent-memory-mcp
```
可选的自定义存储路径:
```json
{
"mcpServers": {
"agent-memory": {
"command": "npx",
"args": ["-y", "@msr0806/agent-memory-mcp"],
"env": {
"AGENT_MEMORY_ROOT": "/path/to/memories"
}
}
}
}
```
## 工具
| 工具 | 描述 |
|------|-------------|
| `create_memory` | 创建全局或仓库范围的内存 |
| `read_memory` | 读取一个内存 |
| `read_memories` | 读取全局 + 仓库内存 |
| `update_memory` | 更新描述和/或内容 |
| `delete_memory` | 删除一个内存 |
| `list_memories` | 列出内存元数据 |
### 范围
- **全局** — 在所有仓库中共享(例如编码偏好)
- **仓库** — 限定在仓库名称范围内(例如 `project-gilly`)
### 存储布局
```
~/.agents/memories/
global/
coding-style/MEMORY.md
repos/
project-gilly/
mvp-scope/MEMORY.md
```
## 开发
```sh
git clone https://github.com/MSR806/agent-memory-mcp.git
cd agent-memory-mcp
npm install
npm test
npm run build
npm start
```
## 发布
```sh
npm login
npm publish --access public
```