Second Brain

Second Brain

A personal AI-powered knowledge base MCP server that allows Claude to search, add, list, and delete documents from a local knowledge base.

Category
Visit Server

README

🧠 Second Brain

A personal AI-powered knowledge base. Ingest your PDFs, notes, bookmarks, code files, and YouTube videos — then chat with them using Claude.

Python FastAPI Claude


What it does

  • Ingest any document: PDFs, Markdown, DOCX, code files, web URLs, YouTube transcripts, Notion pages
  • Search using hybrid retrieval — semantic vector search + keyword search, merged with a real ML re-ranker
  • Chat with your documents through a web UI, answers come with source citations
  • Expose your knowledge base as an MCP tool so Claude Desktop can search it mid-conversation

Quick start

1. Clone and install

git clone https://github.com/MBA009/RAG-MCP-system.git
cd RAG-MCP-system
pip install -r requirements.txt

2. Set up environment variables

Create a .env file in the project root:

ANTHROPIC_API_KEY=sk-ant-api03-...
EMBEDDING_BACKEND=local

EMBEDDING_BACKEND=local uses a free offline model (recommended to start). If you have an OpenAI key and want higher quality embeddings:

EMBEDDING_BACKEND=openai
OPENAI_API_KEY=sk-...

Optional:

NOTION_TOKEN=secret_...

3. Ingest your documents

# Single file
python cli.py ingest ~/Documents/notes.pdf

# Entire folder (recursive)
python cli.py ingest ~/Documents/notes/

# Web page
python cli.py ingest-url https://en.wikipedia.org/wiki/Retrieval-augmented_generation

# YouTube video (fetches transcript automatically, no API key needed)
python cli.py ingest-youtube https://www.youtube.com/watch?v=VIDEO_ID

# All Notion pages (requires NOTION_TOKEN in .env)
python cli.py ingest-notion

4. Start the web UI

python cli.py web

Open http://localhost:8000 in your browser.


Web UI features

  • Chat with your documents — answers include clickable source citations
  • Add sources from the sidebar: URL, YouTube, file upload, or Notion sync
  • Hover over any source and click ✕ to remove it
  • Header shows total docs and chunks indexed

All CLI commands

Command What it does
python cli.py ingest <path> Ingest a file or directory
python cli.py ingest-url <url> Ingest a web page
python cli.py ingest-youtube <url> Ingest a YouTube transcript
python cli.py ingest-notion Sync all Notion pages
python cli.py list List all ingested sources
python cli.py delete <hash> Delete a source by its hash
python cli.py stats Show total sources and chunks
python cli.py watch Watch inbox folder and auto-ingest new files
python cli.py chat Terminal chat interface
python cli.py web Start the web UI
python cli.py serve Start the MCP server for Claude Desktop

Claude Desktop integration (MCP)

Add to your Claude Desktop config:

Windows: %APPDATA%\Claude\claude_desktop_config.json Mac: ~/.config/claude/claude_desktop_config.json

{
  "mcpServers": {
    "second-brain": {
      "command": "python",
      "args": ["cli.py", "serve"],
      "cwd": "C:\\path\\to\\second-brain"
    }
  }
}

Restart Claude Desktop. Claude can now call search_brain, add_document, list_sources, and delete_source as tools mid-conversation.


Key configuration (config.py)

Setting Default Description
EMBEDDING_BACKEND "local" "local" or "openai"
CHUNK_SIZE 512 Tokens per chunk
TOP_K_FINAL 5 Results returned per query
CLAUDE_MODEL claude-sonnet-4-... Claude model used for chat

Supported file types

PDF, DOCX, Markdown, plain text, Python, JavaScript, TypeScript, Go, Rust, C, C++, Java, HTML, web URLs, YouTube, Notion, Obsidian vaults


Tech stack

Tool Role
Qdrant Local vector database
SQLite FTS5 Full-text keyword search
sentence-transformers Embeddings + cross-encoder re-ranking
FastAPI Web API
Anthropic Claude Language model
MCP SDK Claude Desktop tool integration

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured