youtube-mcp
Enables AI assistants to watch YouTube videos by extracting frames at scene changes and visual references, pairing each frame with the exact words spoken at that timestamp. Provides dense frame-transcript interleaving for any model.
README
<p align="center"> <img src="https://img.shields.io/badge/MCP-YouTube-red?style=for-the-badge&logo=youtube&logoColor=white" alt="YouTube MCP" /> <img src="https://img.shields.io/badge/Gemini--Style-Video_Understanding-blue?style=for-the-badge" alt="Gemini-style" /> <img src="https://img.shields.io/badge/Any_Model-Universal-green?style=for-the-badge" alt="Any Model" /> </p>
<h1 align="center">youtube-mcp</h1>
<p align="center"> <strong>Give any AI the ability to watch YouTube videos.</strong><br/> Dense frame-transcript interleaving. Scene detection. Visual cue analysis.<br/> Gemini-style video understanding — for any model. </p>
<p align="center"> <a href="#-quick-install">Quick Install</a> • <a href="#-how-it-works">How It Works</a> • <a href="#-tools">Tools</a> • <a href="#-ai-installer">AI Installer</a> • <a href="#-examples">Examples</a> </p>
What is this?
An MCP server that lets AI assistants actually watch YouTube videos — not just read transcripts.
It extracts frames at scene changes and visual reference moments, pairs each frame with the exact words spoken at that timestamp, and returns everything as dense interleaved content. The AI sees what's on screen at the exact moment someone says "as you can see here."
No existing YouTube MCP server does this. Every other one is transcript-only. This is the first to combine transcript + vision.
The Token Math
| Approach | 10 min video | Token cost |
|---|---|---|
| Gemini native (1 FPS, 258 tok/frame) | 600 frames | ~155K tokens |
| Sending raw JPEGs to any model | 600 frames | ~7.2M tokens |
| youtube-mcp (dense interleave, 1 frame/5s) | 120 frames | ~1.4M tokens |
| youtube-mcp describe mode (BLIP-2 → text) | 600 frames | ~18K tokens |
Describe mode gives you 400x savings over raw images — full visual coverage as pure text.
Quick Install
Prerequisites
brew install yt-dlp ffmpeg
Setup
git clone https://github.com/coah80/youtube-mcp.git
cd youtube-mcp
bun install
Add to Claude Code
Add to your ~/.mcp.json:
{
"mcpServers": {
"youtube": {
"command": "bun",
"args": ["run", "/path/to/youtube-mcp/src/index.ts"]
}
}
}
Then restart Claude Code.
Optional: Enable describe mode (local BLIP-2)
This lets the AI "see" every second of a video as text descriptions — no images needed.
cd youtube-mcp
uv venv --python 3.11 .venv
uv pip install --python .venv/bin/python torch torchvision transformers accelerate pillow
First run downloads the BLIP-2 model (~3GB). Subsequent runs use the cached model.
AI Installer
For AI assistants: Copy and paste this into your MCP config to install youtube-mcp.
Add this to ~/.mcp.json (create the file if it doesn't exist):
{
"mcpServers": {
"youtube": {
"command": "bun",
"args": ["run", "/path/to/youtube-mcp/src/index.ts"]
}
}
}
Replace /path/to/youtube-mcp with the actual clone path.
If the file already has other servers, just add the "youtube" key inside the existing "mcpServers" object.
How It Works
YouTube URL
│
├──→ yt-dlp ──→ Transcript (timestamped, word-level)
│
├──→ yt-dlp ──→ Stream URL ──→ ffmpeg ──→ Frames
│ │
│ ┌────────────┼────────────┐
│ │ │ │
│ Scene Change Visual Cues Regular
│ Detection in Transcript Intervals
│ (ffmpeg) ("as you can (fill gaps)
│ see here")
│ │ │ │
│ └────────────┼────────────┘
│ │
│ Frame Selection (prioritized)
│ │
└──────────────────→ Dense Interleave
│
┌──────────┴──────────┐
│ │
Image Mode Describe Mode
(raw screenshots) (BLIP-2 captions)
│ │
Frame + "words Text description
spoken during + "words spoken
this frame" during this frame"
Visual Cue Detection
The analyzer scans transcript text for 25+ patterns indicating the speaker is referencing something visual:
| Pattern | Example |
|---|---|
as you can see |
"As you can see here, the API returns..." |
look at this |
"Look at this graph" |
on screen |
"What's on screen right now is..." |
click here |
"If you click here, it opens..." |
this diagram |
"In this diagram, we have..." |
notice how |
"Notice how the color changes" |
When detected, a frame is extracted at that exact timestamp — so the AI sees what the speaker was pointing at.
Scene Change Detection
Uses ffmpeg's scene detection filter (select=gt(scene,0.3)) to find where the visual content actually changes. This means:
- Static talking-head sections get fewer frames (nothing's changing)
- Slide transitions, screen recordings, demos get more frames (lots changing)
Segment-Based Processing
For videos longer than 5 minutes, watch_video processes in 3-minute segments with ~1 frame every 5 seconds. The AI calls it repeatedly:
watch_video(url) → first 3 min, 36 frames
watch_video(url, start_time=180) → next 3 min, 36 frames
watch_video(url, start_time=360) → next 3 min, 36 frames
...until the end
Each response tells the AI how to continue: "To continue watching, call watch_video with start_time=360"
Tools
| Tool | What it does |
|---|---|
watch_video |
Dense frame↔transcript interleaving in segments. ~1 frame/5s. The full "watch" experience. |
describe_video |
Full visual coverage via local BLIP-2. Every frame described as text. 400x fewer tokens than images. |
get_scene_overview |
Composite grid image of scene changes. Quick visual summary of the whole video. |
get_frames |
Extract frames at specific timestamps. For drilling into moments. |
get_transcript |
Full timestamped transcript. |
get_video_info |
Video metadata (title, channel, duration, views, description). |
Examples
"Watch this video and summarize it"
The AI calls watch_video and gets interleaved content like:
[1:23] (scene change) "and here's where it gets interesting"
[screenshot of code editor]
[1:28] "if you look at this function right here"
[screenshot showing the function being discussed]
[1:33] (visual reference) "notice how the state updates"
[screenshot at the exact moment they reference the visual]
"Describe this entire lecture for me"
The AI calls describe_video and gets pure text:
[0:00] [VISUAL] A title slide reading "Introduction to Neural Networks"
[0:00] Welcome everyone to today's lecture on neural networks.
[0:05] [VISUAL] A diagram showing interconnected nodes in layers
[0:05] We'll start with the basic architecture.
[0:10] [VISUAL] The same diagram with arrows highlighted between layers
[0:10] Each connection between nodes has a weight...
600 frames of a 10-minute video → ~18K tokens. Fits in any context window.
Architecture
youtube-mcp/
├── src/
│ ├── index.ts # MCP server — 6 tool definitions
│ ├── youtube.ts # yt-dlp + ffmpeg operations (stream URL, frames, scenes)
│ ├── analyzer.ts # Visual cue detection, chunking, dense interleaving
│ ├── describe.ts # BLIP-2 integration (TypeScript wrapper)
│ └── captioner.py # BLIP-2 inference (Python, runs on MPS/CUDA/CPU)
├── .venv/ # Python venv for BLIP-2 (optional)
├── package.json
├── tsconfig.json
└── README.md
Tech Stack
- Runtime: Bun
- MCP SDK: @modelcontextprotocol/sdk
- Video: yt-dlp + ffmpeg
- Vision (optional): BLIP-2 via PyTorch on Apple MPS
Compatibility
Works with any MCP-compatible AI assistant:
- Claude Code (CLI, Desktop, Web)
- Claude Desktop
- Cursor
- Any future MCP host
The image-based tools (watch_video, get_frames, get_scene_overview) require a vision-capable model.
The text-based tool (describe_video) works with any model — even text-only ones — because BLIP-2 converts all visuals to text locally.
Roadmap
- [ ] Gemini Flash proxy mode — use Gemini Flash ($0.10/1M tokens) as a visual encoder for higher-quality frame descriptions than BLIP-2
- [ ] Frame deduplication — perceptual similarity hashing to skip near-identical frames
- [ ] Keyframe extraction — use ffmpeg I-frame detection instead of fixed intervals
- [ ] Whisper integration — local audio transcription when YouTube captions aren't available
- [ ] Timestamp burning — burn MM:SS into frame pixels (requires ffmpeg with libfreetype)
- [ ] npm package —
npx youtube-mcpone-liner install
Research
This project was informed by deep research into how Gemini, GPT-4o, and open-source tools handle video:
- Gemini processes video at 1 FPS using SigLIP-SO400M (258 tokens/frame) with native multimodal attention
- GPT-4o sends base64 JPEG frames via the vision API (~12K tokens/frame)
- No existing YouTube MCP server combines transcript + frame extraction — this is the first
Key references: LiveCC (CVPR 2025), mcp-deep-video, videostil, llm-video-frames
License
MIT
<p align="center"> Built by <a href="https://github.com/coah80">@coah80</a><br/> <sub>Give AI assistants the ability to watch YouTube. Star if this helped you.</sub> </p>
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。