A persistent memory MCP server for AI coding agents.
Mind Keg MCP
A persistent memory MCP server for AI coding agents. Stores atomic learnings — debugging insights, architectural decisions, codebase conventions — so every agent session starts with relevant institutional knowledge.
Problem
AI coding agents (Claude Code, Cursor, Windsurf) lose context between sessions. Hard-won insights are forgotten the moment a conversation ends. Developers repeatedly re-explain the same things; agents repeatedly make the same mistakes.
Mind Keg solves this with a centralized, persistent brain that any MCP-compatible agent can query and contribute to.
How It Works
Mind Keg implements a RAG (Retrieval-Augmented Generation) pattern for AI coding agents:
- Retrieval — Agent searches the brain for relevant learnings using semantic or keyword search
- Augmentation — Retrieved learnings are injected into the agent's conversation context
- Generation — The agent responds with awareness of past discoveries and decisions
Unlike traditional RAG systems that chunk large documents, Mind Keg stores pre-curated atomic learnings (max 500 chars each). No chunking strategy needed — each learning IS the retrieval unit. The agent controls both retrieval and storage, creating a feedback loop where knowledge improves over time.
Features
- Store and retrieve atomic learnings (max 500 chars, one insight per entry)
- Semantic search with three provider options:
- FastEmbed (free, local, ONNX-based —
BAAI/bge-small-en-v1.5, 384 dims) - OpenAI (paid, best quality —
text-embedding-3-small, 1536 dims) - None (FTS5 keyword fallback — zero external dependencies)
- FastEmbed (free, local, ONNX-based —
- Six categories:
architecture,conventions,debugging,gotchas,dependencies,decisions - Free-form tags and group linking
- Three scoping levels: repository-specific, workspace-wide, and global learnings
- Dual transport: stdio (local) + HTTP+SSE (remote)
- API key authentication with per-repository access control
- SQLite storage (zero dependencies, zero config)
- Import/export for backup and migration
- Enterprise security: encryption at rest, audit logging, TTL/data retention, Prometheus monitoring, rate limiting, content integrity verification
Quick Start
One-command setup
npx mindkeg-mcp init
This auto-detects your agent (Claude Code, Cursor, Windsurf), writes the MCP config, copies agent instructions, and runs a health check. That's it — open your agent and start coding.
Options:
npx mindkeg-mcp init --agent cursor # Target a specific agent
npx mindkeg-mcp init --no-instructions # Skip copying AGENTS.md
npx mindkeg-mcp init --no-health-check # Skip the health check
init is idempotent — safe to run multiple times. It merges with existing configs and never overwrites.
Manual setup
If you prefer to configure manually, or need HTTP mode:
Click to expand manual setup instructions
Install
npm install -g mindkeg-mcp
Create an API key
mindkeg api-key create --name "My Laptop"
# Displays the key ONCE — save it securely
# mk_abc123...
Connect your AI agent
Mind Keg works with any MCP-compatible AI coding agent. Choose your setup:
Claude Code — Add to ~/.claude.json or your project's .claude/mcp.json:
{
"mcpServers": {
"mindkeg": {
"command": "mindkeg",
"args": ["serve", "--stdio"],
"env": {
"MINDKEG_API_KEY": "mk_your_key_here"
}
}
}
}
Cursor — Add to .cursor/mcp.json or global settings:
{
"mcpServers": {
"mindkeg": {
"command": "mindkeg",
"args": ["serve", "--stdio"],
"env": {
"MINDKEG_API_KEY": "mk_your_key_here"
}
}
}
}
Windsurf — Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"mindkeg": {
"command": "mindkeg",
"args": ["serve", "--stdio"],
"env": {
"MINDKEG_API_KEY": "mk_your_key_here"
}
}
}
}
HTTP mode (any MCP client):
MINDKEG_API_KEY=mk_your_key mindkeg serve --http
# Listening on http://127.0.0.1:52100/mcp
{
"mcpServers": {
"mindkeg": {
"type": "http",
"url": "http://127.0.0.1:52100/mcp",
"headers": {
"Authorization": "Bearer mk_your_key_here"
}
}
}
}
Other MCP-compatible agents — Mind Keg works with any agent that supports the Model Context Protocol — including Codex CLI, Gemini CLI, GitHub Copilot, and more. Use the stdio config above adapted to your agent's MCP settings format.
Add Mind Keg instructions to your repository
Copy templates/AGENTS.md to the root of any repository where you want agents to use Mind Keg.
AGENTS.md is the industry standard supported by 20+ AI tools (Cursor, Windsurf, Codex, Gemini CLI, GitHub Copilot, etc.).
Claude Code only: Claude Code doesn't auto-load `AGEN
Tools (2)
searchSearch the brain for relevant learnings using semantic or keyword search.storeStore an atomic learning insight.Environment Variables
MINDKEG_API_KEYrequiredAPI key for authenticationConfiguration
{
"mcpServers": {
"mindkeg": {
"command": "mindkeg",
"args": ["serve", "--stdio"],
"env": {
"MINDKEG_API_KEY": "mk_your_key_here"
}
}
}
}