Agent memory & knowledge graphs (MCP)
Agent memory & knowledge graphs (MCP)
LessDB ships an embedded, durable memory tier for agents: linked context notes, RAM tables with point lookups, and an openCypher subset — all exposed through the same MCP server as the SQL database. One process replaces the "context vault + graph DB + vector store" stack.
Start the MCP server
// claude_desktop_config.json / codex config — point at the less binary
{ "mcpServers": { "lessdb": { "command": "less", "args": ["mcp", "--dir", "~/.less"] } } }
Tools your agent gets
| group | tools | what they do |
|---|---|---|
| database | less_query, less_explain, less_schema, less_stats, less_tables, less_optimize | full SQL over MergeTree/SharedMergeTree tables |
| context | context_put, context_find, context_link, context_neighbors, context_path | titled/tagged notes, typed links, BFS neighborhoods, shortest paths |
| memory | memory_create, memory_insert, memory_sql, memory_get, memory_compact | Arrow-backed RAM tables with a hash PK index — O(1) latest-row lookups |
| graph | less_cypher | MATCH with variable-length patterns, WHERE, aggregation, CREATE/DELETE/SET |
Example session
agent: less_query → SELECT count(*) FROM incidents WHERE status='open'
agent: context_put → key "incident/42", title "DB failover", tags ["incident","postmortem"]
agent: context_link → "incident/42" -[follows_up]-> "incident/39"
agent: context_path → "incident/39" → "incident/42" (shortest path)
agent: memory_create → sessions(id Int64, user Utf8, ts Timestamp)
agent: memory_get → key: sessions/id = 7 (O(1), latest row wins)
agent: less_cypher → MATCH (a:incident)-[:depends_on*1..3]->(b) RETURN a.id, b.id
Properties that make it agent-safe
- Durable + crash-safe: every mutation snapshots atomically
(tmp + rename); agents can be killed and resume.
- Tenant-scoped:
less mcp --tenant <name>isolates each agent's
contexts/memory/vectors under <data_dir>/tenants/<name>/ — SQL tools stay on the shared engine.
- Same data, two front doors: humans get SQL/TUI; agents get tools —
over the same engine, so agent findings are immediately queryable by people and vice versa.
Full API in Getting started and the architecture doc's in-memory tier section.