mnemosyne
Connects Google Gemini as a model API provider for embeddings and completions, enabling semantic memory writes and recall when configured.
Connects local Ollama models as an optional provider, with BGE-M3 suggested for embeddings and a user-selected completion model.
Connects an OpenAI model API as the server's model provider, supplying embeddings and completions for semantic memory writes and recall.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Mnemosyne
English · Español
Long-term memory for AI agents that knows what was true, when, and who may see it. Self-hosted on your own Postgres.
Quickstart · Dashboard · What you get · How it works · Packages · Docs
Mnemosyne is an open-source memory server for AI agents. Agents write what they learn and ask for it back through an MCP server, a CLI, a typed client or the REST API; people see it in a web dashboard. Everything lives in your own Postgres.
Agents forget: every conversation starts from zero. Pasting chunks from a vector store into the prompt hides that and adds three problems that grow with scale:
No provenance. A chunk comes back, but nobody can say where it came from, how sure the system is or whether it is still true.
No time. "Acme is on Pro" and "Acme upgraded to Enterprise" are both just vectors. Nothing says which one holds today, or what was believed on March 1st.
No isolation. Memory shared by several customers and separated only by a
WHERE workspace_id = ?is one forgotten clause away from a leak.
Mnemosyne stores typed memories with their source, their confidence and the period in which they hold, and lets the database keep each workspace apart.
It fits if your agents serve several users or customers, if you need to audit what an agent knew at a given moment, or if you want the memory on your own infrastructure. It is more than you need for a single-user notebook that only wants similarity search: plain pgvector will do.
Alpha. The main paths work and are tested against real Postgres, and the API can still change within 3.x.
docs/STATUS.mdlists what is stable, beta and planned. Self-hosted only: there is no hosted service.
Quickstart
You need Docker and a key for one model API: Mnemosyne ships with no model and runs on the one you connect. The stack runs Postgres with pgvector, Redis and the server. The first run builds the images: allow 5 to 15 minutes.
git clone https://github.com/lucasmailland/mnemosyne
cd mnemosyne/docker
cp .env.example .env
echo "MNEMO_DASHBOARD_SECRET=$(openssl rand -hex 32)" >> .env
$EDITOR .env # uncomment one model block and add its key
docker compose up -ddocker/.env.example has ready blocks for OpenAI, Google Gemini, Anthropic with Voyage embeddings, and local models; uncomment one. Local models are opt-in: Ollama starts only with docker compose --profile local up -d, bge-m3 (MIT) is the suggested embedder, and no completion model is chosen for you; pick one whose licence fits your use (qwen2.5:3b, for one, is non-commercial). With no provider the server still starts and logs what is missing; recall then falls back to full-text search and writes answer 501 until an embedder is set. docker/README.md has the details. The secret lets the dashboard sign in. Wait until the server reports every check as ok, embeddings included:
curl http://localhost:3939/health/ready{
"status": "ready",
"degraded": false,
"checks": { "postgres": "ok", "vector": "ok", "cache": "ok", "embed": "ok" }
}Mint the first API key from the terminal. It is printed once, so copy it:
docker compose exec server node scripts/create-api-key.cjs --label "my laptop"Remember something, then ask for it in other words:
curl -X POST http://localhost:3939/remember \
-H "Authorization: Bearer mns_live_..." \
-H "Content-Type: application/json" \
-d '{"statement": "Acme prefers communication in Spanish."}'
curl -X POST http://localhost:3939/recall \
-H "Authorization: Bearer mns_live_..." \
-H "Content-Type: application/json" \
-d '{"query": "what language should we use with Acme?", "topK": 5}'The recall finds the memory by meaning, with no words in common, and returns it with its validity and its sensitivity:
{
"hits": [
{
"kind": "fact",
"content": "Acme prefers communication in Spanish.",
"score": 0.74,
"validFrom": "2026-11-19T00:24:12.810Z",
"validTo": null,
"sensitivity": "internal",
"status": "active"
}
],
"nothingRelevant": false
}The local stack is for trying it out. It connects to Postgres as the database owner, which bypasses row-level security, so workspaces are not isolated from each other here. The production overlay provisions a restricted role and turns the isolation on; see
docker/README.md. Its ports are published on127.0.0.1only. After agit pull, rundocker compose up -d --build: without--buildCompose keeps the images it built before.
Connect your agents
One command detects Claude Code, Cursor, Codex, Gemini CLI, OpenCode and Windsurf on the machine and registers the MCP server in each one it finds:
npx -y @mnemo-ai/cli installCapturing whole conversations is a separate, opt-in step, available for Claude Code, Codex and OpenCode (guide):
npx -y @mnemo-ai/cli install --capture claude-code,codex,opencodeThe mnemo CLI also works on its own, in English or Spanish (MNEMO_LOCALE=es):
npm install -g @mnemo-ai/cli
export MNEMO_URL=http://localhost:3939
export MNEMO_KEY=mns_live_...
mnemo remember "The user prefers concise responses"
mnemo recall "user preferences"To register only the MCP tools by hand, add this to your MCP client's configuration:
{
"mcpServers": {
"mnemosyne": {
"command": "npx",
"args": ["-y", "@mnemo-ai/mcp"],
"env": {
"MNEMO_URL": "http://localhost:3939",
"MNEMO_KEY": "mns_live_..."
}
}
}
}Open the dashboard
With the stack running, from the repository root (Node 22.18 or later and pnpm 9). The dashboard imports the workspace packages from their built output, so build them once first:
pnpm install
pnpm build
MNEMO_SERVER_URL=http://localhost:3939 pnpm --filter @mnemo-ai/dashboard devOpen http://localhost:3000/dashboard, choose Sign in with API key and paste your mns_live_... key. It needs the MNEMO_DASHBOARD_SECRET line from the quickstart; without it the server runs headless and the sign-in is off.
The dashboard shows what was written and recalled, the memories themselves, the sessions they came from and the graph that connects them, plus recall testing, members, API keys, health and the audit log, in English and Spanish. In production it ships in docker/docker-compose.prod.yml, behind your HTTPS proxy.
Related MCP server: attestor
What you get
202 REST routes with OpenAPI, 37 MCP tools, 49 CLI commands and a dashboard, over one Postgres.
Memory
Typed memory | Ten kinds of memory, from facts and decisions to episodes and tasks, each recalled and forgotten in its own way. |
Bitemporal facts | Every fact keeps two times: when it holds in the world and when the system learned it. Forgetting closes a period; history is never destroyed, so you can ask what was believed on any date. |
Hybrid recall | Full-text and vector search in one call, with context from the memory graph, a hot tier in Redis and an optional LLM rerank. |
Sessions become memories | Start a session, stream the turns and collapse it: the engine extracts facts, decisions and entities from the conversation. |
Conflicts and corrections | When two facts contradict each other, the pair is flagged and you or the agent resolve it. A correction replaces the fact and keeps its lineage. |
Consolidation | A background pass merges duplicates and retires what was superseded. A pinned fact is never merged. |
Reminders | A memory that comes back on its own: at a time, or when a condition shows up in a later recall. |
A graph, not a list | Entities, episodes and decisions connected by typed relations that carry confidence and provenance. |
Security and teams
Isolation in the database | Postgres row-level security with |
Sensitivity tiers |
|
Privacy on write | Personal data is detected and redacted when a memory is written. |
Users, roles and keys | Users, tenants and workspaces with roles. API keys carry scopes and a sensitivity ceiling, and sensitive actions can require approval. |
Audit | An audit log, a timeline of what was learned and when, and data export behind an approval. |
Running it
Your own LLM | OpenAI, Anthropic, Google, Cohere, Mistral, Voyage, AWS Bedrock or a local Ollama. No model and no key ship with it, and the LLM spend is yours. |
Many ways in | MCP server, CLI, typed TypeScript client, Python and Go SDKs, REST, gRPC and WebSocket, and the dashboard. |
Events out | Webhooks signed with HMAC-SHA256 and live subscriptions over WebSocket. |
Observability | Health checks, a metrics endpoint and four Grafana dashboards. |
Sync between servers | Signed synchronization between Mnemosyne servers. |
Several of these are beta; docs/STATUS.md marks each one.
The 37 MCP tools
An agent connected through MCP gets all of them, and the mnemo CLI covers the same ground. MNEMO_MCP_TOOLS=core trims the list to the 9 most used (recall, fact, remember, decide, update, forget, search, status, context) when you want each request to carry less. The full reference, with every parameter, is in packages/mcp/README.md.
Group | What the agent can do | Tools |
Remember and recall | Write a memory, find it by meaning or by text, read one in full, see what changed over time, read the session's context |
|
Correct and forget | Replace a fact keeping its lineage, close it, protect it from merges, move it to another workspace, delete it for good |
|
Structure | Entities, typed relations between two memories or among several, decisions with their rationale |
|
Sessions | Open an episode, add turns, collapse it into facts and decisions, or discard it |
|
Work and know-how | Tasks with owner and status, immutable events, stored reasoning, strategies, workflows and skills |
|
Keep it clean | List and resolve contradictions, compare two facts, merge duplicates, strengthen or weaken a memory |
|
Look ahead and reflect | Reminders by time or condition, likely next recalls, coverage and gaps, new inferences from what is known |
|
Operate | Health, workspace statistics, eight diagnostics, workspaces and members |
|
How it works
The server is the only piece that touches the database. The CLI, the MCP server, the SDKs and the dashboard all talk to it over HTTP with an API key, and the key decides the workspace.
Recall
A recall runs seven stages in order. ACT-R, a model of human memory, only breaks ties in favor of what was used recently; relevance decides the ranking.
What it costs in context
Recall puts 3 to 5 relevant memories in front of the agent, not the whole memory. In the benchmark that was about 280 to 340 characters per turn, with the answer among them for 95 to 97% of the questions. The tools themselves add a fixed amount to every request (about 47 KB with all 37, 13 KB with MNEMO_MCP_TOOLS=core), so with a small memory (under roughly 635 short memories, or 180 with core) pasting everything is cheaper; as the memory grows, the dump grows with it and recall does not. Method, numbers and limits: docs/testing/token-benchmark.md; reproduce with pnpm bench:tokens.
Ten kinds of memory
A fact, a decision and an episode are recalled, forgotten and consolidated differently, so Mnemosyne stores the kind with the memory.
Kind | What it holds | Fades |
| Durable knowledge about a user, an agent or a domain, with confidence and a validity period | Slowly |
| A decision with its rationale; a later one can supersede it | Slowly |
| A | Slowly |
| A reusable multi-step process with ordered steps and conditions | Slowly |
| A stored prompt template for a repeatable task | Slowly |
| A question, its reasoning steps and the conclusion | Slowly |
| A bounded record of a session or event | Sooner |
| A person, organization, project, concept or place that other memories mention | Sooner |
| An action item with a lifecycle and delegation | Fast |
| An append-only record of something that happened | Never |
Relations between memories are stored too, and they are what the graph draws.
Sessions become memories
import { MnemosyneClient } from "@mnemo-ai/client-ts";
const memory = new MnemosyneClient({
url: "http://localhost:3939",
apiKey: process.env.MNEMO_KEY!,
});
const session = await memory.createSession({ agentId: "agent_support" });
await memory.appendTurn(session.id, { role: "user", content: "I need to cancel my subscription" });
await memory.appendTurn(session.id, { role: "assistant", content: "Done, it ends on the 30th." });
await memory.collapseSession(session.id, { strategy: "auto" });
const { hits } = await memory.recall({ query: "subscription status", topK: 5 });Collapsing a session is what turns the conversation into facts and decisions.
Sensitivity
A read above the key's ceiling answers 404 instead of 403, so nobody can probe what exists.
The memory graph
This is a real workspace in the dashboard. Entities, episodes and decisions connect through typed relations that carry confidence and provenance: some are stated, some are inferred by meaning, and some come from the facts two memories share. Recall uses them for context, the server serves them at GET /graph, and examples/graph-viewer shows how to draw them yourself.
Choose your LLM
The server reads its providers from the environment (docker/.env for the local stack); nothing is chosen for you:
MNEMO_LLM_PROVIDER=anthropic
MNEMO_LLM_API_KEY=...
MNEMO_EMBED_PROVIDER=openai
MNEMO_EMBED_API_KEY=...
MNEMO_EMBED_MODEL=text-embedding-3-smallSupported providers are openai, anthropic, google, cohere, mistral, voyage, bedrock and ollama. If the embedding provider is unreachable, recall falls back to full-text search; session collapse needs an LLM. docker/.env.example documents every variable.
Packages
On npm. All four are clients: they need a running server.
Package | What it is |
The | |
MCP server over stdio with 37 tools. | |
Typed HTTP client for Node 20+, Bun, Deno, Workers and browsers. | |
Shared types; the other three install it for you. |
The Python and Go SDKs install from the repository:
pip install "git+https://github.com/lucasmailland/mnemosyne.git#subdirectory=packages/sdk-python"
go get github.com/lucasmailland/mnemosyne/packages/sdk-goPackage | What it is |
Hono HTTP API with OpenAPI 3.1, gRPC, bearer auth and the dashboard sign-in. | |
The Next.js web dashboard. | |
The engine: kinds of memory, recall, bitemporal facts, session collapse. | |
Storage, vector search over pgvector and the cache. | |
The eight LLM providers, a router and a spending cap. | |
Background consolidation, signed sync between servers, plugins and schema upgrades. | |
Conversation capture behind | |
An in-memory mock of the REST API for offline development. |
Status and tests
Alpha. docs/STATUS.md says, feature by feature, what works. GitHub Actions is off for this repository, so there is no CI badge to trust: releases pass a local gate instead (docs/RELEASING.md), and you can run the same suites yourself.
pnpm testruns the unit and contract suites, with no Docker needed. The repository has more than 1,000 test files.pnpm test:integrationruns against real Postgres and pgvector in containers, starting from an empty database and its 79 migrations.Workspace isolation has its own tests under a restricted database role, such as
collapse-rls-nonsuperuser;DEBUG_RLS_ISOLATION.mdexplains how to check it by hand.
Known limits today:
Pinning protects a fact from consolidation; it does not raise it in recall.
By default recall searches seven of the ten kinds; pass
kindsto search them all.Conversation capture records the user's side in Claude Code and OpenCode; Codex needs its hooks feature turned on.
The Python and Go SDKs are not on PyPI or tagged yet.
Development
git clone https://github.com/lucasmailland/mnemosyne
cd mnemosyne
pnpm install
pnpm build
pnpm typecheck
pnpm testBuilding needs Node 22.18 or later and pnpm 9; the published packages run on Node 20 or later.
Documentation
docs/STATUS.md: what works todaydocker/README.md: the Docker stack, local and productiondocs/architecture/API.md: REST, MCP and gRPC referencedocs/architecture/DATA_MODEL.md: the kinds of memory, schema and decaydocs/architecture/SECURITY.md: row-level security, sensitivity and the threat modeldocs/guides/CLI.md: themnemoCLIdocs/guides/HARNESS.md: conversation capturepackages/mcp/README.md: MCP setup and the 37 toolsdocs/integration/SDK_INTEGRATION.md: using the SDKs
Contributing
Issues and pull requests are welcome; see CONTRIBUTING.md. Questions and bug reports go to GitHub Issues. The most useful thing right now is to run the quickstart and tell us what surprised you.
Security
To report a vulnerability, do not open a public issue: follow SECURITY.md.
License
Apache-2.0 © Lucas Mailland.
Named after Mnemosyne, the Greek Titaness of memory and mother of the nine Muses.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Versioned agent memory in your own Postgres: portable context, permissioned, audit trail.
Shared memory for AI agents, as a graph in your own Postgres. Writes never call an LLM.
Persistent memory for AI agents. EU-hosted, privacy-first, hybrid recall, contradiction detection.
Persistent, inspectable memory for AI agents with lineage, correction, and a hosted MCP endpoint.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to store, retrieve, and manage contextual knowledge across sessions using semantic search with PostgreSQL and vector embeddings. Supports memory relationships, clustering, multi-agent isolation, and intelligent caching for persistent conversational context.21 npm50MIT
- AlicenseNot gradedqualityCmaintenanceAudit-grade memory backbone for agent teams. Bi-temporal facts (event time + transaction time, with recall(as_of=...) replay), 6-step deterministic retrieval (no LLM in the critical path), conversation ingest with speaker-locked dual-pass extraction, per-tenant Postgres row-level security, and Ed25519-signed provenance. Postgres + pgvector + Neo4j defaults.31 PyPI14MIT
- AlicenseNot gradedqualityAmaintenanceUser-owned shared memory for AI agents, providing a persistent, curated knowledge layer with hybrid search and cross-agent coordination via Postgres + pgvector.20Apache 2.0
- FlicenseBqualityBmaintenanceEnables AI agents to read, write, organize, and link persistent long-term memory across model providers using embeddings and pgvector retrieval.21-