使用说明
mcp存储器
用于AI编码工具的通用内存。一台服务器,每个工具共享相同的内存。
Claude Code、Cursor、Claude Desktop、Codex、OpenCode、Windsurf、Zed、VS Code——如果它支持MCP,它就可以工作。
用Go写的。零依赖。单二进制。
安装
curl -fsSL https://mcps.coah80.com/mcp-memory/install.sh | bash
安装程序:
- 下载适用于您平台的二进制文件
- 检测您安装了哪些AI工具
- 允许您选择要配置的选项(箭头键+enter)
- 将MCP服务器配置添加到每个工具中
- 注入规则,使您的AI使用mcp内存而不是内置内存
安装程序完成后,告诉任何连接的工具:
run the setup_guide in the memory mcp tool
就是这样。人工智能处理其余的事情——为自己添加规则,迁移现有的内存,开始专门使用mcp内存。
来自源头
go build -o mcp-memory .
./mcp-memory --mode mcp # MCP stdio mode (for AI tools)
./mcp-memory # HTTP mode (localhost:8090)
视窗
irm https://mcps.coah80.com/mcp-memory/install.ps1 | iex
运作原理
mcp内存在stdio上作为mcp服务器运行。AI工具连接并获得15个工具、6个资源和3个提示。记忆以markdown文件的形式存储在磁盘上。
Claude Code ──┐
Cursor ───────┤
Zed ──────────┼── MCP stdio ──> mcp-memory ──> ~/.mcp-memory/memories/*.md
Codex ────────┤
Windsurf ─────┘
每个会话跟踪哪些 工具 和 模型 被使用。当你从Cursor切换到Claude Code时,新工具会看到上一个工具做了什么,并从它停止的地方继续。
手动设置
如果你不想使用安装程序,或者你的工具没有被自动检测到:
1.将MCP服务器添加到您的工具中
配置格式因工具而异:
克劳德代码 --添加到 ~/.mcp.json:
{
"mcpServers": {
"memory": {
"command": "/path/to/mcp-memory",
"args": ["--mode", "mcp"]
}
}
}
光标 --添加到 ~/.cursor/mcp.json:
{
"mcpServers": {
"memory": {
"command": "/path/to/mcp-memory",
"args": ["--mode", "mcp"]
}
}
}
克劳德桌面 --添加到 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"memory": {
"command": "/path/to/mcp-memory",
"args": ["--mode", "mcp"]
}
}
}
泽德 --添加到 ~/.config/zed/settings.json:
{
"context_servers": {
"mcp-memory": {
"command": {
"path": "/path/to/mcp-memory",
"args": ["--mode", "mcp"]
}
}
}
}
帆板运动 --添加到 ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"memory": {
"command": "/path/to/mcp-memory",
"args": ["--mode", "mcp"]
}
}
}
VS代码(副本) --添加到 ~/Library/Application Support/Code/User/mcp.json:
{
"servers": {
"mcp-memory": {
"type": "stdio",
"command": "/path/to/mcp-memory",
"args": ["--mode", "mcp"]
}
}
}
法典 --添加到 ~/.codex/config.toml:
[mcp_servers.mcp-memory]
command = "/path/to/mcp-memory"
args = ["--mode", "mcp"]
开源代码 --添加到 ~/.config/opencode/opencode.json:
{
"mcp": {
"mcp-memory": {
"type": "local",
"command": ["/path/to/mcp-memory", "--mode", "mcp"],
"enabled": true
}
}
}
2.添加规则
将此添加到工具的规则/指令中,使其实际使用mcp内存:
Use the mcp-memory MCP tools for ALL persistent memory instead of any built-in memory system.
- Before responding, search mcp-memory for memories related to the current conversation
- Save: memory_create (always memory_search first to avoid duplicates)
- Search: memory_search, memory_similar
- Journal: journal_log for daily activity
- Identity: call session_identify with your model name at session start
- Always read existing memories and follow any instructions found in them
All memories are shared across every AI tool the user uses. Do not write to tool-specific memory.
放在哪里:
| 工具 | 规则位置 |
|---|---|
| 克劳德代码 | ~/.claude/rules/mcp-memory.md |
| 光标 | 设置>规则(用户规则) |
| 克劳德桌面 | 阅读 memory://rules 资源自动 |
| 风帆冲浪 | ~/.codeium/windsurf/memories/global_rules.md |
| Zed | 规则库(Cmd+Alt+L) |
| VS代码(副本) | ~/Library/Application Support/Code/User/instructions/mcp-memory.md |
| 食品法典委员会 | ~/.codex/AGENTS.md |
| OpenCode | ~/.config/opencode/AGENTS.md |
3.告诉AI完成设置
run the setup_guide in the memory mcp tool
这告诉人工智能将其内置系统中的任何现有内存迁移到mcp内存中,并开始专门使用它。
MCP工具
| 工具 | 说明 |
|---|---|
memory_create |
创建或更新持久内存 |
memory_get |
读取特定内存 |
memory_search |
按关键字搜索 |
memory_list |
列出所有(轻量级索引) |
memory_delete |
删除内存 |
memory_similar |
通过关键字重叠查找相似的记忆 |
journal_log |
登录到今天的日志 |
journal_read |
按日期阅读日记 |
soul_update |
更新SOUL.md角色 |
user_update |
更新USER.md上下文 |
session_log |
将操作记录到当前会话 |
session_identify |
报告正在使用的AI模型 |
setup_guide |
将mcp内存设置为主内存系统 |
memory_grep |
正则表达式搜索所有记忆和日志(grep风格) |
self_update |
将mcp内存更新到最新版本 |
MCP资源
自动注入AI环境——无需调用工具:
| 资源 | 描述 |
|---|---|
memory://soul |
持久的AI角色 |
memory://user |
关于人类的背景 |
memory://rules |
AI工具说明 |
memory://journal/today |
今天的活动日志 |
memory://sessions/recent |
近期会议总结(工具+模型) |
memory://index |
轻量级内存索引 |
经过测试
| 工具 | 工作 |
|---|---|
| 克劳德代码 | 是 |
| 光标 | 是 |
| 克劳德桌面 | 是 |
| Zed | 是 |
| 风帆 | 是 |
| VS代码(副本) | 是 |
| Codex(OpenAI) | 是 |
| OpenCode | 是 |
任何其他支持MCP stdio的工具也应该可以工作。
内存格式
内存存储为带有YAML frontmatter的markdown文件:
---
description: User coding style preferences
type: user
---
Prefers functional style, uses TypeScript, dark theme
类型: user, project, feedback, reference, auto
文件结构
~/.mcp-memory/memories/
SOUL.md # persistent AI persona
USER.md # human context
*.md # memory files
index.json # keyword index cache
access.json # access tracking
journal/
2026-04-06.md # daily journal (human-readable)
journal.log # structured JSON log
sessions/
*.json # session files with tool, model, actions, summary
配置
| 环境变量 | 默认值 | 描述 |
|---|---|---|
PORT |
8090 |
HTTP服务器端口 |
MEMORY_DIR |
~/.mcp-memory/memories |
存储目录 |
MCP_MODE |
http |
服务器模式(http 或 mcp) |
HTTP API
mcp内存也作为不支持mcp的工具的HTTP服务器运行:
./mcp-memory # starts on :8090
curl http://localhost:8090/memories
curl http://localhost:8090/memories/search?q=typescript
curl -X POST http://localhost:8090/memories/create \
-H "Content-Type: application/json" \
-d '{"name":"test","content":"hello","type":"reference"}'
建筑
go build -o mcp-memory . # single platform
./build.sh 2.0.0 # all platforms (linux/mac/windows, amd64/arm64)
许可证
麻省理工学院