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.
A persistent memory MCP server for AI coding agents — stores, searches, and retrieves atomic learnings so agents retain knowledge across sessions.
ดาว
11
เครื่องมือ
—
อัปไทม์
—
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)
That's it. This installs Mind Keg globally for your AI agent (Claude Code, Cursor, Windsurf). Open any project and your agent has persistent memory -- no API keys, no per-project setup.
For Claude Code, a SessionStart hook is also installed -- your agent loads prior knowledge automatically at the start of every session.
Options:
npx mindkeg-mcp init --agent cursor # Target a specific agent
npx mindkeg-mcp init --project # Per-project setup instead of global
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:
Install
npm install -g mindkeg-mcp
Create an API key (only needed for HTTP mode)
mindkeg api-key create --name "My Laptop"
# Displays the key ONCE — save it securely
# mk_abc123...
API keys are only required for HTTP transport. stdio transport (used by Claude Code, Cursor, Windsurf local setups) is auth-free.
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:
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 AGENTS.md natively. Add @AGENTS.md to your CLAUDE.md to bridge it.
MCP Tools
8 consolidated tools (primary API):
Tool
Description
get_context
Retrieve relevant knowledge — session primer, task-scoped context, or semantic search (replaces get_context, get_relevant_context, search_learnings)
store
Save knowledge — learning, decision, finding, or gotcha (replaces store_learning, store_decision, store_finding, store_gotcha)
Close out a decision or finding (replaces supersede_decision, resolve_finding)
complete_run
Record a completed work session
query
List knowledge by type — decisions, findings, gotchas, or runs (replaces get_decisions, get_open_findings, get_gotchas, get_run_history)
list_scopes
List repositories and workspaces with counts (replaces list_repositories, list_workspaces)
relate_learnings
Create typed relationships between learnings
Backwards-compatible aliases: All 19 old tool names (store_learning, search_learnings, update_learning, deprecate_learning, flag_stale, delete_learning, merge_learnings, store_decision, get_decisions, supersede_decision, store_finding, resolve_finding, get_open_findings, store_gotcha, get_gotchas, get_run_history, get_relevant_context, list_repositories, list_workspaces) are registered as aliases that delegate to the same service methods. They will be removed in the next major version.
CLI Commands
# Global setup (one-time) — writes MCP config, SessionStart hook, runs migrations
mindkeg init
mindkeg init --agent cursor # Target a specific agent (default: claude-code)
mindkeg init --project # Per-project setup instead of global (optional)
# Database statistics
mindkeg stats
mindkeg stats --json
# Start in stdio mode (for local agent connections)
mindkeg serve --stdio
# Start in HTTP mode (for remote connections)
mindkeg serve --http
# API key management
mindkeg api-key create --name "My Key"
mindkeg api-key create --name "Team Key" --repositories /repo/a /repo/b
mindkeg api-key list
mindkeg api-key revoke <prefix>
# Database
mindkeg migrate
# Near-duplicate detection (backfill existing learnings)
mindkeg dedup-scan
mindkeg dedup-scan --dry-run
# Backup and restore
mindkeg export --output backup.json
mindkeg import backup.json --regenerate-embeddings
# Data retention
mindkeg purge --older-than 90 # Purge learnings older than 90 days
mindkeg purge --repository /path/repo # Purge all learnings for a repo
mindkeg purge --all --confirm # Purge everything (requires --confirm)
# Encryption at rest
mindkeg encrypt-db # Encrypt existing database (requires MINDKEG_ENCRYPTION_KEY)
mindkeg decrypt-db # Decrypt existing database (requires MINDKEG_ENCRYPTION_KEY)
# Integrity backfill
mindkeg backfill-integrity # Compute SHA-256 hashes for legacy learnings
Configuration
Environment Variable
Default
Description
MINDKEG_SQLITE_PATH
~/.mindkeg/brain.db
SQLite database file
MINDKEG_EMBEDDING_PROVIDER
fastembed
fastembed, openai, or none
OPENAI_API_KEY
(none)
OpenAI API key (when provider=openai)
MINDKEG_HOST
127.0.0.1
HTTP server bind address
MINDKEG_PORT
52100
HTTP server port
MINDKEG_LOG_LEVEL
info
debug, info, warn, error
MINDKEG_API_KEY
(none)
API key for HTTP transport (stdio is auth-free)
Embedding providers
FastEmbed (default, free, local)
Semantic search works out of the box using FastEmbed — no API key needed, no network calls. Uses BAAI/bge-small-en-v1.5 (384 dimensions) via local ONNX Runtime. Model files are downloaded once on first use (~50MB).
Each audit entry contains: timestamp (ISO 8601), action, actor (API key prefix), resource_id, result, client transport metadata. Sensitive fields (content, embedding) are never logged.
TTL and Data Retention
Set a global default TTL or a per-learning TTL to automatically expire old entries.
export MINDKEG_DEFAULT_TTL_DAYS=365 # Expire all learnings after 1 year by default
export MINDKEG_PURGE_INTERVAL_HOURS=24 # Run purge every 24 hours (default)
Per-learning TTL overrides the global default:
{ "content": "...", "ttl_days": 30 }
Manual purge:
mindkeg purge --older-than 180 --confirm
Monitoring
HTTP transport exposes Prometheus-compatible endpoints:
GET /health → JSON: { status, version, uptime, database }
GET /metrics → Prometheus text format
Both endpoints are unauthenticated by default. Set MINDKEG_METRICS_AUTH=true to require API key auth.
A workspace learning stored under repositories/personal/ is shared across app-a and app-b but not project-x.
When searching, results include all three scopes: repo-specific + workspace + global. Each result has a scope field indicating its level.
What Makes a Good Learning?
Atomic: One insight per entry. Max 500 characters.
Actionable: What to DO or AVOID, not just what exists.
Specific: Mentions the concrete context (library, pattern, file).
Good: "Always wrap Prisma queries in try/catch — it throws on constraint violations, not returns null."
Bad: "Be careful with the database." (too vague)
Development
# Clone and install
git clone ...
npm install
# Run tests
npm test
# Build
npm run build
# Development mode (rebuilds on change)
npm run dev
# Type check
npm run typecheck
Running without external APIs
Mind Keg works fully offline by default. FastEmbed provides free, local semantic search using ONNX Runtime — no API keys or network calls required. All CRUD operations and search work out of the box.
คัดลอกคอนฟิก stdio สำหรับ Cursor, Claude Desktop, Claude Code หรือ VS Code ได้ในหน้านี้ คอนฟิกนี้ใช้การติดตั้งของผู้เผยแพร่ ไม่ใช่พร็อกซีของ PlugMCP
Mindkeg ต้องใช้ API key ไหม?
ระเบียนนี้ไม่ได้ระบุตัวแปรสภาพแวดล้อมที่จำเป็น
Mindkeg ใช้ทรานสปอร์ตแบบใด?
Mindkeg ทำงานแบบโลคัลผ่าน stdio
Mindkeg ถูกตรวจสอบล่าสุดเมื่อใด?
ตรวจสอบล่าสุดเมื่อ 2026-10-28 A persistent memory MCP server for AI coding agents — stores, searches, and retrieves atomic learnings so agents retain knowledge across sessions.