MCP Server
Give any AI agent persistent memory across sessions, projects, and restarts. One server, 32 tools, zero configuration.
One command. No config files to edit.
Install the binary and run the setup command for your client. The server writes the config file for you.
# Install Rust: https://rustup.rs $ cargo install mentedb-mcp $ mentedb-mcp setup copilot # or claude, cursor, vscode
The setup command auto-detects your OS, finds the config path, and writes the MCP server entry.
Why use the MCP server?
Not just a memory store — a full cognitive layer that makes your agent smarter over time.
Zero Config
Local Candle embeddings run on-device. No API keys, no external services, no network calls for core operations.
Persistent Memory
Memories survive across sessions, projects, and restarts. Your agent picks up exactly where it left off.
Belief Tracking
Graph-based supersession prevents stale information from poisoning context. Contradictions are detected and flagged automatically.
Delta Context
90.7% reduction in memory retrieval tokens over 20 turns. Only new and changed memories are sent in full — the rest are summarized.
Everything an agent needs
From basic CRUD to cognitive signals, the MCP server exposes the full MenteDB surface area over the standard MCP protocol.
Core Memory
Store, retrieve, search, and manage individual memories.
store_memoryStore a new memory with type, tags, and metadata
get_memoryRetrieve a specific memory by UUID
recall_memoryRecall a memory and boost its salience
search_memoriesSemantic similarity search across all memories
relate_memoriesCreate typed edges between memories
forget_memoryDelete a single memory
forget_allWipe all memories (requires confirmation)
ingest_conversationExtract structured memories from raw conversation text
Context Assembly
Build optimized context windows within a token budget.
assemble_contextAssemble an optimized context window with delta annotations for a given query and token budget
Knowledge Graph
Traverse relationships, find paths, and propagate beliefs.
get_relatedFind all memories related to a given memory
find_pathShortest path between two memories in the graph
get_subgraphExtract local subgraph within N hops
find_contradictionsFind memories that contradict a given memory
propagate_beliefPropagate confidence changes through the graph
Consolidation
Merge, compress, decay, and archive memories over time.
consolidate_memoriesCluster similar memories and merge them
apply_decayApply salience decay based on time and access
compress_memoryExtract key sentences, remove filler
evaluate_archivalEvaluate memories for archival or deletion
extract_factsExtract structured subject-predicate-object facts
gdpr_forgetGDPR-compliant data deletion with audit log
Cognitive
Pain signals, phantom detection, trajectory tracking, and interference.
record_painRecord a negative experience for future warnings
detect_phantomsScan for entities referenced but not in memory
resolve_phantomMark a knowledge gap as resolved
record_trajectoryTrack conversation trajectory for predictions
predict_topicsPredict likely next topics based on trajectory
detect_interferenceFind memories similar enough to cause confusion
check_streamCheck LLM output against known facts
write_inferenceRun write-time inference on a memory
register_entityRegister an entity for phantom detection
Pipeline
Full-turn processing, cognitive state, and database stats.
process_turnFull pipeline: search → extract → store → infer in one call
get_cognitive_statePain signals, phantoms, and trajectory predictions
get_statsMemory count, edge count, and type breakdown
Client Configuration
The setup command handles this automatically, but here are the configs if you prefer manual setup. Use alwaysAllow to skip per-tool approval prompts.
Auto Setup
$ mentedb-mcp setup copilot
Embedding Provider
MenteDB uses local Candle embeddings by default — no API keys needed. For higher accuracy, set an OpenAI or Anthropic key:
$ export OPENAI_API_KEY=sk-... # or $ export ANTHROPIC_API_KEY=sk-ant-...
The server auto-detects the key and switches provider. Remove the variable to revert to local embeddings.
Found a bug or have a feature request? Open an issue on GitHub
Manual Config
{
"mcpServers": {
"mentedb": {
"command": "mentedb-mcp",
"args": ["--data-dir", "./agent-memory"]
}
}
}How it works
One tool call per turn. The server handles the rest.
Agent calls process_turn
Once per conversation turn, the agent sends the user message and its response. The server searches for relevant context and returns it.
Server stores & searches
The conversation is stored as searchable episodic memory with Candle embeddings. Pain signals and trajectory are tracked automatically.
LLM stores important facts
The LLM recognises preferences, decisions, and corrections during the conversation and calls store_memory with the right type and tags. No second model needed — the conversation LLM is the extraction engine.
Context returned with warnings
Relevant past context, pain warnings, and topic predictions — all in one round trip. Auto-maintenance (decay, archival, consolidation) runs in the background.
Built-in agent instructions
The setup command injects instructions that teach your LLM how to use MenteDB. No prompt engineering required.
process_turn — every turn
Called automatically on every conversation turn. Searches for relevant past context, stores the conversation as episodic memory, checks pain signals, and tracks the conversation trajectory. This is the memory loop.
store_memory — when it matters
The LLM calls this when it notices important information — preferences, decisions, corrections, procedures. The conversation LLM is the extraction engine. No second model needed.
What the setup command adds to your agent
① process_turn every turn — searches context, stores episodic memory, checks pain signals
② store_memory when the LLM sees preferences, decisions, corrections, or procedures
③ Memory types — semantic, episodic, procedural, correction, anti_pattern
④ Tags — project names, topics, context labels for structured recall
These instructions are written to a copilot-instructions.md or equivalent file for your client. The LLM reads them at session start and follows them automatically.
Ready to give your agent a mind?
Install the MCP server and start building agents that remember.