memory-mcp
memory-mcp
memory-mcp 是一个独立的 MCP 服务器,用于持久化智能体记忆 —— 短期/长期记忆分层、可度量的可靠性以及生命周期维护 —— 以 SQLite(FTS5 + sqlite-vec)为后端,并使用本地 MiniLM 嵌入。无需外部服务,无需 API 密钥。
环境要求
Node.js >= 22
该包随附编译后的 JavaScript,因此运行时无需 TypeScript 工具链。
Related MCP server: localmem-mcp
安装
npm install @jommar/memory-mcp提供两个可执行文件:
命令 | 用途 |
| MCP 服务器(默认为 stdio,通过 |
| 存储维护 CLI( |
快速开始
stdio(默认)
将 MCP 客户端指向服务器可执行文件:
{
"mcpServers": {
"memory": {
"command": "memory-mcp-server"
}
}
}或直接运行:
memory-mcp-server使用 npx 时,请显式指定服务器可执行文件(首次使用时会先安装该包):
npx -y -p @jommar/memory-mcp memory-mcp-serverHTTP(仅限 localhost)
MEMORY_TRANSPORT=http memory-mcp-serverHTTP 端点默认绑定到 127.0.0.1:3000,并在同一端点同时提供新版(2026-07-28)和旧版(2025-11-25)协议修订版的协议,因此任何 MCP 客户端都能连接。服务器无状态——无需会话 ID。
首次运行
存储会在 ~/.memory-mcp/memory.db 自动创建。数据库中的嵌入是离线优先的:除非你主动选择,否则不会下载任何模型。
# opt in to the one-time model download (about 23 MB, MiniLM-L6, q8 quantized)
MEMORY_EMBEDDING_OFFLINE=false memory-mcp-server在模型可用之前,remember 和 recall 仍然可以工作——它们只会退化为关键词搜索。模型就绪后,可使用CLI reindex 回填向量。
配置
所有配置均通过 MEMORY_* 环境变量完成(无配置文件):
变量 | 默认值 | 用途 |
|
| SQLite 数据库文件 |
|
|
|
|
| HTTP绑定主机(仅限 localhost) |
|
| HTTP绑定端口 |
|
| 设为 |
|
| 模型下载尝试的超时时间 |
|
| 已下载模型的缓存位置 |
工具
共注册了十个工具:remember、recall、get、update、forget、list、confirm、contradict、promote、consolidate。 有关输入和行为的完整参考,请参阅 docs/tools.md。
remember 支持 interactive 选择:当发现近似重复的条目时,它可以让客户端选择合并或创建(MRTR),并在客户端不支持交互式功能时优雅降级。
维护CLI
memory-mcp export ./out # write every memory as a markdown frontmatter file
memory-mcp import ./staging # validate, then import (never overwrites existing keys)
memory-mcp reindex # rebuild FTS + vector indexes from stored content
memory-mcp stats # print store counts文档文档
docs/tools.md — 工具参考
docs/rliability.md — 可靠性模型与生命周期规则 (
consolidate背后的仅报告维护引擎)
许可协议
MIT — 请参阅 LICENSE。
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.
Persistent memory for AI agents: add, search, update, and delete long-term memories.
Persistent memory for AI agents. Search, store, and recall across sessions.
Persistent memory for AI agents. Search and store durable facts, preferences and decisions.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides persistent long-term memory for LLMs via local SQLite storage and semantic search, enabling recall across sessions without external APIs.18 npm5MIT
- AlicenseAqualityAmaintenanceGives AI agents persistent, local-first memory using SQLite and on-device embeddings, enabling semantic search and recall across sessions with no cloud calls.820 PyPI9MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to store, search, and manage persistent memories, todos, kanban boards, reminders, and progress trackers in a local SQLite database.1Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to manage a local-first, zero-cloud lifelong memory with 33 tools for adding, recalling, searching, consolidating, forgetting memories, traversing knowledge graphs, and checking sync/health status.Apache 2.0