Agent Memory
用于 Agent Memory 的文件系统 MCP
MCP 服务器,将 agent-memory-daemon 暴露给任何兼容 MCP 的客户端 —— Kiro (CLI & IDE)、Claude Desktop、Cursor 等。
守护进程负责思考(整合 + 提取);此服务器是一个轻量级的文件系统桥梁,以便智能体可以通过模型上下文协议(Model Context Protocol)读取、追加和搜索记忆。
它是如何协同工作的
┌──────────────┐ MCP/stdio ┌────────────────────┐ filesystem ┌────────────────────────┐
│ Kiro / Claude│ ◄───────────────► │ mcp-server-memory │ ◄─────────────────► │ agent-memory-daemon │
│ / Cursor │ │ (this package) │ ~/.agent-memory/ │ (runs in background) │
└──────────────┘ └────────────────────┘ └────────────────────────┘MCP 服务器读取/写入
~/.agent-memory/下的文件守护进程监视同一目录并运行整合 + 提取任务
它们从不直接通信 —— 文件系统就是契约
Related MCP server: Recall
暴露的工具
工具 | 用途 |
| 将 |
| 写入会话摘要,供守护进程稍后从中提取记忆 |
| 在记忆文件中进行子字符串搜索 |
| 检查整合守护进程是否正在运行(仅限 macOS LaunchAgent) |
安装
npm install -g mcp-agent-memory快速入门(交互式向导)
设置所有内容(记忆目录、守护进程、客户端配置、日志和 LaunchAgent)的最快方法是使用设置向导:
mcp-agent-memory --setup它会询问六个问题:
记忆目录 ——
.agent-memory/所在的位置(默认为~/.agent-memory)安装整合守护进程? —— 如果仅使用 MCP 模式,请回答“no”(智能体可以读取/写入/搜索记忆,但没有自动整合功能)
LLM 后端 ——
bedrock、openai或kiro(如果您拒绝了守护进程,则跳过此项)整合设置 ——
min_hours、min_sessions、提取间隔、最大字符数运行模式 ——
standalone(手动启动)或launchagent(登录时自动启动,仅限 macOS)日志目录 + TTL —— 日志存放位置,以及保留天数(
0= 永久保留)客户端注册 —— 在 Kiro、Claude Desktop 和/或 Cursor 配置中自动注册 MCP 服务器(现有的 MCP 条目会被保留)
当您选择 kiro 后端时,向导还会将一个精简的智能体复制到 ~/.kiro/agents/memconsolidate.json,这可以将 Token 使用量减少约 7 倍(请参阅 Kiro 后端)。
当您选择 launchagent 时,向导会检查是否安装了 agent-memory-daemon(如果未安装,会提示您运行 npm install -g),然后注册并启动 plist。
CLI 参考
mcp-agent-memory # run as an MCP server (normal mode — clients spawn it)
mcp-agent-memory --setup # first-time interactive setup
mcp-agent-memory --configure # re-run most steps; can add/remove the daemon later
mcp-agent-memory --remove # interactive uninstall (backup memory, clean configs)
# macOS LaunchAgent control:
mcp-agent-memory --daemon status # is the daemon running?
mcp-agent-memory --daemon start # load and start
mcp-agent-memory --daemon stop # unload (keeps the plist)
mcp-agent-memory --daemon restart # stop + start
mcp-agent-memory --daemon remove # unload and delete the plist--remove 会保留客户端 MCP 配置中的其他条目 —— 仅删除 memory 键。默认情况下,它会将 ~/.agent-memory/ 备份到带时间戳的 .bak-* 目录中,以便您可以恢复已整合的记忆。
手动安装
如果您想跳过向导,可以按照以下步骤手动操作。
安装守护进程(可选)
MCP 服务器可以独立工作 —— 它只是读取和写入 ~/.agent-memory/ 下的文件。记忆会持久保存,但在您添加守护进程之前,它们不会被整合或从会话中提取。
npm install -g agent-memory-daemon
# copy the example config
mkdir -p ~/.agent-memory
cp examples/memconsolidate.toml ~/.agent-memory/memconsolidate.toml
# start the daemon
agent-memory-daemon start ~/.agent-memory/memconsolidate.toml请参阅 examples/memconsolidate.toml 获取一个现成的配置,该配置符合此 MCP 服务器预期的目录布局。
在登录时运行守护进程(macOS)
与其手动启动守护进程,不如将其注册为 LaunchAgent:
./scripts/daemon.sh start # install plist, load it, start at login
./scripts/daemon.sh status # check if it's running
./scripts/daemon.sh stop # unload (keeps the plist)
./scripts/daemon.sh remove # unload and delete the plist将自定义配置路径作为第二个参数传递:./scripts/daemon.sh start /path/to/config.toml。日志将存放在 ~/.agent-memory/logs/daemon.{out,err}.log 中。remove 不会触动您的配置和记忆文件。
使用 Kiro 作为 LLM 后端
如果您有 Kiro 积分,可以通过 kiro-cli 运行守护进程,而无需支付 Bedrock 或 OpenAI API 调用费用。这需要 agent-memory-daemon ≥ 2.7(分支 feat/kiro-backend),该版本增加了 kiro 后端。
[llm_backend]
name = "kiro"
# optional overrides:
# binary = "/custom/path/to/kiro-cli"
# agent = "memconsolidate" # set to "" to use Kiro's default session context (not recommended)
# model = "claude-sonnet-4-20250514"
# timeoutMs = 300000使用精简智能体可将 Token 使用量减少约 7 倍。 默认情况下,每次 kiro-cli chat 调用都会加载 Kiro 的完整系统提示词以及全局配置中的每个 MCP 工具架构 —— 每次调用大约会额外消耗 12–18K 输入 Token。创建一个跳过所有这些内容的最小化智能体:
cp examples/kiro-agent-memconsolidate.json ~/.kiro/agents/memconsolidate.jsonKiro 后端会自动传递 --agent memconsolidate,因此无需进一步配置。在简单的提示词上进行测量:使用精简智能体为 0.01 积分,而默认情况下为 0.07 积分(输出质量相同)。
请参阅 examples/kiro-agent-memconsolidate.json —— 该智能体具有 mcpServers: {}、tools: [] 和 useLegacyMcpJson: false,因此它不会从您的全局 Kiro 配置中继承任何内容。
手动配置客户端
--setup和--configure向导会为您处理这些操作。本节适用于想要手动连接的用户。
Kiro (CLI 和 IDE)
编辑 ~/.kiro/settings/mcp.json:
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "mcp-agent-memory"],
"env": {
"MEMORY_DIRECTORY": "~/.agent-memory/memory",
"SESSION_DIRECTORY": "~/.agent-memory/sessions"
},
"disabled": false,
"timeout": 30000
}
}
}然后询问 Kiro:“读取我的记忆索引。”或“记住这一点:我更喜欢 pnpm 而不是 npm。”
Claude Desktop
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) 或 %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "mcp-agent-memory"],
"env": {
"MEMORY_DIRECTORY": "~/.agent-memory/memory",
"SESSION_DIRECTORY": "~/.agent-memory/sessions"
}
}
}
}重启 Claude Desktop。memory_* 工具将会出现。
Cursor
使用相同的服务器块添加到 ~/.cursor/mcp.json 中。
环境变量
变量 | 默认值 | 描述 |
|
| 守护进程存储已整合记忆文件的位置 |
|
| 智能体编写的会话摘要存放的位置 |
两个路径都必须与您的 agent-memory-daemon 配置所使用的路径匹配。
推荐的智能体提示词
告诉您的智能体在对话开始时调用 memory_read,在结束时调用 memory_append_session。Kiro 的示例引导规则 (~/.kiro/steering/memory.md):
At the start of every session, call memory_read (no arguments) to load my memory
index. Only pass `topics` when the task genuinely needs the full content of a
specific topic file.
When you learn something durable about me, my projects, or my preferences, call
memory_append_session with a concise markdown summary. Target 300-800 tokens,
use structured headers and bullets (not prose), and focus on durable findings
and decisions — not play-by-play. Verbose summaries cost more during the
daemon's consolidation pass.Token 使用技巧
这三个工具中的每一个都有不同的成本概况。以下几种做法可以降低推理 + 整合的账单:
不带参数的
memory_read仅返回MEMORY.md索引(通常 <1 KB)。除非需要完整内容,否则请优先使用此方式,而不是topics。memory_search基于子字符串,每个文件返回 ≤3 个匹配行 —— 比加载整个主题文件更便宜。memory_append_session在调用时无需成本,但每个会话在整合期间都会由守护进程的 LLM 进行处理。请保持摘要简洁且结构化。定期整合或修剪旧的主题文件。运行
mcp-agent-memory --configure—— 如果您的记忆目录超过 25 个文件或 200 KB,它现在会发出警告。提取后的会话修剪由守护进程处理,而不是由 MCP 服务器处理。请参阅
agent-memory-daemon的配置,了解在处理后归档或删除会话的选项(防止守护进程永远重新扫描旧会话)。
许可证
MIT
Available Tools
4 toolsmemory_append_sessionA
Append a session summary to the sessions directory. The daemon will later extract durable memories from it. Call this at the end of meaningful exchanges. Keep summaries focused on durable findings and decisions (target 300-800 tokens), not play-by-play — longer summaries cost more during consolidation.
Inputs: content (required), source.
memory_daemon_statusA
Check whether the memory consolidation daemon is running. Reports if the daemon is not installed or not available on this platform.
Inputs: no named parameters.
memory_readA
Read the agent memory index (MEMORY.md) and optionally specific topic files. Call with no arguments to load only the lightweight index (cheap). Pass topics only when you need the full content of a specific topic file.
Inputs: topics.
memory_searchA
Search memory files for a substring. Use this to recall specific facts without loading everything.
Inputs: query (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool serves a distinct purpose: appending sessions, checking daemon status, reading memory index, and searching. No overlaps or ambiguities.
All tools follow a consistent pattern: 'memory_' prefix followed by a descriptive verb or verb_noun (append_session, daemon_status, read, search). Naming is predictable and clear.
With 4 tools, the surface is concise and well-scoped for a memory management server. Each tool addresses a core operation without redundancy.
The tools cover essential operations (append, read, search, status). Missing update/delete might be a minor gap, but the memory consolidation daemon likely handles lifecycle, making this acceptable.
Maintenance
Related MCP Connectors
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
Hosted memory for AI agents over MCP. One memory shared by all your agents.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
One memory, every AI. A shared, user-owned markdown memory your AI clients read and write over MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides AI agents with persistent memory capabilities through Mem0, allowing them to store, retrieve, and semantically search memories.686MIT

Recallofficial
AlicenseNot gradedqualityDmaintenanceOpen-source MCP memory server for AI agents — persistent, searchable, tiered memory across sessions. Works over stdio (Cursor, Claude Desktop) or HTTP+SSE. MIT licensed.79 PyPI8MIT- AlicenseAqualityBmaintenanceGives your AI persistent memory across conversations. Stores facts automatically, finds them by meaning using hybrid search with query expansion, and organizes everything into topics without manual tagging.291MIT

@memofs/mcp-serverofficial
AlicenseNot gradedqualityAmaintenance@memofs/mcp-server lets AI coding agents (Claude Code, Claude Desktop, Codex, Cursor, opencode, Gemini CLI, GitHub Copilot, Zed, and any other MCP client) securely read and write MemoFS memory through standard Model Context Protocol tools.6MIT