Download YouTube channel videos, transcribe, embed, and serve via MCP for semantic search in Claude.
channel-chat is a CLI tool that:
- Downloads videos from YouTube channels
- Extracts or generates transcripts with timestamps
- Creates vector embeddings for semantic search
- Serves content via MCP (Model Context Protocol) for use with Claude
Supports two deployment modes:
- Local: SQLite + sqlite-vec for personal use
- Cloudflare: Workers + D1 + Vectorize + R2 for cloud deployment
- Node.js >= 20.0.0
- yt-dlp -
brew install yt-dlporpip install yt-dlp - ffmpeg -
brew install ffmpeg(required for video clips)
cd src
npm install
npm run buildTo make the CLI globally available:
npm linkexport GOOGLE_API_KEY=... # For Gemini embeddingsexport ELEVENLABS_API_KEY=... # For transcribing videos without subtitlesexport CLOUDFLARE_WORKER_URL=https://your-worker.workers.dev
export CLOUDFLARE_ACCOUNT_ID=...
export CLOUDFLARE_R2_BUCKET=channel-chat-media
export CLOUDFLARE_R2_ACCESS_KEY_ID=...
export CLOUDFLARE_R2_SECRET_ACCESS_KEY=...
export CLOUDFLARE_WORKER_API_KEY=... # Optional: for authenticated endpoints# Index all videos from a channel (local SQLite)
channel-chat add "https://youtube.com/@channelname"
# Limit to first 50 videos with 3 concurrent workers
channel-chat add "https://youtube.com/@channelname" --limit 50 --concurrency 3
# Index to Cloudflare (downloads video, uploads to R2)
channel-chat add "https://youtube.com/@channelname" --cloudflareOptions:
--limit <n>- Maximum videos to index--concurrency <n>- Parallel processing (default: 1)--cloudflare- Index to Cloudflare instead of local SQLite
channel-chat search "how to optimize database queries"
channel-chat search "kubernetes deployment" --limit 5Options:
-n, --limit <n>- Maximum results (default: 10)
channel-chat list # Show indexed channels
channel-chat list -v # Verbose: show videos per channelchannel-chat index-video "VIDEO_ID"channel-chat cloudflare-setup # Display setup instructionsUse channel-chat as an MCP server to search transcripts directly from Claude.
channel-chat mcp --installAdd to your MCP config (~/.config/claude/claude_desktop_config.json):
{
"mcpServers": {
"channel-chat": {
"command": "node",
"args": ["/path/to/channel-chat/src/dist/mcp-server.js"],
"env": {
"GOOGLE_API_KEY": "your-key"
}
}
}
}| Tool | Description |
|---|---|
search_transcripts |
Semantic search across indexed videos |
list_indexed_channels |
Show indexed channels with video counts |
add_channel |
Index a YouTube channel |
index_video |
Index a specific video |
get_stats |
Get indexing statistics |
set_video_path |
Set local video path for clip playback |
| Resource | Description |
|---|---|
ui://channel-chat/player.html |
React-based video player UI |
video://clip/{videoId}?start=X&duration=Y |
On-the-fly video clip extraction |
For cloud deployment with video storage in R2:
cd cloudflare
# Create D1 database
npm run db:create
npm run db:migrate
# Create Vectorize index
npm run vectorize:create
# Create R2 bucket
npm run r2:createwrangler secret put API_KEYnpm run deployIn Cloudflare Dashboard:
- Go to R2 > Manage R2 API Tokens
- Create token with Object Read/Write permissions
- Add credentials to your environment
| Endpoint | Method | Description |
|---|---|---|
/mcp |
POST | MCP JSON-RPC interface |
/api/index |
POST | Index video content |
/api/videos |
GET | List indexed video IDs |
/api/videos/:id |
DELETE | Delete a video |
/api/stats |
GET | Get statistics |
/ |
GET | Landing page |
/ui |
GET | Video player UI |
YouTube URL → getChannelVideos → downloadSubtitles → parseSubtitles
→ chunkTranscript (800 tokens, 15% overlap)
→ embedBatch (Google Gemini, 768D)
→ SQLite + sqlite-vec
YouTube URL → downloadVideo → uploadToR2
→ chunks → POST /api/index
→ Workers AI embeddings → Vectorize + D1
CLI
- Commander.js - CLI framework
- youtubei.js - YouTube data extraction
- yt-dlp - Video/subtitle download
- Google Gemini - Embeddings (768D)
- ElevenLabs Scribe - Transcription fallback
- better-sqlite3 + sqlite-vec - Vector storage
- MCP SDK - Claude integration
Cloudflare Worker
- Cloudflare Workers - Serverless runtime
- D1 - SQLite database
- Vectorize - Vector search
- R2 - Object storage
- Workers AI - Embeddings
channel-chat/
├── src/ # Node.js CLI and MCP server
│ ├── cli.ts # CLI commands
│ ├── mcp-server.ts # MCP server (stdio/HTTP)
│ ├── downloader.ts # YouTube video/subtitle fetching
│ ├── database.ts # SQLite + vector operations
│ ├── transcriber.ts # Subtitle parsing, transcription
│ ├── embedder.ts # Google Gemini embeddings
│ ├── chunker.ts # Token-based transcript chunking
│ ├── search.ts # Vector similarity search
│ └── cloudflare-client.ts # R2 upload & Worker API
├── cloudflare/ # Cloudflare Worker
│ ├── src/
│ │ ├── index.ts # Worker entry point
│ │ ├── api.ts # API endpoints
│ │ ├── mcp-handler.ts # MCP tool implementations
│ │ ├── db.ts # D1 operations
│ │ └── vectorize.ts # Vector storage
│ ├── schema.sql # D1 schema
│ └── wrangler.toml # Worker config
└── ui/ # React MCP App for video player
Local database: ~/.channel-chat/channel_chat.db
MIT