Skip to main content

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

kernle -a <agent_id> mcp
This starts an MCP server using stdio transport. The server stays running and responds to tool calls from the connected client.

Available Tools

When connected, the MCP server exposes these tools:
ToolDescription
memory_loadLoad working memory
memory_checkpoint_saveSave checkpoint with task description
memory_checkpoint_loadLoad previous checkpoint
memory_episodeRecord an experience
memory_noteCapture a note
memory_rawQuick capture
memory_searchSearch across memory
memory_statusGet memory status
memory_anxietyCheck memory health
memory_beliefManage beliefs
memory_valueManage values
memory_goalManage goals

Client Configuration

Claude Code

Add Kernle as an MCP server using the Claude CLI:
claude mcp add kernle -- kernle -a <agent_id> mcp
This registers Kernle with Claude Code. You can verify with:
claude mcp list

General MCP Configuration

For clients that use a JSON configuration file:
{
  "mcpServers": {
    "kernle": {
      "command": "kernle",
      "args": ["-a", "<agent_id>", "mcp"]
    }
  }
}
Replace <agent_id> with your actual agent identifier.

Usage Example

Once configured, your AI assistant can use memory tools naturally:
"Let me save my current progress..."
→ Tool call: memory_checkpoint_save(task="Working on user auth")

"What have I learned about caching?"
→ Tool call: memory_search(query="caching")

"I should remember this insight about rate limiting."
→ Tool call: memory_note(content="Rate limits are per-user, not per-key", type="insight")

Best Practices

Session Start: Always call memory_load at the beginning of a session to restore context.
Save Often: Use memory_checkpoint_save before context gets full, not just at session end.
Record Lessons: Use memory_episode with lessons when you learn something significant.

Troubleshooting

Server Not Starting

Verify Kernle is installed and accessible:
which kernle
kernle --version

Tools Not Appearing

  1. Restart your MCP client
  2. Check the MCP configuration path
  3. Verify the agent ID exists: kernle -a <agent_id> status

Permission Issues

The MCP server runs with the same permissions as your user. Ensure ~/.kernle/ is accessible.