Skip to main content
Glama

🧠 mcp-ai-brain

Persistent memory for AI coding agents. Local-first. Zero API costs. Works everywhere.

AI agents forget everything between sessions. mcp-ai-brain fixes that.

A Model Context Protocol (MCP) server that gives your AI agent a persistent, searchable, privacy-first memory β€” powered by SQLite, FTS5, and biological-inspired decay.


✨ Features

Feature

Description

πŸ” Hybrid Search

Keyword (FTS5) + local vector embeddings via all-MiniLM-L6-v2, fused with RRF

🧬 Memory Decay

Ebbinghaus-inspired forgetting curve β€” unused memories lose relevance, critical ones never fade

πŸ“‚ Project Scoping

Memories are scoped to projects β€” your web app context stays separate from your CLI tool context

πŸ”’ Privacy-First

Everything stays on your machine. No cloud. No API calls. Your brain.db never leaves ~/.mcp-ai-brain/

⚑ Zero Cost

No embeddings API needed. Runs all-MiniLM-L6-v2 locally via @xenova/transformers (~25MB, downloads once)

πŸ€– Auto-Learning

brain_session_end extracts facts automatically from your session summary. No manual remember calls needed

🎯 Proactive Context

brain_session_start_smart detects your workspace and loads the right memories automatically

🌐 Dashboard

Built-in web dashboard at localhost:3333 β€” view, search, edit memories in real-time

πŸ”Œ Universal

Works with Claude Desktop, Cursor, Windsurf, Cline, Antigravity, and any MCP-compatible tool


Related MCP server: Thoth-Mem

πŸš€ Quick Start

Install

npm install -g mcp-ai-brain

Configure your AI tool

Add to your MCP config (e.g., claude_desktop_config.json, .cursor/mcp.json):

{
  "mcpServers": {
    "brain": {
      "command": "mcp-ai-brain"
    }
  }
}

That's it. Your AI now has a brain. 🧠


πŸ› οΈ Tools

brain_remember

Store a memory. Supports categorization, tagging, importance levels, and project scoping.

Categories: fact | decision | preference | architecture | bug | config | pattern | incident | workflow
Importance: critical (never decays) | high | normal | low

brain_recall

Retrieve memories by project, category, or importance β€” without needing a search query.

Hybrid search using keyword matching (FTS5) + local vector embeddings (all-MiniLM-L6-v2). Results fused with Reciprocal Rank Fusion β€” semantic similarity works out of the box once the model downloads (~25MB, one-time).

brain_forget

Soft-delete a memory. It's excluded from search but can be restored.

brain_session_start

Start a session β€” loads top memories for your project, runs decay maintenance, and returns context.

brain_session_end

End a session β€” records what happened and for how long.

brain_projects_*

Manage the project registry (list, upsert, get, delete).

brain_stats

Brain diagnostics β€” memory counts, category breakdown, database path, vector status.


🧬 How Decay Works

Memories follow a biological forgetting curve:

  1. Grace Period (7 days): No decay. Fresh memories stay at full strength.

  2. Active Decay: Score decreases based on importance weight and time since last access.

  3. Access Resets Clock: Every time a memory is recalled or found in search, its decay resets.

  4. Critical = Permanent: Set importance to critical and the memory never decays.

  5. Decayed β‰  Deleted: Decayed memories can be restored with brain_restore.


βš™οΈ Configuration

Environment Variable

Default

Description

BRAIN_DB_PATH

~/.mcp-ai-brain/brain.db

Custom database file location


πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        AI Agent (Claude, etc.)  β”‚
β”‚          via MCP Protocol       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚ stdio
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       mcp-ai-brain server       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ FTS5     β”‚  β”‚ MiniLM-L6v2 β”‚  β”‚
β”‚  β”‚ (keyword)β”‚  β”‚ (local vec) β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚       β”‚    RRF Fusion  β”‚        β”‚
β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚
β”‚         β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”          β”‚
β”‚         β”‚  SQLite DB  β”‚          β”‚
β”‚         β”‚  brain.db   β”‚          β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Decay Engine            β”‚   β”‚
β”‚  β”‚  (Ebbinghaus curve)      β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Auto-Learning (v1.1)    β”‚   β”‚
β”‚  β”‚  Session summary β†’ facts β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“Š What Your AI Agent Should Remember

Category

Example

decision

"We chose NextJS over Remix because of Vercel deployment simplicity"

architecture

"Auth flow: Firebase Auth β†’ Custom Claims β†’ Middleware guard"

config

"Cron schedule: */10 * * * * (every 10 min, Vercel 300s timeout)"

bug

"Safari iOS AudioContext requires user gesture β€” fixed with click handler"

pattern

"All Firestore writes use transactions for multi-tenant isolation"

preference

"User prefers dark mode UI with Inter font family"

incident

"2024-01-15: Stripe webhook double-firing caused duplicate charges"


πŸ—ΊοΈ Roadmap

  • v1.0 β€” Core memory + keyword search (FTS5) + Ebbinghaus decay engine

  • v1.1 β€” Local embeddings (all-MiniLM-L6-v2 via @xenova/transformers) + Auto-Learning + Proactive Context + Web Dashboard

  • v1.2 β€” Multi-agent support + relationship graph between memories

  • v2.0 β€” Proactive suggestions + memory consolidation + export/import


🀝 Contributing

PRs welcome! See CONTRIBUTING.md for guidelines.


πŸ“„ License

MIT β€” see LICENSE.



🌍 Built With This

Real-world projects powered by mcp-ai-brain β€” demonstrating persistent AI memory in production:

Project

What It Does

🎀 Ace Your Interviews

AI-powered real-time voice mock interviews β€” the only tool that simulates a real phone screen

πŸ“ GeoQuote.ai

Instant contractor quoting platform β€” real-time pricing intelligence for homeowners

πŸŽ„ The Funny Christmas Shop

Hilarious holiday t-shirts with AI-generated designs, updated daily

πŸ“ ChairFull.org

Office chair reviews and buying guides β€” AI-researched, human-curated

πŸ’° VaultNest.org

Personal finance guides β€” savings, investing, and financial independence

πŸš› FleetShield.org

Commercial trucking insurance guides for fleet owners

✈️ DutyPilot.org

Import duty and customs tariff guides for international shoppers

πŸ“– ManualJPro.org

Product manual library β€” user guides and instruction manuals

πŸ›’ Should I Buy It

AI buying-intent analysis β€” know before you spend

Want your project listed here? Open a PR and add it to this table.


πŸ‘€ About the Author

Built and maintained by Pravin Nawkar β€” a developer building AI-powered SaaS tools and content platforms.


Available Tools

14 tools
brain_auto_learnB

[v1.1] Manually trigger auto-learning from text. Extracts facts, classifies categories/importance, handles conflicts and deduplication.

Inputs: text (required), project.

brain_forgetA

Soft-delete a memory by ID. Can be restored later.

Inputs: id (required), reason.

brain_projects_deleteA

Delete a project. Memories become unscoped (not deleted).

Inputs: id (required).

brain_projects_getC

Get details for a specific project.

Inputs: id (required).

brain_projects_listB

List all registered projects with memory counts.

Inputs: no named parameters.

brain_projects_upsertC

Create or update a project.

Inputs: id (required), name (required), description.

brain_recallC

Retrieve memories by project, category, or importance. Returns recent, high-relevance memories.

Inputs: limit, project, category, importance, +1 more.

brain_rememberB

Store a memory in the brain. Use this to persist facts, decisions, architecture patterns, configs, bugs, workflows, and preferences across sessions.

Inputs: content (required), tags, project, category, +1 more.

brain_restoreA

Restore a forgotten or decayed memory to active status.

Inputs: id (required).

brain_session_endB

End a session. Records summary, auto-extracts facts from summary (v1.1 Auto-Learning), and stores them as memories.

Inputs: session_id (required), project, summary.

brain_session_startA

Start a basic session. Loads top memories, runs decay maintenance. Use brain_session_start_smart for workspace-aware context.

Inputs: limit, project.

brain_session_start_smartA

[v1.2] Smart session start with workspace auto-detection. Detects project from workspace path, loads file-aware context signals, includes cross-project memories. PREFERRED over brain_session_start.

Inputs: limit, project, active_file, workspace_path.

brain_statsA

Get brain statistics β€” memory counts, categories, database info.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 14 tools

    Disambiguation3/5

    Several tool pairs have fuzzy boundaries: brain_search (keyword) vs brain_recall (filter-based retrieval) both return memories, and brain_remember vs brain_auto_learn both create memories from text. brain_session_start and brain_session_start_smart are near-duplicates, mitigated only by a 'PREFERRED' note in the description rather than removal of the legacy tool.

    Naming Consistency4/5

    All names are snake_case with a uniform brain_ prefix, which is easy to scan. However, the pattern mixes brain_<verb> (brain_search, brain_remember) with brain_<noun>_<verb> (brain_session_start, brain_projects_upsert), and the projects sub-resource uses a different ordering than the memory tools.

    Tool Count4/5

    Fourteen tools is well within a healthy range for a memory/session system with a projects sub-resource. The only bloat is the redundant brain_session_start_smart alongside brain_session_start, which could have been a single tool with an option.

    Completeness4/5

    The surface covers the memory lifecycle (remember, search, recall, forget, restore, stats), full project CRUD, and session start/end with auto-learning. The main gap is the absence of a direct memory update/edit tool, so correcting a stored memory requires forget-plus-remember.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides long-term memory for LLMs via local SQLite storage with hybrid search (BM25, vectors, recency decay), enabling AI coding agents to persist and recall memories across sessions without cloud or API keys.
      52
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Persistent memory for AI coding agents, storing learned architecture decisions, patterns, and bug fixes in a local SQLite database with full-text search, enabling agents to recall information across sessions.
      6
      138 npm
      1
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Gives AI coding agents a local-first persistent memory they can read and write directly during sessions, storing decisions, preferences, error patterns, and guidelines in per-project and global SQLite stores. Enables semantic and keyword retrieval of relevant context across sessions so agents start work already knowing a codebase's conventions and history.
      -