LongMemory (formerly OpenMemory) MCP server
CaviraOSS's self-hosted memory engine, formerly OpenMemory: sector-classified memories with decay, plus a temporal fact graph, over stdio or HTTP MCP.
LongMemory is the CaviraOSS project previously published as OpenMemory (openmemory-js on npm). It is a separate codebase from Mem0's OpenMemory. In the current npm release, 1.3.3, each stored memory is classified into one of five sectors (episodic, semantic, procedural, emotional, reflective) that decay at different rates, memories are linked through a waypoint graph for associative recall, and a separate temporal knowledge graph holds subject-predicate-object facts with validity periods. Metadata lives in SQLite by default or in Postgres, with Valkey as an optional vector backend, and embeddings come from OpenAI, Gemini, AWS, Ollama or a local model, falling back to synthetic embeddings when none is configured.
The MCP server in that release has six tools (query, store, reinforce, delete, list and get), and each one accepts an optional user_id, so one database can hold several users' memories apart. It runs over stdio from the longmemory CLI, or over Streamable HTTP at /mcp on the self-hosted API server (port 8080 by default), which requires the LM_API_KEY key when one is set. The project is Apache 2.0 and free. The repository's main branch has since been rewritten around a Hydrograph engine with 13 project-scoped tools and user, team and role identity, but that version is not yet published to npm.
Quick install
Copy-paste configs are provided for all 8 supported clients. Pick your client below.
Add to ~/.claude.json
{
"mcpServers": {
"openmemory": {
"command": "npx",
"args": [
"-y",
"longmemory",
"mcp"
],
"env": {
"LM_DB_PATH": "<LM_DB_PATH>",
"LM_TIER": "<LM_TIER>",
"LM_EMBEDDINGS": "<LM_EMBEDDINGS>"
}
}
}
}claude mcp add openmemory -- npx -y longmemory mcpAvailable tools
| Tool | Description |
|---|---|
| longmemory_query | Query contextual memories by semantic search, temporal facts by pattern and date, or both, optionally scoped to a user and sector. |
| longmemory_store | Store text as a contextual memory, as subject-predicate-object facts, or both. |
| longmemory_reinforce | Raise an existing memory's salience by a set amount (default 0.1). |
| longmemory_delete | Delete a memory by ID, optionally checking it belongs to a given user. |
| longmemory_list | List recent memories, optionally limited to one sector or user. |
| longmemory_get | Fetch one memory by ID, optionally with its sector vector metadata and an ownership check. |
Required configuration
- LM_DB_PATHOptional
SQLite file for memories. Set it explicitly: the default path sits inside the installed package directory.
- LM_TIEROptional
Performance tier: fast, smart, deep or hybrid (default hybrid).
- LM_EMBEDDINGSOptional
Embedding provider: openai, gemini, aws, ollama, local or synthetic (default).
- LM_API_KEYOptional
API key the HTTP server requires on REST and /mcp requests when set.
What you can do with it
Per-user memory inside your own app
An assistant you host calls longmemory_store and longmemory_query with each end user's user_id, so one self-hosted database keeps every user's preferences and history apart.
Facts with a validity window
Store "service X runs on Postgres" as a fact with a start date, and a later factual query with an at date returns what was true at that point rather than the newest sentence that mentions it.
FAQ
- Is it free?
- Yes. LongMemory is open source under Apache 2.0 and self-hosted, with no paid tier. You pay only for any embedding API you choose instead of a local model.
- Does it support remote or OAuth?
- It supports remote access but not OAuth. The self-hosted API server exposes MCP over Streamable HTTP at /mcp, guarded by a static API key (LM_API_KEY) when you set one. There is no hosted endpoint.
- Is this Mem0's OpenMemory, and how does it compare to Glen?
- No. It is the CaviraOSS project that used the OpenMemory name before renaming to LongMemory; Mem0's OpenMemory MCP server is a different codebase. LongMemory stores what your agent or app explicitly writes, scoped by user_id in a database you run. Glen captures agent sessions, Slack, GitHub, tickets, docs and calls into managed org memory and filters each recall to what the asking user is cleared to see.