butler-memory-mcp
Provides persistent, versioned, audited long-term memory storage for AI agents using PostgreSQL, with tools to create, revise, archive, search, and manage memory records.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@butler-memory-mcpremember that the client prefers weekly status reports"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
butler-memory-mcp
给你的 AI agent 一份真正属于你的长期记忆。 一个 MCP 服务器,把你明确要求 记住的事实、偏好和项目上下文写入你自己的 PostgreSQL——每次写入带修订历史 与审计证据,检索自动按敏感度过滤。模型不能静默写入;推断出的东西只会变成 等你决定的候选。接任何 MCP 客户端即用。
仓库简介
Layered long-term memory for AI agents as an MCP server — PostgreSQL-backed, versioned, audited. Agents remember only what you explicitly asked.
Butler 分层记忆的 MCP 桥:把 ai-butler-framework 的
MemoryService / LayeredMemoryService 以标准 MCP 工具暴露给任何 MCP 客户端
(DSH、Claude Code、Codex 等),同时提供一个仅限 loopback 的 HTTP API 供
DSH Web 面板(dsh-butler-memory)读取。
DSH agent ──(MCP stdio)──► ai-butler-memory-mcp ──► MemoryService ──► PostgreSQL
DSH web 面板 ──(HTTP 127.0.0.1:8771)──► 同一进程、同一 principalRelated MCP server: memgate
自包含分发(vendored)
本包运行时零依赖 ai-butler-framework:所需的记忆领域代码
(MemoryService/LayeredMemoryService/ORM 模型/数据库与配置辅助)以
vendoring 方式内置于 ai_butler_memory_mcp/vendored/,归属校验、敏感度上限、
revision 乐观锁、审计与证据同事务等语义与上游逐字一致。上游文件清单、
行号区间与漂移检查见 VENDORED.md(scripts/check-vendored.py)。
Schema 迁移仍由 ai-butler-framework 的部署负责(ai-butler-db upgrade);
本包只连接已有数据库,不创建、不修改 schema。
安装
从 PyPI(发布后推荐)
pip install butler-memory-mcp本地开发(源码 checkout)
cd butler-memory-mcp && python3 -m venv .venv
.venv/bin/pip install -e '.[dev]'首次初始化(自举,无需 ai-butler-framework)
全新用户三步即可用:
# 1. 建表(对已迁移的库是安全 no-op,只建缺失表)
ai-butler-memory-mcp initdb
# 2. 创建属主用户与桥设备(token 只显示一次)
ai-butler-memory-mcp admin bootstrap \
--user-name 博士 --device-name dsh-agent --device-kind agent \
--scope memory:read --scope memory:write
# 输出 user_id / device_id / device_token
# 3. 把 user_id / device_id 填进配置配置
把环境配置放进 ~/.config/butler-memory-mcp/.env(DSH 的 stdio 桥会清洗
疑似凭据的环境变量,env 文件是可靠通道):
AI_BUTLER_DATABASE_URL=postgresql+asyncpg://ai_butler:密码@127.0.0.1:5432/ai_butler
AI_BUTLER_MCP_USER_ID=<bootstrap 输出的 user_id>
AI_BUTLER_MCP_DEVICE_ID=<bootstrap 输出的 device_id>与 ai-butler-framework 共用同一数据库的部署无需 initdb/bootstrap:
沿用框架的 ai-butler-db upgrade 迁移和 ai-butler-admin add-device 注册,
把打印的 user_id/device_id 填进上面两个变量即可。
写操作只有在这台设备真实属于该用户时才会被接受——身份与审计不因 MCP 而放松。
运行
ai-butler-memory-mcp # stdio MCP(给 agent 用,DSH 会自动 spawn)
ai-butler-memory-mcp --transport http --port 8771 # 面板 API(0.1.2+ 的 DSH 插件已不需要)暴露的工具(DSH 中为 mcp__butler__memory_*)
工具 | 语义 | 敏感度 |
| 列出/检索记忆(search 自动排除 private/secret) | internal 封顶 |
| 不可变修订历史 | — |
| 显式写入,revision 绑定 | public/internal 封顶 |
| 推断候选,绝不静默入库 | — |
当前边界(v0.1 刻意取舍)
无浏览器式强确认:MCP 写入依赖工具描述约束("仅当用户明确要求")+ 敏感度 封顶,不等于框架 Web 端的 L2 确认卡片。后续可接 DSH
ask-user。仅 loopback:HTTP 面板 API 拒绝非 loopback 绑定;stdio 模式不监听端口。
单用户单设备 principal:多用户映射属后续设计(见 PLAN.md)。
数据 durable 但备份/恢复尚未实现(框架 P9 未完成),发布说明中需如实标注。
测试
.venv/bin/pytest # 离线协议测试;vendored 领域代码与上游逐字一致
.venv/bin/python scripts/check-vendored.py --upstream ../ai-butler-framework # 漂移检查License
Apache License 2.0,与上游 ai-butler-framework 一致。本项目不包含 任何专有模型或素材;发布衍生作品时请保留许可与署名要求。
相关项目
ai-butler-framework— 记忆领域服务的上游实现方(owner/revision/audit 语义的权威来源;本包 vendoring 其记忆领域代码并做漂移检查);dsh-butler-memory — DeepSeek Harness 接入组合包:agent 工具 + Web 记忆面板。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityBmaintenanceA long-term memory MCP server for AI agents that stores memories (facts, decisions, etc.) in a single SQLite database with hybrid search and full edit history, ensuring consistency across sessions.24MIT
- Alicense-qualityAmaintenanceAccess control, conflict resolution, and audit for shared agent memory. Policy-gated memory tools over Postgres + pgvector, exposed via MCP.Apache 2.0
- Alicense-qualityCmaintenanceDurable, inspectable memory for MCP agents. Preserves decisions, preferences, and project knowledge across sessions with full provenance and version history.2Apache 2.0
- AlicenseAqualityCmaintenanceMCP server providing persistent memory for AI agents, enabling them to read, write, and query memories across sessions.9148MIT
Related MCP Connectors
Shared, governed long-term memory for AI agents across tools and sessions via MCP and REST.
Shared long-term memory vault for AI agents with 20 MCP tools.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AndyYang12345/butler-memory-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server