SuperAPIAI Directory

brain-mcp

github.com · AI developer platforms

brain-mcp is an open-source Model Context Protocol (MCP) server for turning a local Obsidian vault into private context and memory for Claude and any MCP client. It reads Markdown notes locally, provides hybrid keyword and semantic retrieval, link following, reranking, and citations, and supports writing what the model has learned back into notes. Notes are not uploaded to third parties, and it supports stdio, HTTP token, and OAuth 2.1 remote access, with audit logs and permission scopes.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

brain-mcp is an open-source MCP server whose goal is to use the user's own Obsidian vault as the long-term memory and context source for all AI clients. Notes are stored as plain Markdown in a folder controlled by the user, and the server runs locally without uploading notes to third parties.

Key capabilities

  • Multiple clients share the same memory: Claude Code, Claude Desktop, claude.ai, Cursor, Hermes Agent, mobile phones, and any other MCP-capable client can read the same vault.
  • Fully local hybrid retrieval: four search paths—keyword index by section (BM25), semantic embeddings (bge-small-en-v1.5), exact dates, and note titles—are fused with reciprocal rank fusion and reranked with a cross-encoder (bge-reranker-base). Optionally follows note links (off by default, retrieval.graph).
  • Can answer "the vault has no record of this": when the best passage falls below the reranker threshold, it returns no relevant content along with a coverage label (good, thin, none).
  • Write-back memory: brain_remember appends persistent facts and rejects near-duplicates, and supports fact replacement, expiry, and start dates; brain_identity returns only facts that are currently true, while brain_facts preserves history. Four additional tools can write, edit, move, and delete handwritten notes, restricted to allowed folders.
  • Privacy and security: remote access uses OAuth 2.1 with PKCE, provides read, write, and private scopes, supports secret redaction, and writes an audit log to logs/audit.jsonl on every call.
  • Indexing and models: the index is stored in data/index.db, rebuilt at startup, and kept up to date by a file watcher; embeddings are cached by text hash. Models run offline after the first download; when models are not ready, it falls back to keyword retrieval, and BRAIN_MCP_HYBRID=0 can be set to use keywords only.
  • Evaluation and visualization: two retrieval evaluation scripts are included (keyword vs. hybrid comparison), and you can write test cases to score your own vault; npm run graph exports the link graph, and visualizer/ provides 2D/3D views.
  • Import: importers under scripts/import/ can convert notes from other tools into Obsidian-style frontmatter and [[wikilinks]], reads source files only, writes to <vault>/Imported/ by default, supports --dry-run, --project, --force.

Usage Requires Node 22 or newer. Initialize with a single command: npx debawho-brain-mcp init, which lists local Obsidian vaults to choose from (or creates a starter vault at ~/second-brain), asks for your name, optionally enables smart search, and can automatically connect Claude Code. Config, index, and logs are stored in ~/.brain-mcp/. To manually connect Claude Code or clients that read the mcpServers config (Claude Desktop, Cursor, etc.), use npx -y debawho-brain-mcp --stdio; on Windows, prefix npx with cmd /c. For HTTP and OAuth modes, see npx debawho-brain-mcp --help. Smart search is a one-time download: the platform ONNX runtime is 100–200 MB and the model is about 300 MB, stored in ~/.brain-mcp/; use npx debawho-brain-mcp smart-search to add it or remove to remove it. When using from source, npm run setup generates brain.config.local.json and prints the claude mcp add command. The Docker image is based on Alpine and supports keyword search only (smart search depends on glibc); it publishes to 127.0.0.1:3737 by default, and the health check is GET /healthz; for public exposure, use --oauth and place it behind a TLS proxy.

Use cases For users who want multiple AI clients to share a personal knowledge base and long-term memory, who value local privacy of notes, and who need to search and write back to notes; also suitable for developers researching hybrid retrieval and MCP integration.

Limitations The architecture is currently fairly simple: single process, single SQLite file, fixed-rule hybrid ranking; configurable options include retrieval chunks, context budget, RRF_K, TITLE_BONUS, etc., but pluggable retrievers, storage, graph strategies, and query rewriting are not yet available. Paraphrase-style queries remain weakspots, and reranker speed also has room for improvement. The Docker image does not support semantic search.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools