A personal, database-backed AI memory system that lets you own your context and share it across autonomous agents and AI tools via the Model Context Protocol (MCP).
- Capture Pipeline: Slack slash command → Vercel serverless function → PostgreSQL (with embeddings + metadata)
- Retrieval Pipeline: MCP server → PostgreSQL → Tools for semantic search, recent thoughts, and stats
- Node.js 18+
- Vercel CLI (
npm i -g vercel) - A Slack app with a slash command
- OpenAI API key
Option A: Vercel Postgres / Neon (recommended)
- Go to Vercel Dashboard → your project (or create one)
- Open Storage → Create Database → Postgres (or Neon)
- Link the database to your project
- Copy the
POSTGRES_URLfrom the .env.local tab (or from Storage → your DB → Connect)
Option B: Neon, Supabase, or any PostgreSQL with pgvector
Create a database and ensure pgvector is available. Use the connection string as POSTGRES_URL.
- In Vercel Dashboard → Storage → your Postgres database → Query tab
- Run the contents of
schema.sql:
-- Enable pgvector (run once)
CREATE EXTENSION IF NOT EXISTS vector;
-- Thoughts table
CREATE TABLE thoughts (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
raw_text TEXT NOT NULL,
embedding vector(1536),
people TEXT[] DEFAULT '{}',
topics TEXT[] DEFAULT '{}',
type TEXT,
action_items TEXT[] DEFAULT '{}',
source_channel TEXT,
source_user TEXT,
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- HNSW index for semantic search
CREATE INDEX ON thoughts USING hnsw (embedding vector_cosine_ops)
WITH (m = 16, ef_construction = 64);
-- Index for recent listing
CREATE INDEX ON thoughts (created_at DESC);Alternative: Use psql or any PostgreSQL client with POSTGRES_URL:
psql $POSTGRES_URL -f schema.sqlcd /path/to/open-brain
npm installIn Vercel Dashboard → Settings → Environment Variables, add:
| Name | Value | Environments |
|---|---|---|
POSTGRES_URL |
From Vercel Postgres | All |
OPENAI_API_KEY |
Your OpenAI API key | All |
Or via CLI:
vercel env add POSTGRES_URL
vercel env add OPENAI_API_KEYvercel deploy --prodNote the deployment URL (e.g. https://open-brain-xxx.vercel.app).
If /api/capture returns 404, check Settings → General:
- Framework Preset: Set to Other (not Next.js)
- Build Command: Leave default or
npm run build - Root Directory: Must point to the folder containing
api/andpackage.json
- Go to Slack API → your app (or create one)
- Slash Commands → Create New Command
- Configure:
- Command:
/brain(or your choice) - Request URL:
https://<your-vercel-url>/api/capture - Short Description: Capture a thought to Open Brain
- Usage Hint:
your thought or note
- Command:
- Install App → Install to Workspace
- Authorize the app
In any channel, type:
/brain Had a great meeting with Alice about the Q2 product roadmap. Need to follow up on budget.
You should get a threaded reply with a confirmation of what was captured.
cd mcp-server
npm install
npm run buildCreate .env in mcp-server/ (or export in your shell):
POSTGRES_URL=postgres://...
OPENAI_API_KEY=sk-...
OPENAI_API_KEY is required for semantic_search (to embed the query).
npx tsx src/index.tsOr after build:
node dist/index.jsAdd to Cursor settings (e.g. ~/.cursor/mcp.json or project .cursor/mcp.json):
{
"mcpServers": {
"open-brain": {
"command": "node",
"args": ["/path/to/open-brain/mcp-server/dist/index.js"],
"env": {
"POSTGRES_URL": "postgres://...",
"OPENAI_API_KEY": "sk-..."
}
}
}
}Replace /path/to/open-brain with the actual path.
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"open-brain": {
"command": "node",
"args": ["/path/to/open-brain/mcp-server/dist/index.js"],
"env": {
"POSTGRES_URL": "postgres://...",
"OPENAI_API_KEY": "sk-..."
}
}
}
}| Tool | Description |
|---|---|
semantic_search |
Find thoughts by meaning (e.g. "ideas about X") |
list_recent |
Browse thoughts captured this week |
stats |
Patterns: by type, top topics, top people, daily |
open-brain/
├── api/
│ └── capture.ts # Vercel serverless (Slack webhook)
├── schema.sql # Database schema
├── mcp-server/
│ ├── src/
│ │ ├── index.ts # MCP server + tools
│ │ └── db.ts # Postgres queries
│ ├── package.json
│ └── tsconfig.json
├── package.json
├── vercel.json
└── README.md
- Slack timeout: The function must reply within 3 seconds. We use
response_urlfor async confirmation. EnsuremaxDurationinvercel.jsonis 10. - pgvector not found: Run
CREATE EXTENSION IF NOT EXISTS vectorin your database. - MCP server not starting: Ensure
POSTGRES_URLandOPENAI_API_KEYare set in the MCP config. - Empty semantic search: Verify thoughts have been captured and embeddings are stored (
embedding IS NOT NULL).