Skip to content

Repository files navigation

open-brain

A personal knowledge and memory system: capture thoughts from anywhere, store them as vector embeddings, and retrieve them by meaning through an MCP server that any AI agent can call.

It's a small, end-to-end RAG system. Thoughts are embedded with OpenAI and stored in Postgres with pgvector; an MCP server exposes semantic retrieval as tools, so an LLM agent can search your memory the same way it calls any other tool.

Architecture

capture (Vercel serverless API)  ->  OpenAI embeddings  ->  Supabase / pgvector
                                                                   |
AI agent  <->  MCP server (semantic_search, list_recent, stats)  <-+
  • Embeddings: OpenAI text-embedding-3-small
  • Vector store: Supabase Postgres with pgvector, cosine similarity search via a SQL function
  • Retrieval interface: Model Context Protocol (@modelcontextprotocol/sdk) server
  • Capture: Vercel serverless endpoint (api/capture-thought.ts) so thoughts can be saved from a shortcut, script, or webhook
  • Language: TypeScript

MCP tools

Tool Description
semantic_search Retrieve thoughts semantically similar to a query, ranked by similarity, with configurable limit and similarity threshold
list_recent List the most recently captured thoughts
stats Summary stats over the knowledge base (counts, top topics, top people)

Run it

npm install
cp .env.example .env   # fill in your Supabase + OpenAI credentials
psql < supabase-setup.sql   # creates the thoughts table + match function
npm run build && npm run mcp

Point any MCP-capable client (Claude Desktop, an agent runtime, etc.) at the built server to query your memory.

Notes

  • .env is gitignored; only placeholders ship in .env.example.
  • Row-level security is enabled on the thoughts table so only the service-role key can read or write.

About

Personal knowledge/memory system with vector embeddings, Vercel API, and MCP server

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages