Open Brain MCP Server
A personal semantic knowledge base that enables storing, searching, and retrieving memories and work history using natural language. It features vector-based search, tool discovery via a registry, and indexing of Cursor agent transcripts using Supabase or Postgres.
README
Open Brain MCP Server
A personal semantic knowledge base exposed as MCP tools. Store, search, and retrieve memories using natural language across Cursor, Claude Desktop, or any MCP-compatible client.
Tools
| Tool | Description |
|---|---|
search_brain |
Semantic similarity search across all memories |
add_memory |
Embed and store a new piece of knowledge |
recall |
Filtered list retrieval by source, tags, or date — no embedding needed |
forget |
Delete a memory by UUID |
brain_stats |
Counts and breakdown by source |
discover_tools |
Semantic search across the tool registry (Toolshed) |
index_cursor_chats |
Index Cursor agent transcripts as searchable work history |
search_work_history |
Keyword search across raw Cursor transcript files |
Setup
cd mcp-server
npm install
cp .env.example .env
# edit .env with your credentials
Configuration
All configuration is via environment variables in .env.
Required (always)
| Variable | Description |
|---|---|
OPENROUTER_API_KEY |
Used to generate embeddings via OpenRouter |
Database backend
The server supports two database backends. Set DB_BACKEND to choose (default: supabase).
Supabase (default)
DB_BACKEND=supabase
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
Raw Postgres
Point the server at any Postgres instance with the pgvector extension and the brain_memories schema applied.
DB_BACKEND=postgres
DATABASE_URL=postgresql://user:password@host:5432/dbname
Both backends use the same schema and the same
match_memoriesSQL function. See Database Schema below.
Optional
| Variable | Default | Description |
|---|---|---|
EMBEDDING_MODEL |
openai/text-embedding-3-small |
OpenRouter embedding model |
EMBEDDING_DIMENSIONS |
1536 |
Must match the model output and schema |
MCP_HTTP_PORT |
3100 |
Port for the HTTP/SSE transport |
CURSOR_TRANSCRIPTS_DIR |
— | Path to Cursor agent-transcripts directory; enables index_cursor_chats and search_work_history |
Running
stdio transport (Cursor / Claude Desktop)
npm run dev:stdio # development (tsx)
npm run start:stdio # production (compiled JS)
Add to .cursor/mcp.json:
{
"mcpServers": {
"open-brain": {
"command": "npx",
"args": ["tsx", "/path/to/mcp-server/src/stdio.ts"],
"env": {
"DB_BACKEND": "supabase",
"SUPABASE_URL": "...",
"SUPABASE_SERVICE_ROLE_KEY": "...",
"OPENROUTER_API_KEY": "..."
}
}
}
}
To use raw Postgres instead, swap the env block:
{
"env": {
"DB_BACKEND": "postgres",
"DATABASE_URL": "postgresql://user:pass@host:5432/dbname",
"OPENROUTER_API_KEY": "..."
}
}
HTTP / SSE transport (network-accessible)
npm run dev:http # development
npm run start:http # production
Endpoints:
| Endpoint | Description |
|---|---|
GET /sse |
SSE stream (MCP SSE transport) |
POST /messages |
MCP message handling |
GET /health |
Health check |
Database Schema
Both backends require the following on the Postgres instance:
pgvectorextension (forhalfvectype)brain_memoriestablematch_memoriesSQL functionbrain_statsview
Schema is managed via the migrations in supabase/migrations/. For a raw Postgres instance, run the migration files in order against your database:
001_initial_schema.sql
002_open_brain.sql
003_brain_rls.sql
004_vector_halfvec.sql
005_uuid_default.sql
006_storage_fillfactor.sql
007_column_reorder.sql
brain_memories table
CREATE TABLE brain_memories (
id uuid NOT NULL DEFAULT gen_random_uuid(),
created_at timestamptz DEFAULT NOW(),
updated_at timestamptz DEFAULT NOW(),
source text NOT NULL DEFAULT 'manual',
content text NOT NULL,
tags text[] DEFAULT '{}',
source_metadata jsonb DEFAULT '{}',
embedding halfvec(1536)
);
Valid source values: manual, telegram, cursor, api, conversations, knowledge, work_history, toolshed.
Toolshed
The Toolshed (discover_tools) solves the "tool explosion" problem. Instead of injecting hundreds of MCP tool schemas into the agent context, the agent calls discover_tools with a natural language query and gets back only the tools relevant to the current task.
Tool descriptions are loaded from tool-registry.json and embedded into brain_memories (source toolshed) at startup. Indexing is idempotent.
Work History Indexing
When CURSOR_TRANSCRIPTS_DIR is set, two additional tools are enabled:
index_cursor_chats— reads JSONL transcript files from the directory, embeds each session summary, and stores it as awork_historymemory. Re-running is idempotent (already-indexed sessions are skipped).search_work_history— keyword search across raw transcript files for exact phrase matching. Complements the semanticsearch_brain.
CURSOR_TRANSCRIPTS_DIR=/Users/you/.cursor/projects/.../agent-transcripts
Development
npm run build # compile TypeScript to dist/
npm run dev:stdio # run stdio server with tsx (hot reload)
npm run dev:http # run HTTP server with tsx (hot reload)
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。