More
Self-hosting
Run OpenMemory yourself on Node.js with built-in SQLite, or on your own Cloudflare account with Workers and D1. Same API, same MCP server.
The service in https://github.com/lalagias/openmemory (License to be announced) runs in two ways from the same code in apps/api:
- Node.js with the built-in
node:sqlitemodule. One process, one database file. - Cloudflare Workers + D1, the way the hosted service runs.
Both serve the REST API under /v1, MCP at /mcp, the interactive reference at /docs, and the OpenAPI document at /openapi.json.
Node.js
Requirements: Node.js 22.18 or newer (it runs the TypeScript source directly), and pnpm.
git clone https://github.com/lalagias/openmemory
cd openmemory
pnpm install
cd apps/api
node src/node.ts # or: pnpm startopenmemory listening on http://localhost:8787 (database: .../apps/api/data/openmemory.db)Create a space against your server and connect clients to http://localhost:8787/mcp:
curl -s -X POST http://localhost:8787/v1/spaces -H 'content-type: application/json' -d '{"timezone":"Europe/Athens"}'On Node:
PORTsets the port (default8787) andOM_DB_PATHthe SQLite file (defaultapps/api/data/openmemory.db). Migrations run automatically when the database opens.- Maintenance (inactive-space cleanup, undo-history purge, nightly dreams, index optimize) runs in-process every hour.
- There is no server-side model, so spaces in
serverdream mode get housekeeping only. Useclientmode (the default). - Rate limits are kept in process memory.
Cloudflare Workers + D1
From apps/api:
pnpm exec wrangler d1 create openmemory # paste the database_id into wrangler.jsonc
pnpm db:migrate:remote # apply migrations to D1
pnpm run deploy # wrangler deployFor local development: pnpm db:migrate:local, then pnpm dev (wrangler dev).
wrangler.jsonc already sets an hourly cron (0 * * * *) for maintenance. Optional bindings:
- Workers AI for
serverdream mode: uncomment"ai": { "binding": "AI" }and runpnpm cf-typegen.OM_DREAM_MODELpicks the model (default@cf/meta/llama-3.3-70b-instruct-fp8-fast). Without it, server-mode spaces get housekeeping only. - Rate limiting: a Cloudflare Rate Limiting binding named
RATE_LIMITERenforces the per-space limit across isolates (its own configured limit applies). Without it, the limit is kept per isolate, which makes it a soft limit.
Configuration
Every limit can be overridden with an environment variable (Worker vars or process.env). Invalid values are ignored.
| Variable | Default |
|---|---|
OM_MAX_MEMORIES | 5000 |
OM_MAX_RECORDS | 2000 |
OM_MAX_OPEN_ACTIONS | 500 |
OM_MAX_EVENTS | 10000 |
OM_MAX_JOURNAL | 800 |
OM_MAX_KV | 1000 |
OM_MAX_BATCH_OPS | 50 |
OM_MAX_BODY_BYTES | 262144 (256 KB) |
OM_REQUESTS_PER_MINUTE | 120 |
OM_SPACES_PER_HOUR_PER_IP | 10 |
OM_INACTIVE_DAYS | 90 |
OM_SCRATCH_DAYS | 14 |
OM_DREAM_MAX_CHANGES | 50 |
OM_DREAM_INTERVAL_HOURS | 20 |
Pointing clients at your server
Replace the hosted URLs in any guide:
| Hosted | Self-hosted |
|---|---|
https://api.openmemory.sh | http://localhost:8787 (or your Worker URL) |
https://mcp.openmemory.sh | http://localhost:8787/mcp (or https://<your-worker>/mcp) |