Lenny RAG MCP Server

Lenny RAG MCP Server

Provides hierarchical RAG over 299 Lenny Rachitsky podcast transcripts for product development brainstorming and insight retrieval. It enables semantic search across topics, insights, and examples to surface expert advice on product management and growth.

Category
访问服务器

README

Lenny RAG MCP Server

An MCP server providing hierarchical RAG over 299 Lenny Rachitsky podcast transcripts. Enables product development brainstorming by retrieving relevant insights, real-world examples, and full transcript context.

Quick Start

# Clone the repository (includes pre-built index via Git LFS)
git clone git@github.com:mpnikhil/lenny-rag-mcp.git
cd lenny-rag-mcp

# Create and activate virtual environment
python -m venv venv
source venv/bin/activate

# Install the package
pip install -e .

Claude Code

claude mcp add lenny --scope user -- /path/to/lenny-rag-mcp/venv/bin/python -m src.server

Or add to ~/.claude.json:

{
  "mcpServers": {
    "lenny": {
      "type": "stdio",
      "command": "/path/to/lenny-rag-mcp/venv/bin/python",
      "args": ["-m", "src.server"],
      "cwd": "/path/to/lenny-rag-mcp"
    }
  }
}

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "lenny": {
      "command": "/path/to/lenny-rag-mcp/venv/bin/python",
      "args": ["-m", "src.server"],
      "cwd": "/path/to/lenny-rag-mcp"
    }
  }
}

Cursor

Add to .cursor/mcp.json in your project or ~/.cursor/mcp.json globally:

{
  "mcpServers": {
    "lenny": {
      "command": "/path/to/lenny-rag-mcp/venv/bin/python",
      "args": ["-m", "src.server"],
      "cwd": "/path/to/lenny-rag-mcp"
    }
  }
}

Replace /path/to/lenny-rag-mcp with your actual clone location in all configs.


MCP Tools

search_lenny

Semantic search across the entire corpus. Returns pointers for progressive disclosure.

Parameter Type Description
query string Search query (e.g., "pricing B2B products", "founder mode")
top_k integer Number of results (default: 5, max: 20)
type_filter string Filter by type: insight, example, topic, episode

Returns: Ranked results with relevance scores, episode references, and topic IDs for drilling down.

get_chapter

Load a specific topic with full context. Use after search_lenny to get details.

Parameter Type Description
episode string Episode filename (e.g., "Brian Chesky.txt")
topic_id string Topic ID (e.g., "topic_3")

Returns: Topic summary, all insights, all examples, and raw transcript segment.

get_full_transcript

Load complete episode transcript with metadata.

Parameter Type Description
episode string Episode filename (e.g., "Brian Chesky.txt")

Returns: Full transcript (10-40K tokens), episode metadata, and topic list.

list_episodes

Browse available episodes, optionally filtered by expertise.

Parameter Type Description
expertise_filter string Filter by tag (e.g., "growth", "pricing", "AI")

Returns: List of 299 episodes with guest names and expertise tags.


Data Curation Approach

Hierarchical Extraction

Each transcript is processed into a 4-level hierarchy enabling progressive disclosure:

Episode
├── Topics (10-20 per episode)
│   ├── Insights (2-4 per topic)
│   └── Examples (1-3 per topic)

This allows Claude to start with lightweight search results and drill down only when needed, keeping context windows efficient.

Extraction Schema

{
  "episode": {
    "guest": "Guest Name",
    "expertise_tags": ["growth", "pricing", "leadership"],
    "summary": "150-200 word episode summary",
    "key_frameworks": ["Framework 1", "Framework 2"]
  },
  "topics": [{
    "id": "topic_1",
    "title": "Searchable topic title",
    "summary": "Topic summary",
    "line_start": 1,
    "line_end": 150
  }],
  "insights": [{
    "id": "insight_1",
    "text": "Actionable insight or contrarian take",
    "context": "Additional context",
    "topic_id": "topic_1",
    "line_start": 45,
    "line_end": 52
  }],
  "examples": [{
    "id": "example_1",
    "explicit_text": "The story as told in the transcript",
    "inferred_identity": "Airbnb",
    "confidence": "high",
    "tags": ["marketplace", "growth", "launch strategy"],
    "lesson": "Specific lesson from this example",
    "topic_id": "topic_1",
    "line_start": 60,
    "line_end": 85
  }]
}

Implicit Anchor Detection

Many guests reference companies without naming them ("at my previous company..."). The extraction prompt instructs the model to infer identities based on the guest's background:

  • Brian Chesky saying "when we started" → Airbnb (high confidence)
  • A marketplace expert saying "one ride-sharing company" → likely Uber/Lyft (medium confidence)

This surfaces examples that wouldn't be found by keyword search alone.

Quality Thresholds

Each transcript extraction is validated against minimum thresholds:

Element Minimum Typical
Topics 10 15-20
Insights 15 25-35
Examples 10 18-25

Extractions below thresholds trigger warnings for manual review.


Models & Tech Stack

Component Model/Tool Purpose
Preprocessing Claude Haiku (via Claude CLI) Extract structured hierarchy from transcripts
Embeddings bge-small-en-v1.5 Semantic similarity for search
Vector DB ChromaDB Persistent vector storage
MCP Framework mcp (Python SDK) Tool interface for Claude

Why Claude Haiku for Preprocessing?

  • Quality: Haiku follows complex extraction prompts reliably
  • Cost: ~$0.02-0.03 per transcript (~$6-9 total for 299 episodes)
  • Speed: ~30 seconds per transcript

Why bge-small-en-v1.5 for Embeddings?

  • Performance: Top-tier retrieval quality for its size
  • Efficiency: 384 dimensions, fast inference
  • Local: Runs entirely on CPU, no API calls needed

Corpus Statistics

Metric Count
Episodes 299
Topics 6,183
Insights 8,840
Examples 6,502
Avg topics/episode 20.7
Avg insights/episode 29.6
Avg examples/episode 21.7

Rebuilding the Index

The repo includes a pre-built ChromaDB index. To rebuild from scratch:

Reprocess Transcripts (requires Claude CLI)

# Process all unprocessed transcripts
python scripts/preprocess_haiku.py

# Process specific file
python scripts/preprocess_haiku.py --file "Brian Chesky.txt"

# Parallel processing (4 batches of 50)
python scripts/preprocess_haiku.py --limit 50 --offset 0 &
python scripts/preprocess_haiku.py --limit 50 --offset 50 &
python scripts/preprocess_haiku.py --limit 50 --offset 100 &
python scripts/preprocess_haiku.py --limit 50 --offset 150 &

Rebuild Embeddings

# Incremental (only new files)
python scripts/embed.py

# Full rebuild
python scripts/embed.py --rebuild

Project Structure

lenny-rag-mcp/
├── transcripts/           # 299 raw .txt podcast transcripts
├── preprocessed/          # Extracted JSON hierarchy (one per episode)
├── chroma_db/             # Vector embeddings (Git LFS)
├── prompts/
│   └── extraction.md      # Haiku extraction prompt
├── src/
│   ├── server.py          # MCP server & tool definitions
│   ├── retrieval.py       # LennyRetriever class (ChromaDB wrapper)
│   └── utils.py           # File loading utilities
├── scripts/
│   ├── preprocess_haiku.py  # Claude CLI preprocessing
│   └── embed.py             # ChromaDB embedding pipeline
└── pyproject.toml

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选