DEV Community

Cover image for I built an AI Second Brain on SurrealDB - and connected it to Claude via MCP
Jakub Málek
Jakub Málek

Posted on

I built an AI Second Brain on SurrealDB - and connected it to Claude via MCP

In my previous posts, I talked about why SurrealDB feels like the Swiss army knife of databases - graph relations, vector search, schemaful tables, and record links all in one engine. I wanted to put that to the real test, so I built a personal AI-powered knowledge system: a "second brain" that remembers everything I tell it, connects ideas automatically, and lets me search with natural language. But the part that really changed my workflow was exposing it as an MCP (Model Context Protocol) server - giving AI assistants like Claude Code direct access to my entire knowledge graph.

The core works like this: send a thought (text or voice via Telegram), and the system extracts entities, generates tags, creates embeddings, and detects duplicates using OpenAI. SurrealDB stores it all as a graph - thoughts linked to entities via mentions edges, similar thoughts connected through related_to edges with similarity scores. Search runs hybrid vector + fulltext in parallel. But the MCP layer is where it gets interesting. Claude Code can search my brain semantically, add new memories, update existing ones, archive outdated thoughts, and explore connections - all without me leaving the terminal. When I'm coding and need to recall a decision I made weeks ago, my AI assistant just knows. It's like giving your AI tools persistent, structured long-term memory.

What surprised me most was how naturally SurrealDB handles this multi-model use case. I didn't need a separate vector database, graph database, and relational store - it's all one system. HNSW vector indexes, RELATE statements, record links, and fulltext search coexist seamlessly. If you've been looking for a practical MCP server example or a reason to try SurrealDB beyond toy projects, the whole thing is open-source and ready to self-host.

GitHub: github.com/malekjakub69/mcp-second-brain

Top comments (0)