LongtermMemory-MCP
A fully local MCP server that gives AI agents persistent, semantic long-term memory — without any cloud dependencies.
Inspired by mcp-mem0, but runs 100% on your machine:
接入你的智能体
發布者自己的指令。不是 PlugMCP 端點。
用我們的金鑰與日誌託管一份副本。
npx -y [email protected]Claude Code 沒有本機指令的安裝連結。複製下方指令並在終端機中執行。
claude mcp add io.github.marcelroozekrans-longterm-memory -- npx -y longterm-memory-mcp@1.6.1在終端機中執行。
{ "mcpServers": { "io.github.marcelroozekrans-longterm-memory": { "command": "npx", "args": [ "-y", "[email protected]" ] } }}claude_desktop_config.json
遠端 URL 還是本機指令? 兩種安裝方式的差異
來自發布者
A fully local MCP server that gives AI agents persistent, semantic long-term memory — without any cloud dependencies.
Inspired by mcp-mem0, but runs 100% on your machine:
A fully local MCP server for long-term memory with semantic search
Install via the Claude Code marketplace — this sets up both the MCP server and a companion skill that teaches Claude how to use memory effectively:
/plugin marketplace add MarcelRoozekrans/LongtermMemory-MCP
/plugin install longterm-memory@longterm-memory-marketplace
This automatically:
long-term-memory skill (Claude learns to recall context at session start, save insights after tasks, and deduplicate memories)npx longterm-memory-mcp
npm install -g longterm-memory-mcp
longterm-memory-mcp
git clone https://github.com/MarcelRoozekrans/LongtermMemory-MCP.git
cd LongtermMemory-MCP
npm install && npm run build
npm start
If you installed via the plugin marketplace, the MCP server is already configured. For manual setup, add to your MCP settings (~/.claude/settings.json or project .claude/settings.json):
{
"mcpServers": {
"longterm-memory": {
"command": "npx",
"args": ["-y", "longterm-memory-mcp"]
}
}
}
Add to claude_desktop_config.json:
{
"mcpServers": {
"longterm-memory": {
"command": "npx",
"args": ["-y", "longterm-memory-mcp"]
}
}
}
The repo includes agent instructions that teach AI agents how to use memory effectively (automatic recall, save patterns, deduplication):
By default, memories are stored in a shared, user-scoped location:
~/.longterm-memory-mcp/memories.db
This means every project and every MCP client shares the same memory pool — you save a memory in one project and it's available everywhere.
Several sessions can use the same database at once. Each server process reads and writes the shared file directly (SQLite in WAL mode), so a memory saved in one session is visible to every other session right away, and no session overwrites what another saved. Requires Node.js 22.13 or later.
Databases from older releases open unchanged. A database from v1.0–1.3, which has no schema_meta table, is migrated in place with all its memories kept; a copy named memories.db.pre-migration-<timestamp>.bak is written next to it first.
Upgrading from 1.4 or earlier: stop every running session that uses the old version before starting one with the new version. Older releases keep the whole database in memory and rewrite the file on each save, so an old process left running would overwrite what new sessions saved.
To isolate memories for a specific project, set the MEMORY_DB_PATH environment variable:
{
"mcpServers": {
"longterm-memory": {
"command": "npx",
"args": ["-y", "longterm-memory-mcp"],
"env": {
"MEMORY_DB_PATH": "/path/to/project/memories.db"
}
}
}
}
Each memory has a memory_type that determines how it's categorized and how quickly it decays:
["auth", "backend"]). Search with search_by_tags.core, identity, or pinned skip decay entirely.Memories decay over time to keep the store relevant:
Memory content is hashed (SHA-256) on save. If identical content already exists, the save is rejected with a reference to the existing memory ID. This prevents duplicate entries automatically.
Backups are managed automatically and can also be triggered manually via the create_backup tool.
~/.longterm-memory-mcp/backups/ by default, or set MEMORY_BACKUP_PATH:{
"mcpServers": {
"longterm-memory": {
"command": "npx",
"args": ["-y", "longterm-memory-mcp"],
"env": {
"MEMORY_BACKUP_PATH": "/path/to/backups"
}
}
}
}
all-MiniLM-L6-v2 (384-dim vectors) and stored in SQLite alongside the raw content, metadata, tags, importance, and type. Content is deduplicated via SHA-256 hash.The embedding model (~30MB quantized) is downloaded once on first use and cached locally.
src/ — MCP server source
index.ts — Entry point (stdio transport, DB/backup path resolution)
server.ts — MCP server factory + 11 tool definitions
memory-store.ts — SQLite storage + vector search + decay integration
embeddings.ts — Local embedding engine (Xenova/transformers)
decay.ts — DecayEngine (lazy decay, reinforcement, protected tags)
backup.ts — BackupManager (auto-backup, JSON export, pruning)
types.ts — TypeScript interfaces (Memory, Embedder, config types)
skills/ — Claude Code plugin skill
long-term-memory/SKILL.md — Self-contained agent instructions + skill
.claude-plugin/ — Plugin & marketplace metadata
plugin.json — Plugin manifest
marketplace.json — Marketplace manifest
.mcp.json — Auto-configures MCP server on plugin install
.vscode/mcp.json — VS Code MCP server config
Run with npm run bench. Results from an in-memory store using mock embeddings (isolates store/SQLite performance from model latency):
npm install # Install dependencies
npm run build # Compile TypeScript
npm test # Run all tests
npm run bench # Run benchmarks
npm run test:watch # Watch mode
npm run test:coverage # Coverage report
This project uses Conventional Commits and semantic-release for automated versioning.
<type>(<optional scope>): <description>
[optional body]
[optional footer(s)]
Breaking changes: Add ! after the type (e.g., feat!: remove deprecated API) or include a BREAKING CHANGE: footer. This triggers a major version bump.
git commit -m "feat: add memory tagging support"
git commit -m "fix: handle empty search query gracefully"
git commit -m "feat!: change default database location"
git commit -m "docs: update configuration examples"
Commit messages are validated locally via commitlint + husky git hooks. Non-conforming messages will be rejected.
Releases are fully automated. When commits are pushed to main:
CHANGELOG.mdNo manual version bumps or tags needed.
Dependencies are managed automatically by Renovate. Patch and minor devDependency updates are auto-merged after CI passes. Major updates create PRs for manual review.
MIT
A fully local MCP server for long-term memory with semantic search
{ "mcpServers": { "io.github.marcelroozekrans-longterm-memory": { "command": "npx", "args": [ "-y", "[email protected]" ] } }}工具
尚無工具清單。遠端伺服器會在首次健康檢查後取得工具清單。
常見問題
在本頁複製適用於 Cursor、Claude Desktop、Claude Code 或 VS Code 的 stdio 設定。它使用發布者的安裝方式,而不是 PlugMCP 代理伺服器。
這筆記錄未列出必要的環境變數。
Longterm Memory 透過 stdio 在本機執行。
上次檢查時間:2026-11-09。 A fully local MCP server for long-term memory with semantic search