Open Source · MIT License · Self-Hosted

Give your AI agent
a memory that lasts.

SecondBrain is a persistent MCP memory server. Your agents remember context across every session - stored in a semantic wiki, a knowledge graph, and a vector index you fully control.

agent session
# Your agent remembers across every session
agent › remember("The user prefers dark mode and uses Neovim")
✓ Stored. Task ID: a3f8c1
# Three sessions later…
agent › recall("user preferences")
↳ Dark mode enabled. Editor: Neovim. Prefers concise answers.

Memory that actually scales

Built-in memory engines and simple lists work fine at first. Then they don't.

📝
Flat memory lists
Claude memory, ChatGPT memory
📄
LLM-Wiki / Notion
Simple wiki dumps
SecondBrain
HybridRAG + knowledge graph
Scales past 100+ facts
✗ Context fills up
~ Gets noisy
✓ Vector index + graph
Finds related concepts
✗ Keyword only
✗ Manual links
✓ Semantic + graph traversal
Resolves contradictions
✗ Keeps both
✗ No awareness
✓ Hourly review agent
Human-readable format
✗ Opaque store
✓ Markdown
✓ Obsidian-compatible vault
You own the data
✗ Vendor cloud
~ Depends on tool
✓ Fully self-hosted
Works with any agent
✗ Locked to one app
✗ Manual copy-paste
✓ MCP protocol

Everything your agent needs to remember

SecondBrain is not a simple key-value store. It's a full knowledge management system designed for AI agents.

📈

HybridRAG Retrieval

When your agent calls recall(), SecondBrain runs three retrieval passes in parallel - vector similarity search (Qdrant), knowledge graph traversal (Neo4j), and direct Markdown lookup - then synthesizes a single coherent answer with an LLM.

Qdrant Neo4j LLM Synthesis
📄

Wikipedia-Agent Model

A planning agent decides how to update the knowledge base - creating, extending, or merging wiki pages intelligently rather than dumping raw text.

🔗

MCP-Native

Two tools: remember() and recall(). Drop into claude.ai, OpenClaw, or any MCP-compatible client with a single URL.

📚

Obsidian-Compatible Vault

All knowledge is stored as plain Markdown with [[wikilinks]]. Sync to any Git host. Browse it in Obsidian. Your data, your format.

Hourly Review Agent

A background agent automatically cross-links related pages, resolves contradictions, and keeps the knowledge base coherent over time.

🏠

Fully Self-Hosted

One docker compose up. Runs on your server. No third-party cloud, no data sharing, no subscription. MIT licensed.

Simple API. Powerful internals.

Your agent sees two MCP tools. Under the hood, a multi-layer system handles everything.

1

Agent calls remember(text)

The input is split into independent topics and queued for async processing.

2

Planning agent decides

An LLM agent searches existing pages and determines what to create, update, or merge.

3

Three stores updated

Markdown vault, Neo4j knowledge graph, and Qdrant vector index are all updated atomically.

4

Agent calls recall(query)

HybridRAG searches all three layers and returns a synthesized, contextual answer.

Your Agent
claude.ai · OpenClaw · custom
↓ MCP
MCP Server
remember()
recall()
Celery Worker
📄 Vault
🔗 Neo4j
📈 Qdrant
HybridRAG
LLM Answer

Up and running in 3 steps

Docker Compose handles all dependencies - Neo4j, Qdrant, Redis, backend, and frontend.

01

Clone & configure

bash
git clone https://github.com/JonasKruegerCode/SecondBrain.git
cd SecondBrain
cp .env.example .env
# Set OPENROUTER_API_KEY and MCP_API_KEY in .env
02

Start

bash
docker compose up -d
# Web UI:  http://localhost
# MCP:     http://localhost:3000/mcp
03

Connect claude.ai

Settings → Integrations → Add MCP server
URL:     https://mcp.your-domain.com/mcp
API Key: your-secret-key

For local testing: expose port 3000 with ngrok or Cloudflare Tunnel.

Built on proven open-source infrastructure

📄
Markdown + Git
Human-readable vault
🔗
Neo4j
Knowledge graph
📈
Qdrant
Vector search
Redis + Celery
Async ingestion
🐧
Docker Compose
One-command setup
🌐
OpenRouter
Any LLM you want

Help us make it production-ready

SecondBrain is MIT-licensed and actively seeking contributors. Here's where you can have the most impact:

🔧

Alternative LLM Providers

Support direct OpenAI / Anthropic keys without requiring OpenRouter as a proxy.

Enhancement
📄

Documentation & Cookbook

Usage examples and patterns for common agent workflows - the most impactful contribution for new users.

Docs
🔗

Git Sync: Any Host

GitLab, Gitea, and self-hosted support. Currently only GitHub PAT auth is tested.

Feature
🧪

Tests & CI

Expand integration test coverage and add GitHub Actions for pytest, ruff, and mypy on PRs.

Testing
Star on GitHub

Open an issue before starting work on a significant change.