Convert any YouTube video into an AI-queryable MCP server
Project description
๐ฌ mcptube
Convert any YouTube video into an AI-queryable MCP server.
YouTube URL in โ searchable library โ ask your AI anything about any video.
mcptube extracts transcripts, metadata, and frames from YouTube videos, indexes them into a local vector database, and exposes everything as MCP tools โ queryable by Claude, ChatGPT, VS Code Copilot, Cursor, Gemini, and any MCP-compatible client.
โจ Features
- Semantic search across video transcripts (single video or entire library)
- Frame extraction at any timestamp or by natural language query
- Auto-classification with LLM-generated tags
- Illustrated reports โ single-video or cross-video, markdown or HTML
- Video discovery โ search YouTube by topic, filter and cluster results
- Cross-video synthesis โ themes, agreements, and contradictions across videos
- Dual interface โ full CLI + MCP server
- Passthrough LLM โ MCP tools require zero API keys; the client LLM does the reasoning
- BYOK โ CLI mode supports 100+ LLM providers via LiteLLM
- Smart video resolver โ reference videos by ID, index, or title substring
๐ Prerequisites
- Python 3.12+
- ffmpeg โ required for frame extraction
# macOS brew install ffmpeg # Ubuntu/Debian sudo apt install ffmpeg # Windows winget install ffmpeg
๐ Installation
pip install mcptube
From source (development)
git clone https://github.com/0xchamin/mcptube.git
cd mcptube
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
โก Quick Start
CLI
# Add a video
mcptube add "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
# List your library
mcptube list
# Search across all videos
mcptube search "machine learning basics"
# Extract a frame
mcptube frame 1 120.5
# Start the MCP server
mcptube serve
MCP Server
# Streamable HTTP (default) โ works with Claude Code, ChatGPT
mcptube serve
# stdio โ works with VS Code, Claude Desktop, Cursor
mcptube serve --stdio
๐ง CLI Commands
| Command | Description |
|---|---|
mcptube add <url> |
Ingest a YouTube video |
mcptube list |
List all videos in the library |
mcptube info <query> |
Show video details (ID, index, or text) |
mcptube remove <query> |
Remove a video from the library |
mcptube search <query> |
Semantic search across transcripts |
mcptube frame <video> <timestamp> |
Extract a frame at a timestamp |
mcptube frame-query <video> <text> |
Search transcript + extract frame |
mcptube classify <video> |
Auto-classify with LLM tags (BYOK) |
mcptube report <video> |
Generate an illustrated report (BYOK) |
mcptube report-query <query> |
Cross-video report from search (BYOK) |
mcptube discover <topic> |
Search YouTube + cluster results (BYOK) |
mcptube synthesize-cmd <topic> -v <id> |
Cross-video synthesis (BYOK) |
mcptube serve |
Start MCP server (Streamable HTTP) |
mcptube serve --stdio |
Start MCP server (stdio) |
Smart Video Resolver
Commands that take a <video> or <query> argument accept:
| Input | Resolution |
|---|---|
BpibZSMGtdY |
Exact YouTube video ID |
1 |
Index number from mcptube list |
"prompting" |
Substring match on title or channel |
Search Options
# Search all videos
mcptube search "attention mechanism"
# Search within a specific video
mcptube search "attention" --video "prompting"
# Limit results
mcptube search "attention" --limit 5
Report Options
# Full report for a video
mcptube report "prompting" --format html --output report.html
# Focused report
mcptube report "prompting" --focus "reasoning strategies" --output focused.html
# Cross-video report from search
mcptube report-query "prompt engineering" --format html --output multi.html
# Cross-video synthesis
mcptube synthesize-cmd "prompting" -v BpibZSMGtdY -v UPGB-hsAoVY --output synthesis.html
๐ค MCP Tools (13 tools)
All MCP tools use the passthrough pattern โ no API key required on the server. The connected AI client (Claude, ChatGPT, Copilot) provides the LLM reasoning.
| Tool | Description |
|---|---|
add_video(url) |
Ingest a YouTube video |
remove_video(video_id) |
Remove from library |
list_videos() |
List all videos with metadata |
get_info(video_id) |
Full video details with transcript |
search(query, video_id?, limit) |
Semantic search (single or all videos) |
search_library(query, tags?, limit) |
Cross-library search with tag filter |
get_frame(video_id, timestamp) |
Extract frame at timestamp |
get_frame_by_query(video_id, query) |
Search + extract frame |
classify_video(video_id) |
Return metadata for client classification |
generate_report(video_id, query?) |
Return data for client report generation |
generate_report_from_query(query, tags?) |
Cross-video report data |
discover_videos(topic) |
YouTube search results |
synthesize(video_ids, topic) |
Cross-video synthesis data |
๐ MCP Client Configuration
Claude Code
# Streamable HTTP (recommended)
claude mcp add --transport http --scope global mcptube http://127.0.0.1:9093/mcp
Note: Use
--scope globalto make mcptube available in all projects. Without it, the server is scoped to the directory where you ran the command.
Then start the server in a separate terminal:
mcptube serve
VS Code / Copilot Chat
Add to .vscode/mcp.json in your workspace:
{
"servers": {
"mcptube": {
"command": "mcptube",
"args": ["serve", "--stdio"]
}
}
}
Note: If VS Code can't find
mcptube, use the full path to the executable:"command": "/path/to/your/.venv/bin/mcptube"Or if installed globally via pip, the command should work as-is.
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"mcptube": {
"command": "mcptube",
"args": ["serve", "--stdio"]
}
}
}
Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"mcptube": {
"command": "mcptube",
"args": ["serve", "--stdio"]
}
}
}
ChatGPT
Settings โ Connectors โ Add โ http://localhost:9093/mcp
Gemini CLI
Add to settings.json:
{
"mcpServers": {
"mcptube": {
"command": "mcptube",
"args": ["serve", "--stdio"]
}
}
}
๐ BYOK โ Bring Your Own Key (CLI Mode)
CLI commands that use LLM features (classify, report, discover, synthesize) require an API key via environment variables:
# Anthropic (Claude)
export ANTHROPIC_API_KEY="sk-ant-..."
# OpenAI
export OPENAI_API_KEY="sk-..."
# Google (Gemini)
export GOOGLE_API_KEY="AI..."
mcptube auto-detects which key is available. Set a default model:
export MCPTUBE_DEFAULT_MODEL="anthropic/claude-sonnet-4-20250514"
Security: Never pass API keys as CLI flags. Always use environment variables.
MCP mode does not need any API key โ the connected AI client provides the LLM.
โ๏ธ Configuration
All settings can be overridden via MCPTUBE_-prefixed environment variables:
| Variable | Default | Description |
|---|---|---|
MCPTUBE_DATA_DIR |
~/.mcptube |
Root directory for all data |
MCPTUBE_HOST |
127.0.0.1 |
Server bind host |
MCPTUBE_PORT |
9093 |
Server bind port |
MCPTUBE_DEFAULT_MODEL |
gpt-4o |
Default LLM model for CLI |
Server Options
mcptube serve # Streamable HTTP on 127.0.0.1:9093
mcptube serve --stdio # stdio transport
mcptube serve --host 0.0.0.0 --port 8080 # Custom host/port
mcptube serve --reload # Dev mode with hot-reload
๐๏ธ Architecture
CLI (Typer) โโโโโโโโ
โโโ Service Layer (McpTubeService)
MCP Server (FastMCP) โโโ โ
โโโโโโดโโโโโ
Repository VectorStore
(SQLite) (ChromaDB)
โ
Ingestion Layer
โโโ YouTubeExtractor (yt-dlp)
โโโ FrameExtractor (yt-dlp + ffmpeg)
โโโ LLMClient (LiteLLM โ CLI only)
โโโ ReportBuilder (CLI only)
โโโ VideoDiscovery (CLI only)
LLM Strategy
| Mode | LLM | Cost |
|---|---|---|
| CLI | LiteLLM (BYOK) | User's API key |
| MCP | Client LLM (passthrough) | Free โ client provides reasoning |
Storage
| Component | Per video (~40 min) | 100 videos |
|---|---|---|
| SQLite (metadata + transcript) | ~200-500 KB | ~50 MB |
| ChromaDB (384-dim vectors) | ~1.5-2 MB | ~200 MB |
| Total | ~250 MB |
ChromaDB downloads the all-MiniLM-L6-v2 embedding model (~80 MB) on first use. This is a one-time download cached at ~/.cache/chroma/.
๐ ๏ธ Tech Stack
- FastMCP 3.0 โ MCP server framework (Streamable HTTP + stdio)
- yt-dlp โ YouTube extraction (transcripts, metadata, search)
- ffmpeg โ On-demand frame extraction
- ChromaDB โ Local vector database with built-in embeddings
- LiteLLM โ Unified LLM interface (100+ providers)
- Typer โ CLI framework
- Pydantic โ Data models and settings
- SQLite โ Library metadata storage
๐งช Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run with coverage
pytest --cov=mcptube --cov-report=html
# Lint
ruff check src/
# Format
ruff format src/
๐ฆ Project Structure
mcptube/
โโโ src/mcptube/
โ โโโ __init__.py
โ โโโ cli.py # Typer CLI
โ โโโ server.py # FastMCP MCP server
โ โโโ service.py # Core business logic
โ โโโ models.py # Pydantic domain models
โ โโโ config.py # Settings (pydantic-settings)
โ โโโ llm.py # LiteLLM wrapper (BYOK)
โ โโโ report.py # ReportBuilder
โ โโโ discovery.py # VideoDiscovery
โ โโโ ingestion/
โ โ โโโ __init__.py
โ โ โโโ youtube.py # YouTubeExtractor
โ โ โโโ frames.py # FrameExtractor
โ โโโ storage/
โ โโโ __init__.py
โ โโโ repository.py # Abstract VideoRepository
โ โโโ sqlite.py # SQLiteVideoRepository
โ โโโ vectorstore.py # VectorStore + ChromaVectorStore
โโโ tests/
โโโ pyproject.toml
โโโ README.md
๐บ๏ธ Roadmap
- MVP โ 13 MCP tools, CLI, semantic search, frames, reports
- MCP Apps โ Interactive HTML UIs inline in chat
- Playlist / channel import
- Speaker diarization
- OCR on frames
- Auto-chaptering
- Multi-language transcripts
- SaaS tier (OAuth, pgvector, team libraries)
๐ License
MIT
Built with FastMCP โก
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcptube-0.1.0.tar.gz.
File metadata
- Download URL: mcptube-0.1.0.tar.gz
- Upload date:
- Size: 2.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91131c1a77c12435b8f6f09ad7b328f032783a4a446e917d969bef307bdc870b
|
|
| MD5 |
73e3830a5593a89f7613a5c82602545b
|
|
| BLAKE2b-256 |
c3073c4211728727ad3ab1a43dceaeb88131d535aa6386a6ea7f29b2e2f6f986
|
File details
Details for the file mcptube-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcptube-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a320c001834cd835072bde8bd7e553da5a9201ce5e936181b352fbcc93f7ee3
|
|
| MD5 |
b7eadc796f8b98cba77a421fcf89e3f0
|
|
| BLAKE2b-256 |
665459a9366182db2adade42989a94cc72693e27937eda12bc2d82f268dee9a0
|