Second Brain
Provides Git-backed storage for the memory vault, allowing notes to be versioned, cloned, and edited in any Git client, with Git as the source of truth.
Integrates with GitHub via a GitHub App to read and write the vault repository, enabling push webhooks to trigger index synchronization and using GitHub as the Git provider.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Second Braincatch me up on what we decided in our last session"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Second Brain
One persistent, shared memory for you, your team, and every AI assistant you work with.
Second Brain is a knowledge and memory platform. People and AI assistants (Claude, Cursor, Copilot, ChatGPT, custom agents) read from and write to the same store of Markdown notes: projects, decisions, topics and session logs. You open a new chat on any machine, with any assistant, and it already knows what you were doing, what you decided and why, and what comes next.
It begins as a personal daily-driver and is designed from the start to be sold to businesses as an internal knowledge tool, with multi-tenant isolation, sharing, SSO and audit trails.
Status: Phase 0, planning. This repository holds the product plan, architecture and engineering standards. Code starts in Phase 1 (see Roadmap).
The problem
Pain | Today | With Second Brain |
AI assistants forget everything between sessions | You re-explain context every chat |
|
Several assistants and machines | Each one keeps partial memory, or none | One store, reachable by every MCP-capable client |
Decisions get lost | "Why did we pick X?" is buried in chat history | Append-only decision log with rationale and supersession |
Team knowledge is scattered | Docs, Slack and people's heads | Shared spaces with roles, so agents work from the team's real context |
Lock-in | Memory is trapped inside one vendor's app | Plain Markdown in Git you own, editable in Obsidian or any editor |
Related MCP server: agent-memory-server
What we are building
Memory server (MCP + REST): a TypeScript service on Cloudflare Workers that exposes memory tools to any MCP client.
Vault: Markdown notes with YAML frontmatter and
[[wikilinks]], stored in Git (the source of truth). Each note is a project, decision, topic, session or a free note.Search index: SQLite (Cloudflare D1) full-text search, plus an optional semantic layer (embeddings and vector search, merged with reciprocal rank fusion). The index is a cache that can be rebuilt from Git at any time.
Session ritual:
context, then work, thensave, then a periodiccheck. This is where most of the value comes from.Web app: browse, search, edit, graph view, manage keys, spaces, sharing and audit logs.
CLI (
brain): sign a machine in once, store keys in the OS keychain, auto-configure installed assistants, and run activity-logging hooks.Teams and business tier: orgs, spaces, roles, invitations with consent, SSO, audit log and data export.
Core features (v1 must-haves)
MCP tools:
brain_context,brain_save,brain_search,brain_read,brain_write,brain_check,brain_projectsAtomic multi-file saves (one commit per save)
Heading-aware chunking and full-text search with permission filters applied inside the query
Token-budgeted context responses, with superseded decisions hidden
Per-machine, per-assistant API keys with scopes (read-only, project-limited), plus OAuth 2.1 for MCP clients
Secret redaction on the client and again on the server; all memory treated as untrusted data
Web UI for reading, editing, searching and key management
Personal spaces, plus sharing of projects or spaces as viewer or editor
The full prioritised list is in Requirements.
Connect a client
Every MCP client connects to one URL: https://<host>/mcp. Clients that support MCP authorization (OAuth 2.1) need nothing else. The first time they connect, a browser window asks you to sign in and approve the app, and you choose whether it may write as well as read. You can disconnect it at any time in the web app.
Client | How |
Claude Code |
|
Claude Desktop / claude.ai | Settings → Connectors → Add custom connector, and paste |
Cursor | Add |
VS Code |
|
Clients without OAuth support, scripts and hooks use a scoped API key instead (brain login, or Keys in the web app):
claude mcp add --transport http second-brain https://<host>/mcp --header "Authorization: Bearer sb_live_..."How the OAuth flow works is described in LLD §8.
Architecture at a glance
AI clients (Claude, Cursor, ...) Web app brain CLI Git push (webhook)
│ MCP / HTTPS │ HTTPS │ │
▼ ▼ ▼ ▼
┌──────────────────── Cloudflare Worker: API gateway ────────────────────┐
│ authN (keys / OAuth / session) → authZ (RBAC) → rate limit → router │
│ MCP tools REST API Webhooks Admin │
│ └──── domain services (Notes, Search, Session, Sharing) ────┘ │
└───────┬───────────┬───────────┬───────────┬───────────┬────────────────┘
▼ ▼ ▼ ▼ ▼
Git provider D1 (SQLite R2 (archives, KV (hot Queues + Cron
(source of + FTS5 backups, lookups, (index sync, embed,
truth) index, meta) exports) rate limit) archive, rebuild)
│
Vectorize + Workers AI (embeddings)Read more: High-level design · Low-level design
Documentation map
Area | Document |
Product | |
Architecture | |
Security | |
Collaboration | |
Delivery | |
Reference | |
Runbooks | Local development · Keep a vault in GitHub (Obsidian, VS Code) |
Planned tech stack
Layer | Choice | Why (see ADRs) |
Language | TypeScript (strict) everywhere | One language across server, web, CLI and shared domain code |
Runtime | Cloudflare Workers | Serverless, global, millisecond cold starts, low cost (ADR-0002) |
API | Hono + | Small, fast, Workers-native |
Source of truth | Git (GitHub App), behind a | You own your data; history for free (ADR-0001) |
Index / metadata | Cloudflare D1 (SQLite + FTS5) | Built-in BM25 ranking, rebuildable (ADR-0003) |
Semantic search | Vectorize + Workers AI embeddings, RRF fusion | Optional layer; degrades to keyword search (ADR-0004) |
Blobs | R2 | Archived session logs, backups, exports |
Async | Queues + Cron Triggers | Index sync, embedding, nightly rebuild |
Web | React + Vite + TanStack Router/Query, served as Workers static assets | Same platform; no separate host |
Validation | Zod schemas shared across packages | One contract for MCP, REST and UI |
Monorepo | pnpm workspaces + Turborepo | Fast, cached builds |
Testing | Vitest (+ | Tests run against the real Workers runtime |
CI/CD | GitHub Actions → Wrangler deploy (staging → prod) |
Repository layout (target)
second-brain/
├── apps/
│ ├── server/ # Cloudflare Worker: MCP + REST + webhooks + cron consumers
│ └── web/ # React dashboard
├── packages/
│ ├── core/ # Pure domain logic: parser, chunker, ranking, budgeter, redactor
│ ├── schema/ # Zod schemas and shared types (MCP tool I/O, REST DTOs)
│ ├── db/ # D1 migrations + typed repository layer (tenant-scoped)
│ ├── vault/ # VaultStore interface + GitHub implementation
│ ├── cli/ # `brain` CLI: login, keychain, client config, hooks
│ └── config/ # Shared tsconfig / eslint / prettier
├── docs/ # This plan: product, HLD/LLD, security, ADRs
├── .github/ # CI workflows, templates, CODEOWNERS
└── README.mdContributing
See CONTRIBUTING.md. Security issues: see SECURITY.md.
License
Second Brain is open source under the GNU AGPL-3.0. You can use, modify and self-host it freely. If you run a modified version as a network service, you must share your changes under the same licence.
This server cannot be deployed
Maintenance
Related MCP Connectors
One memory, every AI. A shared, user-owned markdown memory your AI clients read and write over MCP.
- LogRackOAuthai.lograck
Shared memory for your AI tools: tasks, notes and context every tool can read and write over MCP.
- ContexelOAuthai.contexel
Shared AI memory. ChatGPT, Claude, Cursor and any MCP app read and write the same memory.
shared AI-context layer for teams — persistent memory your agents search and update over MCP
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceA dynamic, governed memory layer for Markdown notes that serves knowledge to AI clients and humans through a secure MCP server, with scoped access, git-audited changes, and optional LLM-powered semantic search.Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to persist and share durable memory — appending session logs with checkpoints and handoffs, claiming and completing tasks, and recording decision records — all stored as plain Markdown and JSONL files in a git repository. Everything written is full-text searchable, and the server speaks MCP so MCP-aware clients can plug in directly with zero vendor lock-in.MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude, ChatGPT, and other AI apps to share one MCP-accessible hub of Markdown-based memories and skills, with per-app adapters, versioned writes, git history, saving policies, Google OAuth, and a web UI.MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI coding agents to persistently remember and recall insights across sessions as atomic Markdown knowledge cards with bidirectional links, shared across Claude Code, Cursor, VS Code Copilot, Codex, Windsurf, and any MCP client. Stores memory as plain markdown files with git sync instead of a vector database, letting agents build on prior knowledge rather than starting from scratch.4 npmISC