Engram
Engram
A persistent memory server for AI agents, implemented as an MCP (Model Context Protocol) server. Stores structured notes/memories in a local SQLite database with full-text search, tagging, categorisation, TTL expiration, directional graph relationships, and full change history.
See CHANGELOG.md for recent implementation updates and release notes.
Features
31 MCP tools full CRUD, search, bulk ops, import/export, stats, tag utilities, graph relations, versioning
Grouped discovery
list_tool_groupshelps understand each tool’s primary function blockClear MCP UX tool descriptions are automatically prefixed by function group (
Create ·,Read ·,Update ·,Delete ·,Graph ·,Ops/Admin ·)CLI
engram-clifor querying and managing memories from the terminalSQLite + FTS5 fast full-text search with
any/all/nearmodesGraph relations link memories with typed edges (
caused,references,supersedes,related)Change history every create/update/delete is tracked automatically; restore any previous version
TTL optional
expires_aton every memory; auto-purge on startupRich filtering by category, tag, metadata key/value, date ranges, sort order
ESLint + Prettier enforced code style
492 tests full coverage via Vitest (
npm test)
Requirements
Node.js 18+
A host that supports MCP servers (VS Code with Copilot, Claude Desktop, etc.)
Installation
git clone https://github.com/Jacksini/engram-mcp.git
cd engram-mcp
npm install
npm run buildThe compiled server is at build/index.js and the CLI at build/cli.js.
Configuration
VS Code (Copilot / MCP extension)
Add to your mcp.json (Ctrl+Shift+P MCP: Open User Configuration):
{
"servers": {
"engram-mcp": {
"type": "stdio",
"command": "node",
"args": ["C:/path/to/engram-mcp/build/index.js"]
}
}
}Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"engram-mcp": {
"command": "node",
"args": ["C:/path/to/engram-mcp/build/index.js"]
}
}
}Custom database path
By default the database is stored at ~/.engram/memories.db. Override it with:
"env": { "ENGRAM_DB_PATH": "C:/custom/path/memories.db" }CLI
engram-cli lets you interact with the memory database from the terminal without needing an MCP client.
# Install globally (after npm run build)
npm link
# Or run directly
node build/cli.js <command> [options]CLI commands
engram-cli [--db <path>] [--project <name>] [--json] <command> [args] [options]
COMMANDS
search <query> FTS search (--limit, --mode, --category, --tag)
list List memories (--category, --tag, --limit, --sort)
get <id> Get a memory by UUID
save <content> Save a new memory (--category, --tags, --metadata, --expires)
update <id> Update a memory (--content, --category, --tags, --metadata)
delete <id> [--yes] Delete a memory (asks for confirmation unless --yes)
stats Database statistics
backup Create a timestamped backup of the database
link <from_id> <to_id> Link two memories (--relation)
unlink <from_id> <to_id> Remove a link
graph [--include-orphans] Show memory graph (--relation, --mermaid-only)
get-related-deep <id> Multi-hop graph traversal (--max-depth, --relation, --limit)
suggest-links [id] Suggest possible links (--limit)
history <id> Change history for a memory (--limit)
restore <id> <history_id> Restore a memory to a previous version
list-projects List projects with memory counts
migrate-to-project <tag> <source_project> <project>
Move memories with a specific tag from source to target project
help Show helpExamples
# Search and show results as JSON
engram-cli search "sqlite fts5" --limit 5 --json
# Search within a specific project
engram-cli --project engram-mcp search "wal checkpoint" --limit 5
# List recent code memories
engram-cli list --category code --limit 10
# Save a new memory with tags
engram-cli save "Use json_each() to query JSON arrays in SQLite" --category code --tags "sqlite,json"
# Show full memory
engram-cli get abc12345-...
# Show the memory graph as Mermaid diagram
engram-cli graph --mermaid-only
# Multi-hop traversal and link suggestions
engram-cli get-related-deep abc12345-... --max-depth 3 --limit 20
engram-cli suggest-links abc12345-... --limit 10
# Project utilities
engram-cli list-projects
engram-cli migrate-to-project engram-mcp default engram-mcp
# See history of a memory and restore a version
engram-cli history abc12345-...
engram-cli restore abc12345-... 42MCP Tools reference
Tool map by group
Group | Tools |
|
|
|
|
|
|
|
|
|
|
|
|
Tip: use
list_tool_groupsfrom your MCP client to get this grouping as structured JSON.
Create
Tool | Description |
| Save a single memory |
| Save up to 50 memories in one transaction (supports |
Common input fields:
Field | Type | Required | Description |
|
| Text content to store | |
|
|
| |
|
| Arbitrary labels for filtering | |
|
| Any JSON key/value pairs | |
|
| Auto-expiration. |
Read
Tool | Description |
| Fetch a single memory by UUID |
| Fetch multiple memories by UUID array |
| Paginated listing with filters and sort |
| Full-text search (FTS5) with filters |
| Compact summary grouped by category ideal for session bootstrapping |
list_memories / search_memories common filters
Parameter | Description |
| Filter by category |
| Filter by tag |
| Filter by a JSON metadata field |
| Date range on |
| Date range on |
|
|
| Pagination |
| Return only |
| Truncate content to N characters |
search_memories extra parameters
Parameter | Description |
| Search terms |
|
|
| Max token distance for |
get_context_snapshot parameters
Parameter | Default | Description |
| 3 | Recent memories per category |
| Truncate content to N characters | |
|
| Include tag frequency index |
Update
Tool | Description |
| Update one memory (partial only supplied fields change) |
| Update up to 50 memories in one transaction |
Delete
Tool | Description |
| Delete a single memory by UUID |
| Delete up to 50 memories by UUID array |
Graph relations
Memories can be linked with directional, typed edges forming a queryable graph.
Tool | Description |
| Create or update (upsert) a link between two memories |
| Remove a link returns |
| Update the relation type of an existing link (error if link doesn't exist) |
| Retrieve memories linked to/from a given memory |
| List raw edges |
| Full graph as |
Relation types
Value | Meaning |
| Generic association (default) |
| The origin memory caused/led to the target |
| The origin memory cites or references the target |
| The origin memory replaces/obsoletes the target |
get_graph parameters
Parameter | Default | Description |
|
| Also include memories with no links |
| Restrict to a single relation type |
Example output:
{
"node_count": 3,
"edge_count": 2,
"nodes": [...],
"edges": [...],
"mermaid": "flowchart LR\n nabcd1234[\"Memory A (code)\"] -- caused --> nef567890[\"Memory B (decision)\"]"
}Change history & restore
Every memory change (create, update, delete) is automatically recorded in the memory_history table via SQLite triggers.
Tool | Description |
| Returns all history entries for a memory, newest first |
| Restores a memory to a previous snapshot by |
get_history parameters
Parameter | Default | Description |
| UUID of the memory | |
| 50 | Max entries (1200) |
| 0 | Pagination offset |
Example entry:
{
"history_id": 42,
"memory_id": "...",
"operation": "update",
"content": "Previous content",
"category": "code",
"tags": ["sqlite"],
"metadata": {},
"expires_at": null,
"changed_at": "2026-02-28 02:00:00"
}restore_memory parameters
Parameter | Description |
| UUID of the memory to restore |
| Numeric ID from |
Note: The restore is tracked as a new
updateentry in history. Deleted memories cannot be restored this way recreate them fromget_historydata usingsave_memory.
Import / Export
Tool | Description |
| Export all (or filtered) memories as a JSON array |
| Import memories. |
Stats & Maintenance
Tool | Description |
| Totals by category, top tags, oldest/newest, avg content length |
| Delete all memories with a past |
| SQLite |
| Copy the database to |
| List all MCP tools grouped by main function (Create/Read/Update/Delete/Graph/Ops) |
Auto-purge: expired memories are removed automatically on every server startup.
Tag utilities
Tool | Description |
| Rename a tag across all memories in a single transaction. Auto-deduplicates. |
Categories
Value | Intended use |
| Miscellaneous notes |
| Code snippets, patterns, implementations |
| Architectural or product decisions |
| Bug reports, root causes, fixes |
| System design, structure, diagrams |
| Coding standards, naming conventions, rules |
Development
npm run build # compile TypeScript build/
npm run build:watch # watch mode
npm run typecheck # type-check only (no emit)
npm test # run all 493 tests
npm run test:watch # interactive watch mode
npm run lint # ESLint
npm run lint:fix # ESLint with auto-fix
npm run format # Prettier
npm run format:check # Prettier check (CI-friendly)Project structure
src/
index.ts # MCP server entry point
cli.ts # CLI entry point (engram-cli)
db/
database.ts # MemoryDatabase class (all SQL logic)
schema.ts # SQLite DDL + triggers + migrations
tools/ # One file per MCP tool (31 operativas + utilidades internas)
types/
memory.ts # All TypeScript interfaces and types
tests/
db/
database.test.ts # DB-layer unit tests
tools/ # Tool-layer tests (one file per tool)
helpers/
test-db.ts # createTestDb() in-memory DB factory
build/ # Compiled output (git-ignored)Schema migrations
Version | Changes |
v1 | Added |
v2 | Added |
v3 | Added |
v4 | Added |
v5 | Added |
v6 | Added |
Environment variables
Variable | Default | Description |
|
| Path to the SQLite database file |
|
| Default project namespace when no |
License
ISC
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Jacksini/engram-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server