YouTube MCP Server
Enables LLMs to interact with YouTube videos by fetching transcripts, summarizing content, and answering questions based on video context.
README
YouTube MCP Server
A production-quality Model Context Protocol (MCP) server that empowers LLMs to seamlessly interact with YouTube videos. This server exposes tools to fetch video transcripts, actively summarize videos, and accurately answer questions based on the video context.
🌟 Features
- Fetch Transcripts: Extracts subtitles intelligently, translating generated transcripts to English if necessary.
- Smart Summarization: Chunks large videos into smaller segments to bypass LLM context limit bottlenecks automatically.
- Q&A System: Query specific details from massive YouTube videos directly.
- Fast Performance: Transcripts are temporarily cached in memory. Async architecture scaling cleanly.
- Resilience: Integrated exponential backoff and retry mechanism for LLM API calls using
tenacity.
📁 Project Structure
youtube_mcp_server/
├── server.py # Initializes MCP server and exposes tool endpoints
├── tools.py # The core logic mapping transcript APIs to caching and chunking
├── utils.py # URL extraction, text cleaning, and chunking utility functions
├── llm.py # The LLM engine wrapper managing API requests and retries
├── requirements.txt # Project pip dependencies
└── README.md # Documentation
🚀 Installation
- Clone or navigate to this folder.
- It's recommended to create a Python virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate - Install dependencies:
pip install -r requirements.txt
🔑 Configuration
You must set up your OpenAI API key for summarize_video and ask_video to function.
export OPENAI_API_KEY="your-api-key-here"
# Optional: Set a specific model (defaults to gpt-4o-mini)
export LLM_MODEL="gpt-4o"
🎮 How to Run
Because this is an MCP server, it is meant to communicate via standard input/output (stdio) with an MCP Client (such as Claude Desktop, Cursor, or an intelligent agent).
You can run it manually to see it start to listen on stdio:
python server.py
🤝 Connecting from an MCP Client (Example: Claude Desktop)
To use this server inside Claude Desktop, add it to your claude_desktop_config.json:
{
"mcpServers": {
"youtube_server": {
"command": "/path/to/your/venv/bin/python",
"args": ["/path/to/youtube_mcp_server/server.py"],
"env": {
"OPENAI_API_KEY": "your-api-key-here"
}
}
}
}
📋 Example Tool Usage (Client Perspective)
Once connected, your LLM context will see three available tools:
1. get_transcript(video_url="https://youtube.com/watch?v=XXXX")
- LLM use case: "Retrieve the script for this video so I can parse a recipe."
2. summarize_video(video_url="https://youtu.be/XXXX")
- LLM use case: "Can you give me a summary of Marques Brownlee's latest review?"
3. ask_video(video_url="https://youtube.com/watch?v=XXXX", question="What was the score they mentioned?")
- LLM use case: "From the meeting recording link, what were the Q3 metrics discussed?"
Example Tool Responses
Summarize Video Response:
"The video discusses the release of the new MacBook Pro M4. Key points include:
- Performance upgrades with the M4 chip over the previous generation.
- The introduction of the new Nano-texture display.
- Improvements in battery life averaging 20 hours. The presenter concludes that it is a solid upgrade for M1 users, but M3 users can hold off."
Ask Video Response:
"Based on the video transcript, the presenter stated that the starting price for the base model is $1,599."
🛠 Troubleshooting
- No module named 'mcp': Make sure you have installed the requirements
pip install -r requirements.txt. - Transcripts Disabled: Some creators disable transcripts on their YouTube videos. The server elegantly catches this and returns a clear text Error instead of crashing the server.
- LLM Fails to Output (API Key missing): If
OPENAI_API_KEYis not provided in the environment variables where the MCP server is initialized, the server's summarise and QA tool executions will yield an error message indicating the problem.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。