MCP Integration
Kernle provides an MCP (Model Context Protocol) server that exposes memory operations as tools for AI assistants.What is MCP?
MCP is a protocol that allows AI assistants to use external tools. When you add Kernle as an MCP server, your AI assistant gains access to memory operations like:- Loading working memory
- Saving checkpoints
- Recording episodes and notes
- Searching memory
- Managing beliefs and values
Starting the MCP Server
How Memory Works via MCP
MCP provides a protocol for AI assistants to call external tools. Kernle exposes its full memory API as MCP tools. Any MCP-compatible client — Claude Code, Claude Desktop, Cursor, custom agents — can use Kernle memory through standard tool calls.All Memory Handling is Manual
There is no automatic memory loading or saving. The client SI must call tools explicitly at each stage: Session start — Callmemory_load to restore context. This returns values, beliefs, goals, episodes, notes, checkpoint, and relationships, priority-ordered within the token budget. Without this call, the SI starts with no memory context.
During the session — Call capture tools (memory_episode, memory_note, memory_raw, etc.) as the SI works. Each call immediately persists to the local SQLite database. Nothing is buffered or batched.
Session end — Call memory_checkpoint_save to record what the SI was working on, pending items, and context for next time. This checkpoint is loaded first on the next memory_load.
Search — memory_search runs semantic search across all memory types. memory_raw_search uses FTS5 for keyword search on raw entries.
Processing — memory_process runs automated memory processing (raw entries to episodes to beliefs to values) using the bound inference model. memory_process_status shows what is pending.
What the MCP Server Does NOT Do
- Does not auto-load memory at connection time
- Does not auto-save when the client disconnects
- Does not run background maintenance or processing
- Does not push notifications about memory state
Immediate Persistence Model
Everymemory_* capture tool writes directly to the SQLite database on call. If the client crashes after calling memory_episode but before memory_checkpoint_save, the episode is still saved — only the checkpoint summary is lost. This means partial sessions are never completely lost; whatever was captured before the interruption remains in the database.
Relationship to Native Memory Systems
Kernle works alongside whatever native memory your MCP client already provides. It does not require exclusive access.Claude Code
Claude Code has two native memory mechanisms:CLAUDE.md files (static project instructions loaded at session start) and auto-memory (~/.claude/projects/.../memory/MEMORY.md, simple text notes the agent writes during sessions). Kernle provides structured, typed memory with provenance, strength decay, hierarchy, and search — capabilities that flat text files cannot offer. CLAUDE.md is still the right place for static project instructions. Auto-memory can coexist with Kernle — some users keep auto-memory for quick project notes and use Kernle for the full stratified memory system.
Claude Desktop
Claude Desktop has Projects with pinned knowledge files (static documents). It has no persistent dynamic memory between conversations. Kernle fills the gap entirely, giving the assistant memory that survives across conversations. See the Claude Desktop guide for setup.Other MCP Clients (Cursor, Custom Agents)
Kernle provides the complete memory layer. Whatever native memory the client has can coexist — Kernle does not require exclusive access and does not interfere with other memory systems.Available Tools
When connected, the MCP server exposes these tools:Core Memory Operations
memory_load Tool Details
Thememory_load tool uses priority-based budget allocation to load the most important memories within token limits.
Parameters:
Priority Ordering:
Memories are loaded by priority until the budget is exhausted:
- Checkpoint (1.00) - Always loaded first for task continuity
- Values (0.90) - Sorted by priority descending
- Beliefs (0.70) - Sorted by confidence descending
- Goals (0.65) - Sorted by recency
- Drives (0.60) - Sorted by intensity descending
- Episodes (0.40) - Sorted by recency
- Notes (0.35) - Sorted by recency
- Relationships (0.30) - Sorted by last interaction
_meta):
When using JSON format, the response includes budget metrics:
Token Estimation:
Tokens are estimated at approximately 4 characters per token, with a 1.3x safety margin for JSON serialization overhead.
Access Tracking:
Loading memories automatically records access for salience-based forgetting. This helps Kernle identify frequently-used memories that should be preserved.
Memory Capture
Playbooks are currently available via CLI only. MCP tools for playbook operations are planned for a future release.
Search & Query
Processing
List Operations
Update Operations
Suggestions
Client Configuration
Claude Code
Add Kernle as an MCP server using the Claude CLI:General MCP Configuration
For clients that use a JSON configuration file:<stack_id> with your actual stack identifier.
Usage Example
Once configured, your AI assistant can use memory tools naturally:Best Practices
Troubleshooting
Server Not Starting
Verify Kernle is installed and accessible:Tools Not Appearing
- Restart your MCP client
- Check the MCP configuration path
- Verify the stack ID exists:
kernle -s <stack_id> status
Permission Issues
The MCP server runs with the same permissions as your user. Ensure~/.kernle/ is accessible.