Optionally integrates with OpenAI's embedding API to generate semantic embeddings for memories, enabling semantic search and similarity-based recall using models like text-embedding-3-small.
Provides SQLite-backed memory storage for MCP agents with optional FTS5 indexing, enabling persistent storage and retrieval of memories with text search capabilities.
@ideadesignmedia/memory-mcp
SQLite-backed memory for MCP agents. Ships a CLI and programmatic API.
Highlights (v2)
Single global memory space; no owner segregation nor types.
Minimal schema: subject, content, date_created, date_updated, expires_at (embedding is internal-only).
Optional FTS5 indexing for better search; falls back to
LIKEwhen unavailable.Auto-generates embeddings internally via OpenAI when a key is provided; otherwise relies on text search. Embeddings are never accepted from nor returned to MCP clients.
Install / Run
Quick run (no install):
Install locally (dev dependency) and run:
Other ecosystem equivalents:
pnpm:
pnpm dlx @ideadesignmedia/memory-mcp --db=... --topk=6yarn (classic):
yarn dlx @ideadesignmedia/memory-mcp --db=... --topk=6
CLI usage
You can invoke it directly (if globally installed) or via npx as shown above.
Optional flags:
--embed-key=sk-...supply the embedding API key (same asMEMORY_EMBEDDING_KEY).--embed-model=text-embedding-3-smalloverride the embedding model (same asMEMORY_EMBED_MODEL).
Codex config example
Using npx so no global install is required. Add to ~/.codex/config.toml:
Programmatic API
Tools (v2)
memory-create
Create a memory with
subject,content. Optionally includettlDays(to computeexpires_at).Response:
{ ok: true }on success, or{ ok: false, error: string }on failure.
memory-search
Search globally by text with optional
k(semantic ranking used internally when available).Response items:
{ id, subject, content }.
memory-update
Update fields of a memory by
id:subject,content,ttlDays(recomputesexpires_at), orexpiresAt.Response:
{ ok: true }on success, or{ ok: false, error: string }on failure.
memory-delete
Delete a memory by
id.Response:
{ ok: true }on success, or{ ok: false, error: string }on failure.
memory-get
Fetch a single memory by
id.Response item:
{ id, subject, content, dateCreated, dateUpdated }.
Embeddings
Embeddings are optional—without a key the server relies on text search. Embeddings are internal only; they are never accepted from or returned to clients.
Set MEMORY_EMBEDDING_KEY (or pass --embed-key=... to the CLI) to automatically create embeddings when remembering/importing memories and to embed recall queries. The default model is text-embedding-3-small; override it with MEMORY_EMBED_MODEL or --embed-model. To disable the built-in generator when using the programmatic API, pass embeddingProvider: null to createMemoryMcpServer. To specify a key programmatically, pass embeddingApiKey: "sk-...".
Limits and validation (v2)
memory-create:
subjectmax 160 chars;contentmax 2000; optionalttlDays.memory-search: optional
querymax 1000;kup to 20.memory-update: accepts partial fields;
ttlDaysrecomputesexpires_at.
This server cannot be installed