local-brain-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@local-brain-mcpwhat recurring bugs have we fixed in the auth module?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
š§ local-brain-mcp
Local-first, zero-latency, git-aware AI memory for Claude Code, Cursor, Copilot & Windsurf.
No cloud. No API keys. No privacy risk. Sub-5ms recall.
Why local-brain?
Problem with cloud AI memory tools | How local-brain solves it |
š 150ā800ms network latency per recall | ā” < 5ms ā local SQLite vector search |
āļø Your code sent to foreign servers | š 100% on-device, zero egress |
šø Token bloat on every session | š¦ Hard 250-token budget cap per recall |
šļø Stale outdated context from old decisions | š Git-diff invalidation marks old memories STALE |
š WIP/typo commits pollute the brain | šÆ Conventional commit filter keeps only high-signal lessons |
šļø Monorepo noise across packages | šÆ Path-scoped queries, per-package namespacing |
Related MCP server: Heimdall MCP Server
Quick Start
# 1. Install
npm install -g local-brain-mcp
# 2. Init ā auto-detects Claude Code, Cursor, Copilot, Windsurf
npx local-brain init
# 3. Ingest your git history
cd /path/to/your-project
npx local-brain ingest
# 4. Restart your AI editor ā the MCP tools are now availableMCP Tools
brain_recall
Semantic search your codebase memory. Results capped to 250 tokens.
{
"query": "JWT auth bug",
"file_path": "src/auth/jwt.ts",
"max_items": 5,
"category": "fix"
}Example output:
## Brain Recall: "JWT auth bug"
⢠[src/auth/jwt.ts @ 8a4f12] (fix): JWT refresh race condition ā RS256 cert rotates every 24h. Never use HS256 in dev.
⢠[src/auth/session.ts @ c31d04] (bug): Sessions expire silently on Tuesdays 02:00 UTC ā auth service maintenance window.brain_learn
Manually store a lesson or team convention.
{
"lesson": "Always seed the test DB before running Playwright tests or auth flows break.",
"category": "convention",
"file_path": "tests/setup.ts"
}brain_trace
Full history of all memories for a specific file.
{
"file_path": "src/db/client.ts"
}brain_prune
Remove stale/deprecated memories. Optionally run the full git invalidation pass.
{
"status": "stale",
"run_invalidation": true
}CLI Commands
local-brain init # setup wizard ā writes MCP config for all detected editors
local-brain ingest # scan git history and build the brain DB
local-brain ingest --since "6 months ago" --verbose
local-brain status # show DB memory counts
local-brain prune --invalidate # detect + remove stale memoriesHow It Works
git history
ā
[git-ingest.ts] ā filters WIP/typo/format commits
ā
[embeddings.ts] ā pure-JS TF-IDF feature hashing (sub-1ms, zero network)
ā
[db.ts] ā stores in .git/brain.db (Float32Array BLOB vectors in SQLite)
ā (on file change)
[invalidation.ts] ā marks stale if file changed > 30%
ā (on MCP tool call)
[recall.ts] ā in-memory cosine similarity search, scoped to package, capped to 250 tokens
ā
Claude Code / Cursor / Copilot / Windsurf / ZedSupported Editors
Editor | Config auto-detected |
Claude Code |
|
Cursor |
|
Windsurf |
|
VS Code Copilot |
|
Zed |
|
Tech Stack
Protocol:
@modelcontextprotocol/sdk(StdioServerTransport)Storage:
better-sqlite3(SQLite WAL mode with BLOB vectors)Embeddings: Pure-JS TF-IDF feature hashing (384-dim, sub-1ms, 100% offline)
Git Engine:
simple-gitCLI Engine:
commander
License
MIT ā build freely.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
AlicenseNot gradedqualityCmaintenanceProvides persistent memory for AI coding assistants, storing and retrieving architectural decisions, patterns, and solutions across sessions using semantic search, while also offering git integration for commit messages and code expertise mapping.MIT- AlicenseNot gradedqualityDmaintenanceProvides AI coding assistants with persistent, context-rich memory of a codebase, including documentation and git history, enabling recall across sessions.104Apache 2.0
- AlicenseAqualityAmaintenanceProvides persistent memory and a codebase knowledge graph for AI coding assistants, enabling shared context across multiple tools like Claude, Cursor, and ChatGPT, with significant token reduction.525MIT
- AlicenseNot gradedqualityAmaintenanceGives AI coding assistants persistent project memory and semantic code search, running fully locally with no API keys required.MIT
Related MCP Connectors
Your company's brain for AI agents. Cited, permission-aware knowledge across every system.
Give your AI agent a persistent map of your project's structure, dependencies, and bugs.
Git-backed platform for skills, tools, and context for AI agents
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cosmiccoder200x-sys/local-brain-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server