dbrain

dbrain

Provides persistent, structured memory for AI assistants across multiple clients, with searchable facts and identity management.

Category
访问服务器

README

<p align="center"> <img src="logo.png" alt="dbrain" width="600"> </p>

<p align="center"> <a href="https://www.npmjs.com/package/dbrain"><img src="https://img.shields.io/npm/v/dbrain?style=for-the-badge" alt="npm"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge" alt="License"></a> <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-green?style=for-the-badge" alt="Node"></a> </p>


Every AI conversation starts from zero. Switch machines, switch apps, and your AI forgets everything. dbrain fixes that.

Install it once, connect every AI you use — Claude Code at home, Claude Code at work, Gemini on your phone. All share the same identity, the same memories, the same knowledge.

[Home]   Claude Code ──MCP──┐
[Work]   Claude Code ──MCP──┤     ┌─────────────────────────────────┐
[Mobile] Gemini ──REST──────┼────→│  dbrain (your mind)             │
[Server] OpenClaw ──REST────┤     │  identity + memory + knowledge. │
[Other]  Custom AI ──API────┘     └─────────────────────────────────┘

Not an AI agent. Not an assistant. Not a model. Just memory — structured, searchable, persistent.

Quick Start

npm install -g dbrain
dbrain init       # interactive wizard — creates DB, config, identity
dbrain start      # starts API on :7878 + dashboard on :7879

Then connect Claude Code from any machine:

dbrain connect claude

The wizard asks for the brain URL and token (shown during init):

┌  dbrain — Connect to a brain
│
◇  Brain URL
│  http://localhost:7878
│
◇  Access token
│  sk-dbr_...
│
◇  Brain found
│
●  Brain: dBrain — 2 entities, 0 facts
│
◇  Claude Code configured
│
◇  Files updated ──────────────────────────────────────────────╮
│                                                              │
│  ~/.claude.json          MCP server registered               │
│  ~/.claude/settings.json  Permissions granted                │
│  ~/.claude/CLAUDE.md      Behavioral instructions installed  │
│                                                              │
├──────────────────────────────────────────────────────────────╯
│
└  Connected. Restart Claude Code to activate.

Restart Claude Code and it will start using the brain. You can also skip the wizard:

dbrain connect claude http://your-server:7878 --token=sk-dbr_...

Docker

git clone https://github.com/ivncmp/dbrain.git
cd dbrain
cp .env.example .env    # edit token, names, port
docker compose up -d

Then from any client machine:

dbrain connect claude http://your-server:7878

How It Works

The brain has 4 layers:

Layer What How
Identity Who is the AI? Who is the user? How should it behave? documents table
Conversations Raw chat history from every AI session conversations + messages tables
Knowledge Structured facts organized by PARA entities + facts tables with hot/warm/cold tiers
Recall Full-text search over all facts FTS5 with OR logic for multi-language queries

Memory Tiers

Memories fade if you don't use them — like a real brain.

Tier Rule
hot Accessed in the last 7 days, or accessCount >= 10
warm 8–30 days since last access
cold > 30 days — fading, candidate for archival

Every search bumps accessed facts back to hot. The brain stays sharp on what matters.

MCP Tools

Available to any MCP client (Claude Code, etc.):

Tool Purpose
recall Search memory + get identity (primary tool)
remember Save a fact to an entity
get_entity Read entity with all its facts
list_entities List entities by category or type
create_entity Create a new entity
bump Touch a memory to keep it hot
log Send conversation messages for storage
wake_up Full identity load
overview Brain stats

REST API

All endpoints require Authorization: Bearer <token> except /health.

Method Endpoint Purpose
GET /health Brain pulse
GET /connect Client config (MCP, permissions, instructions)
GET/PUT/DELETE /workspace/:key Identity documents
GET/POST/DELETE /entities/:id Knowledge entities
POST /entities/:id/facts Add facts to an entity
PATCH /facts/:id/access Bump a memory (keep it hot)
GET/POST /conversations Chat history
POST /search Full-text search over all facts
GET /memory/summary Overview: entities x tiers

CLI Commands

Command Where Purpose
dbrain init [path] Server Create a new brain (DB, config, identity)
dbrain start [path] Server Start the API server + dashboard
dbrain connect <client> [url] Client Connect a client to a running brain
dbrain status [path] Server Check brain status

init runs on the server (creates the brain). connect runs on the client (configures Claude Code). The brain serves its own client config via GET /connect.

Dashboard

Web dashboard on port 7879. Shows brain stats, entities with PARA categories, fact tiers, conversations, and full-text search. Single-file React app — no build step.

Stack

Layer Technology
Language Node.js + TypeScript
API Fastify
DB SQLite + FTS5 (better-sqlite3)
MCP @modelcontextprotocol/sdk (HTTP transport)
Validation Zod
CLI @clack/prompts
Dashboard React 18 (CDN, no build step)

Development

git clone https://github.com/ivncmp/dbrain.git
cd dbrain
npm install              # installs deps + builds (prepare script)
npx dbrain init          # create a brain (only needed once)
npm run dev              # starts the server with file watching
Script What it does
npm run dev Dev server with file watching (tsx)
npm run build Compile TypeScript + copy dashboard HTML
npm start Start the compiled server from dist/
npm test Run tests with vitest
npm run lint ESLint check
npm run lint:fix ESLint auto-fix
npm run format Prettier format
npm run check Lint + format + build (full pipeline)

Environment Variables

For non-interactive setup (Docker, CI):

Variable Default Purpose
DBRAIN_DATA ~/.dbrain Data path
DBRAIN_PORT 7878 API port
DBRAIN_HOST 0.0.0.0 Bind address
DBRAIN_TOKEN Auto-generated Access token
DBRAIN_AGENT_NAME dBrain AI identity name
DBRAIN_OWNER_NAME Human Owner name
DBRAIN_TIMEZONE Auto-detected Owner timezone

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选