brain2
A database-first personal knowledge management system powered by a local MCP server, providing 29 tools to manage and search structured knowledge (meetings, emails, people, accounts, projects, todos, etc.) via a single SQLite file.
README
brain2
Database-first personal knowledge management system powered by a local MCP server. All data lives in a single SQLite file. Claude accesses it via 29 MCP tools through Claude Desktop or Claude Code.
Replaces an earlier Obsidian vault-based system with structured storage, semantic search, and automated ingestion pipelines.
Features
- Unified knowledge store — meetings, emails, chats, notes, people, accounts, projects, todos, ideas, and resources in one database
- Knowledge graph — flexible edges between any entities (mentions, related_to, attended, about, etc.)
- Hybrid search — FTS5 full-text search + sqlite-vec vector similarity (384-dim, all-MiniLM-L6-v2)
- Watermark-based ingestion — incremental M365 email sync with dedup (Teams chat sync currently unavailable)
- Dreaming — connection building, person summaries, account health assessment, and theme discovery — runs at the end of each sync
- Daily digest — morning briefing with meetings (account context, open threads, heads-up) and overdue todos
Requirements
- Node.js 20+
- Claude Desktop or Claude Code (for MCP integration)
- Microsoft 365 MCP (for email/chat ingestion)
Setup
npm install
Configure MCP
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json) or Claude Code config (~/.claude/mcp.json):
{
"mcpServers": {
"brain2": {
"command": "npx",
"args": ["tsx", "/path/to/brain2/src/index.ts"],
"env": {
"BRAIN2_DB": "/path/to/brain2/data/brain2.db"
}
}
}
}
Import from Obsidian vault (optional)
npx tsx src/index.ts --import-vault ~/path/to/obsidian-vault
Parses frontmatter, tables, and imports all entity types (meetings, emails, chats, people, accounts, projects, todos, resources).
Usage
npx tsx src/index.ts # Start MCP server (stdio)
npm test # Run tests
npx tsc --noEmit # Type-check
Once the server is running, Claude can use all 26 tools and 4 skill prompts through natural conversation:
- "What's happening with the Dell account?" — searches items, gets account profile and contacts
- "Process my emails" — runs the email ingestion pipeline
- "Who have I met with most this month?" — queries the knowledge graph
- "Add a todo to follow up with Sarah by Friday" — creates a todo with due date
Architecture
data/brain2.db SQLite + sqlite-vec + FTS5
data/models/ Cached embedding model (all-MiniLM-L6-v2)
src/
index.ts Entry point (stdio MCP transport + vault migration CLI)
server.ts MCP server setup and tool registration
db/
connection.ts SQLite connection with sqlite-vec extension
schema.ts Table definitions and migrations
tools/
ingest.ts Ingest meetings, emails, chats, notes (5 tools)
entities.ts Upsert people/accounts/projects, manage todos (6 tools)
query.ts Get/list items, people, accounts (6 tools)
search.ts Hybrid FTS5 + vector search (1 tool)
graph.ts Edges and knowledge graph traversal (3 tools)
synthesis.ts Save/retrieve dreaming syntheses (2 tools)
watermark.ts Ingestion watermark tracking (3 tools)
stats.ts Database stats and portfolio view (2 tools)
embeddings/ Local embedding generation via @xenova/transformers
search/ Hybrid search ranking logic
migration/ Obsidian vault import
utils/ Hashing, ID generation
prompts.ts Registers skills as MCP prompts for Claude Desktop
skills/ Skill prompts (MCP prompts + Claude Code skills)
brain-sync.md Sync M365 → brain2 (email + chat) + dream + lint
brain-day.md Daily prep brief
brain-note.md File user notes to calendar meetings
brain-extract.md Extract reusable knowledge from work sessions
Skills
Skills are available as MCP prompts in Claude Desktop (via the / menu) and as Claude Code skills (via ~/.claude/skills/). Both read from the same skills/*.md files.
| Skill | Description |
|---|---|
brain-sync |
Sync M365 emails with verification, then dream + lint (Teams chat unavailable) |
brain-day |
Daily prep brief — meetings with account context + overdue todos |
brain-note |
File user notes by matching them to calendar meetings |
brain-extract |
Extract reusable knowledge from work sessions |
Data Model
Core entities
- items — unified table for meetings, emails, chats, notes
- people — one row per person with contact info (name, title, company, email, phone)
- accounts — customer accounts with health, platform, segment, ARR
- projects — active work with status tracking
- todos — action items with priority, due date, source item, assignee
- ideas / resources — captured ideas and reference material
Relationships
- item_people — who attended/participated in which item
- account_contacts — people linked to accounts with roles (ae, csa, se, tam, etc.)
- edges — generic typed relationships between any entities
- tags — flexible tagging on any entity
Search
- FTS5 index on item content and titles
- sqlite-vec 384-dimensional vectors for semantic similarity
- Hybrid ranking combines both signals
License
Private.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。