AI Memory MCP
Optional embedding provider for high-quality semantic search, replacing the local fallback (requires OPENAI_API_KEY).
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@AI Memory MCP remember that I prefer dark mode in code editors"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
AI Memory MCP
A persistent, searchable memory layer for AI assistants, exposed as an MCP (Model Context Protocol) server. Works with Claude, Cursor, Windsurf, VS Code, Continue, or any other MCP-compatible client. Implements the MVP scope from the AI Memory MCP PRD: CRUD, namespaces, hybrid ranked search, relationships, chat-context assembly, import/export, and optional LLM-powered auto-extraction.
Why this design
Zero required setup. Storage uses Node's built-in
node:sqlite(experimental but stable enough for this), so there's no native module to compile and no external database to run. One file,memory.db, holds everything.Provider-agnostic embeddings. Ships with a dependency-free local hashing embedder so semantic search works out of the box with no API key. Swap in a real embedding provider (OpenAI-compatible endpoint) via env vars when you want production-quality semantic recall — see below.
Auto-extraction is optional. Set
ANTHROPIC_API_KEYto enable thememory_extracttool, which asks Claude to pull memory-worthy facts out of raw conversation text. Without a key, everything else still works; you just callmemory_addexplicitly instead.
Related MCP server: Facthouse
Install
npm install
npm run buildRequires Node.js >= 22.5 (uses node:sqlite).
Run
npm startThis starts the server on stdio, which is how MCP clients (Claude Desktop, Cursor, etc.) talk to it. You won't see interactive output — clients spawn this process directly.
Example: Claude Desktop config
Add to your claude_desktop_config.json:
{
"mcpServers": {
"ai-memory": {
"command": "node",
"args": ["--experimental-sqlite", "/absolute/path/to/ai-memory-mcp/dist/index.js"],
"env": {
"MEMORY_DB_PATH": "/absolute/path/to/ai-memory-mcp/memory.db",
"DEFAULT_USER_ID": "your-name"
}
}
}
}Configuration (environment variables)
Variable | Default | Purpose |
|
| Path to the SQLite database file |
|
| User id used when a tool call omits |
| (unset → local hash) |
|
| provider default | Endpoint for |
| — | Used when |
| — | Used when |
|
| Remote embedding model name |
|
| Vector dimensionality |
| — | Enables |
Note on the local embedding fallback: it's a deterministic
hashing-trick bag-of-words vector — good enough to demo hybrid ranking and
run fully offline, but it won't catch deep paraphrases the way a real
embedding model will (e.g. it may not recognize "I prefer TypeScript" and
"I love typed JS" as near-duplicates). For real semantic quality in
production, point EMBEDDING_PROVIDER=openai at a real embeddings
endpoint.
Tools exposed
Tool | Maps to PRD section 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Section 9 automatic extraction, requires |
Resources: memory://stats, memory://recent, memory://important.
Ranking formula (PRD section 16)
final = 0.45 * semantic + 0.25 * importance + 0.15 * recency + 0.10 * frequency + 0.05 * pinrecencydecays exponentially with a ~30 day half-life.frequencyis a log-scaled function of access count (capped so heavy repeat access doesn't dominate).pinis a flat boost for pinned memories.
Tune the weights in src/memoryEngine.ts (WEIGHTS) once you have real
usage data — the PRD flags these defaults as a starting point, not a final
answer.
Deduplication
On memory_add, the new memory's embedding is compared against existing
memories in the same namespace. Above a 0.93 cosine-similarity threshold,
the call updates the existing memory (merging tags/entities, raising
importance) instead of inserting a duplicate. Threshold and dedup scope
live in src/memoryEngine.ts.
What's implemented vs. deferred from the PRD
Implemented (MVP, section 28): persistent storage, hybrid search,
importance/recency/frequency/pin ranking, CRUD, namespaces, relationships,
memory.chat_context, JSON/Markdown import-export, provider-agnostic
embeddings.
Deferred (sections 24–25, "future/nice-to-have"): contradiction detection beyond simple dedup, memory aging/compression/reflection, multimodal memories (voice/image/PDF), third-party syncs (GitHub, Notion, Slack, Calendar, etc.), pgvector/Postgres backend, encryption-at-rest, multi-tenant auth (JWT/OAuth) — the current server assumes a single trusted local client per the typical MCP desktop-app deployment model.
Extending to Postgres + pgvector
The MemoryDB class in src/db.ts is the only place that talks to
storage. To move to Postgres/pgvector for multi-user or team deployments,
reimplement that class against pg with a vector column and an ANN
index, keeping the same method signatures — nothing else in the codebase
needs to change.
Project layout
src/
types.ts shared types (MemoryRecord, SearchResult, etc.)
db.ts SQLite storage layer (node:sqlite)
embeddings.ts provider-agnostic embedding layer + local fallback
extraction.ts optional Anthropic-powered fact extraction
memoryEngine.ts ranking, search, dedup, chat_context, import/export
server.ts MCP tool + resource registration
index.ts stdio entrypointAvailable Tools
13 toolsmemory_addAdd MemoryB
Stores a new memory (fact, preference, project detail, task, knowledge, relationship, or conversation note). Automatically deduplicates against near-identical existing memories.
Inputs: content (required), tags, type, pinned, +5 more.
memory_chat_contextGet Chat ContextA
Returns the optimal set of memories to inject as context for the current prompt, respecting a character budget. This is typically the first tool an assistant calls at the start of a turn.
Inputs: prompt (required), user_id, max_chars, namespace, +1 more.
memory_deleteDelete MemoryB
Permanently deletes a memory by id.
Inputs: id (required), user_id.
memory_exportExport MemoriesC
Exports all memories for a user as JSON or Markdown.
Inputs: format, user_id.
memory_extractExtract & Store MemoriesA
Runs automatic fact extraction (PRD section 9) over a chunk of conversation text using an LLM, then stores each memory-worthy fact found. Requires ANTHROPIC_API_KEY to be configured on the server; otherwise returns an error explaining to use memory_add manually.
Inputs: text (required), user_id, namespace.
memory_importImport MemoriesB
Imports memories from a JSON array or Markdown bullet list.
Inputs: data (required), format (required), user_id, namespace.
memory_listList MemoriesB
Lists memories, optionally filtered by namespace/type, newest and pinned first.
Inputs: type, limit, offset, user_id, +1 more.
memory_pinPin MemoryC
Pins a memory so it gets a ranking boost and is protected from casual pruning.
Inputs: id (required), user_id.
memory_searchSearch MemoryC
Hybrid ranked search over stored memories (semantic similarity + importance + recency + frequency + pin boost).
Inputs: query (required), tags, type, limit, +2 more.
memory_statsMemory StatsB
Returns aggregate stats: total memories, breakdown by namespace/type, top entities, pinned count.
Inputs: user_id.
memory_unpinUnpin MemoryC
Removes the pin from a memory.
Inputs: id (required), user_id.
memory_updateUpdate MemoryD
Updates fields on an existing memory.
Inputs: id (required), tags, type, pinned, +6 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Each tool targets a distinct memory operation: add, search, context injection, update, delete, list, graph lookup, pin/unpin, stats, export/import, and extraction. The closest overlap is between search, chat_context, and list, but their descriptions clearly differentiate hybrid ranking, budget-aware context selection, and filtered enumeration. No two tools appear to do the same thing.
All tools use a consistent memory_ prefix with snake_case, and most follow a verb pattern such as add, search, update, delete, list, pin, unpin, stats, export, import, extract. The only minor deviation is memory_chat_context, which is a noun phrase rather than a verb, but it remains readable and consistent enough.
With 13 tools, the set is well within the typical 3–15 range and each tool covers a meaningful, non-redundant part of the memory lifecycle. There is no obvious filler or missing high-level operation that would suggest an unbalanced count.
The surface covers full CRUD (add, update, delete, list), retrieval (search, chat_context, related), lifecycle management (pin/unpin), observability (stats), and data portability (export/import/extract). No major operational gaps are apparent for a memory server, and dead ends are avoided by including bulk import and automated extraction.
Related MCP Connectors
Persistent personal memory for AI assistants — save, search, and recall across every MCP client.
Persistent, portable memory for AI assistants — your private memory graph, from any MCP client.
Persistent memory for AI assistants. Save once; recall from Claude, ChatGPT, or any MCP client.
Hosted memory for AI agents over MCP. One memory shared by all your agents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenancePersistent semantic memory server for AI assistants via MCP, enabling long-term context retention and semantic search across conversations.12MIT
- AlicenseAqualityBmaintenanceA local memory engine any AI tool can use.101,312 npm3MIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server for managing persistent AI memory using hybrid search (keyword + semantic vector) with SQLite storage and offline-first local embeddings.-
- FlicenseNot gradedqualityCmaintenancePersistent memory MCP server for AI agents that stores, recalls, and searches conversation history, key-value context, and long-term entries across sessions with semantic search and FIFO queues.98 npm1-