Full guide: empty database to first recall
Mnemosyne is a memory server for AI agents: bitemporal, backed by Postgres with pgvector, and isolated per workspace with row-level security. This guide takes you from an empty database to a first recall and then shows the four ways to reach the server.
Requirements: Docker with about 8 GB of memory and 12 GB of free disk. To build the monorepo yourself you also need Node 22.18 or later and pnpm 9. The published clients run on Node 20 or later.
1. Start the stack
The bundled Docker stack brings up Postgres with pgvector, Redis, a one-shot
migrate job, the server and a local Ollama:
git clone https://github.com/lucasmailland/mnemosyne
cd mnemosyne/docker
cp .env.example .env
echo "MNEMO_DASHBOARD_SECRET=$(openssl rand -hex 32)" >> .env
docker compose up -d
docker exec mnemosyne-ollama ollama pull bge-m3
docker exec mnemosyne-ollama ollama pull qwen2.5:3bThe first run builds the images and downloads about 3 GB of models: allow 5
to 15 minutes. Wait until every check is ok:
curl http://localhost:3939/health/readyIf you bring your own Postgres, point DATABASE_URL in .env at it and
enable the extension first:
psql "$DATABASE_URL" -c "CREATE EXTENSION IF NOT EXISTS vector;"Then start only the migrate job and the server:
docker compose up -d migrate server2. Migrations
Migrations run in the migrate service, not in the server. It applies both
streams, the 70 v3 migrations and the older 40-file stream, then exits. The
server starts only after it finishes successfully, so a failed migration
shows up in docker compose ps.
To run it again, for example after pulling a newer version of the repository:
docker compose run --rm migrate3. Mint an API key
The first key comes from the terminal. It is printed once, so copy it:
docker compose exec server node scripts/create-api-key.cjs --label "my laptop"The key authenticates the caller and decides the workspace, so no client sends a workspace id with each request.
4. Choose how to reach the server
The server is the only piece that touches the database. Every client below talks to it over HTTP with the API key. There is no library mode: the engine packages are internal and are not published to npm.
REST
Routes are mounted at the root and the server listens on port 3939.
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 full route list is served at GET /openapi.json, which needs the key
too.
TypeScript client (@mnemo-ai/client-ts)
import { MnemosyneClient } from "@mnemo-ai/client-ts";
const memory = new MnemosyneClient({
url: "http://localhost:3939",
apiKey: process.env.MNEMO_KEY!,
});
await memory.remember({ statement: "Acme prefers communication in Spanish." });
const { hits } = await memory.recall({
query: "what language should we use with Acme?",
topK: 5,
});MCP server (@mnemo-ai/mcp)
MCP clients get 37 memory_* tools over stdio. One command detects Claude
Code, Cursor, Codex, Gemini CLI, OpenCode and Windsurf and registers the MCP
server in each one it finds:
npx -y @mnemo-ai/cli installTo register it 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_..."
}
}
}
}CLI (@mnemo-ai/cli)
npm install -g @mnemo-ai/cli
export MNEMO_URL=http://localhost:3939
export MNEMO_KEY=mns_live_...
mnemo remember "Acme prefers communication in Spanish."
mnemo recall "what language should we use with Acme?"5. Choose your LLM
No model and no key ship with Mnemosyne, and the LLM spend is yours. The server reads its providers from the environment. The local stack sets them to the bundled Ollama; anywhere else you choose:
MNEMO_LLM_PROVIDER=anthropic
MNEMO_LLM_API_KEY=...
MNEMO_EMBED_PROVIDER=openai
MNEMO_EMBED_API_KEY=...
MNEMO_EMBED_MODEL=text-embedding-3-smallThere are eight providers: 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.
Changing the embedding model later means existing memories are re-embedded, and the new model’s dimension must be one the schema declares: 1024, 1536, 2048 or 4096.
Next steps
- The architecture spec: the bitemporal model, the recall pipeline and the memory graph.
- The security model: how per-workspace isolation holds.
- Rendering the graph: visualize a workspace’s memory.