Longterm Memory
Local long-term memory for agents with semantic search, decay and secret filtering
- Pricing
- Open source
- Platforms
- CLI, self-hosted, macOS
- Runs
- Locally
- Version
- 1.6.1
- Listing updated
- today
Similar MCP servers
About Longterm Memory
Longterm Memory is an open-source MCP server for knowledge and memory. It runs locally on your machine and is started by your AI client.
This server stores agent memories in a SQLite file on your machine and embeds them with a local all-MiniLM-L6-v2 transformer, so there are no API keys, cloud database or LLM dependency. Search is in-process cosine similarity, and the default database at ~/.longterm-memory-mcp/memories.db is shared by every project and client, though MEMORY_DB_PATH gives a project its own. Several sessions can use it at once through SQLite's WAL mode, and it needs Node.js 22.13 or later.
Each memory has a type (general, fact, preference, conversation, task, ephemeral) with its own decay half-life from 10 to 120 days, plus tags and an importance from 1 to 10. Decay is computed lazily on access, searching a memory raises its importance slightly, and the tags core, identity and pinned exempt it from decay. Identical content is rejected through a SHA-256 hash.
A content guard strips marked spans and refuses text that looks like a secret, such as private keys, GitHub tokens, sk- API keys, AWS key IDs, JWTs and Slack tokens, naming the pattern but never the value. A Claude Code plugin adds an automatic recall hook and a skill for when to save and recall.
Install
Run in a terminal
claude mcp add longterm-memory -- npx -y longterm-memory-mcpAdd to claude_desktop_config.json
{
"mcpServers": {
"longterm-memory": {
"command": "npx",
"args": [
"-y",
"longterm-memory-mcp"
]
}
}
}Add to ~/.cursor/mcp.json
{
"mcpServers": {
"longterm-memory": {
"command": "npx",
"args": [
"-y",
"longterm-memory-mcp"
]
}
}
}Add to .vscode/mcp.json
{
"servers": {
"longterm-memory": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"longterm-memory-mcp"
]
}
}
}Add to ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"longterm-memory": {
"command": "npx",
"args": [
"-y",
"longterm-memory-mcp"
]
}
}
}Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"longterm-memory": {
"command": "npx",
"args": [
"-y",
"longterm-memory-mcp"
]
}
}
}Using several servers? Build one config file with the MCP config generator.
Tools this server provides (11)
Taken from the project documentation; the running server may differ.
- save_memory
- Store text with an embedding, tags, importance and type.
- search_memory
- Find relevant memories using a natural-language query.
- update_memory
- Modify an existing memory's content or metadata.
- delete_memory
- Remove a memory by ID.
- delete_all_memories
- Wipe all memories irreversibly.
- get_all_memories
- List stored memories with pagination.
- memory_stats
- Show memory count and database location.
- search_by_type
- Filter memories by category.
- search_by_tags
- Find memories matching any given tag.
- search_by_date_range
- Find memories created within a date range.
- create_backup
- Trigger a database backup with JSON export.
What it does
- Fully local
- SQLite storage and local embeddings with no cloud calls.
- Typed memories with decay
- Half-lives from 10 to 120 days, with importance reinforcement.
- Flexible search
- By meaning, type, tags or date range.
- Deduplication
- Identical content is rejected by hash.
- Secret rejection
- Refuses content that looks like keys or tokens.
- Backups
- Manual database backup with JSON export.
Good for
- Let an agent remember project decisions across sessions
- Keep personal preferences available in every project
- Recall earlier context at session start
- Keep memory private with no cloud service
Pricing
Open source
Open-source npm package
Longterm Memory FAQ
Does it send data to the cloud?
No, storage and embeddings run entirely on your machine.
Where are memories stored?
In ~/.longterm-memory-mcp/memories.db by default, or the path in MEMORY_DB_PATH.
What Node version is needed?
Node.js 22.13 or later.
Can it store API keys?
No, the content guard rejects text matching common secret patterns.
Is Longterm Memory free?
Yes. Longterm Memory is open source, so you can use and self-host it for free.
How do I add Longterm Memory to Claude Code?
Run this command in your terminal: claude mcp add longterm-memory -- npx -y longterm-memory-mcp
What are the best alternatives to Longterm Memory?
The closest alternatives to Longterm Memory are Codebase Memory, XERJ, Claude Code Ultimate Guide, Nautilus Compass Memory and NeuroStack.
Where this comes from
- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.



