Skip to content

MCP Server Setup

YantrikDB MCP gives any MCP-compatible AI agent persistent cognitive memory across sessions. Install once, add 3 lines of config, and your agent auto-recalls context, auto-remembers decisions, and auto-detects contradictions — no prompting needed.

Terminal window
pip install yantrikdb-mcp

Add to your MCP client’s configuration:

{
"mcpServers": {
"yantrikdb": {
"command": "yantrikdb-mcp"
}
}
}

Same format — add the yantrikdb server to your MCP settings. The server communicates via stdio, compatible with any MCP client.

VariableDefaultDescription
YANTRIKDB_DB_PATH~/.yantrikdb/memory.dbDatabase file path
YANTRIKDB_EMBEDDING_MODELall-MiniLM-L6-v2Sentence-transformers model
YANTRIKDB_EMBEDDING_DIM384Embedding dimensions

The MCP server exposes 17 cognitive memory tools:

ToolDescription
rememberStore a memory with importance, domain, valence, and certainty
recallSearch memories by semantic similarity with filters (domain, source, type)
recall_refineRefine a low-confidence recall with a follow-up query
bulk_rememberStore multiple memories at once (efficient for summaries)
get_memoryRetrieve a specific memory by ID
forgetTombstone a memory permanently
correctFix an incorrect memory (preserves history, transfers relationships)
update_importanceAdjust a memory’s importance score
ToolDescription
relateCreate entity relationships (e.g., “Alice manages backend team”)
entity_edgesGet all relationships for an entity
search_entitiesFind entities by name pattern
ToolDescription
thinkRun consolidation + conflict detection + pattern mining
conflictsList detected contradictions
conflict_resolveResolve a contradiction (keep_a, keep_b, merge, keep_both)
recall_feedbackImprove retrieval quality over time
triggersGet proactive insights, warnings, and suggestions
ToolDescription
health_checkVerify the server is operational
statsGet memory engine statistics

The server includes built-in instructions that teach the agent when and how to use memory:

  1. Auto-recall — at conversation start, the agent searches memory for relevant context
  2. Auto-remember — decisions, preferences, people, and project context are stored automatically
  3. Auto-relate — entity relationships are created as they’re discovered
  4. Consolidationthink() merges redundant memories, detects contradictions, mines patterns
  5. Correction — when the user corrects a fact, the old memory is tombstoned and a corrected version created

File-based approaches (CLAUDE.md, memory files) load everything into context every conversation. YantrikDB recalls only what’s relevant.

MemoriesFile-BasedYantrikDBSavings
1001,770 tokens69 tokens96%
5009,807 tokens72 tokens99.3%
1,00019,988 tokens72 tokens99.6%
5,000101,739 tokens53 tokens99.9%

Selective recall cost is O(1). File-based is O(n). At 500 memories, file-based exceeds 32K context windows. At 5,000, it doesn’t fit anywhere. YantrikDB stays at ~70 tokens with precision that improves as you add more memories.

Run the benchmark: python benchmarks/bench_token_savings.py