local-ltm is a local Model Context Protocol (MCP) server that provides long-term memory for AI agents. It allows a single user to run multiple AI agents that can store, search, update, and delete durable memory (preferences, facts, skills) using mem0 as the memory backend.
Local LTM (Long-Term Memory)
A modular, locally-maintained Long-Term Memory system for AI agents powered by Mem0 and exposed via MCP (Model Context Protocol).
Store, search, and manage persistent knowledge for AI agents across conversations.
Setup
1. Prerequisites
- Node.js 16+
- Mem0 API Key (get here)
2. Installation
npm install
3. Configuration
Create a .env file:
MEM0_API_KEY=your_mem0_api_key_here
See .env.example for more details.
Quick Start
Start Server
node src/index.js
Test
node src/test.js
Claude Desktop Integration
Add to your Claude Desktop config file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS/Linux: ~/.claude_desktop_config.json
{
"mcpServers": {
"long-term-memory": {
"command": "node",
"args": ["C:\\Users\\YourUsername\\Desktop\\local-ltm\\src\\index.js"],
"env": {
"MEM0_API_KEY": "your_mem0_api_key_here"
}
}
}
}
Then restart Claude Desktop. The LTM tools will be available!
Available Tools
memory.store- Save memories (semantic, episodic, procedural)memory.search- Query memories by namespacememory.update- Update existing memoriesmemory.delete- Remove obsolete memories
Memory Organization
Shared Knowledge:
/shared/user_preferences
/shared/facts
Agent-Specific:
/agents/{agent_id}/private/heuristics
Memory Types
- episodic - Events, experiences, conversations
- semantic - Facts, knowledge, stable information
- procedural - Preferences, rules, best practices
Project Structure
src/
├── index.js # MCP Server
├── mem0.js # Mem0 API wrapper
├── test.js # Test client
├── config/
│ ├── prompts.js
│ └── server.js
└── tools/
├── store.js
├── search.js
├── update.js
└── delete.js
Usage Example
// Store a memory
await client.send("tools/call", {
name: "memory.store",
arguments: {
namespace: "/shared",
content: "User prefers concise explanations",
type: "procedural",
confidence: 0.9
}
});
// Search memories
const results = await client.send("tools/call", {
name: "memory.search",
arguments: {
namespace: "/shared",
query: "user preferences"
}
});
Guidelines
Store when:
- Information is durable and reusable
- Information is stable (preferences, facts, decisions)
Don't store:
- Temporary context
- Task-specific details
- Raw conversation text (unless critical)
Adding Tools
- Create
src/tools/mytool.js - Export tool with schema and execute function
- Register in
src/tools/index.js
License
MIT