- YouTube MCP Server
YouTube MCP Server
A Model Context Protocol (MCP) server for YouTube videos with caption extraction and markdown conversion capabilities
Content
YouTube MCP Server
A Model Context Protocol (MCP) server for interacting with YouTube videos. This server provides tools for extracting video metadata, captions, and converting them to markdown format with various templates.
Features
- Video Metadata: Fetch comprehensive video information
- Caption Extraction: Support for auto-generated and manual captions
- Multiple Languages: Built-in support for English and French
- Template System: Three built-in markdown templates:
- Basic: Simple transcript format
- Detailed: Full metadata with timestamps
- Search: Results highlighting with context
- Search Functionality: Search within video captions
- Flexible Authentication: Supports both API key and OAuth2 authentication
Prerequisites
- Node.js (v16 or higher)
- npm or yarn
- A YouTube Data API key and/or OAuth2 credentials
Installation
- Clone the repository:
git clone [repository-url]
cd youtube-mcp
- Install dependencies:
npm install
- Build the project:
npm run build
Configuration
Create a .env file in the root directory with your YouTube credentials:
YOUTUBE_API_KEY=your_api_key
YOUTUBE_CLIENT_ID=your_client_id
YOUTUBE_CLIENT_SECRET=your_client_secret
YOUTUBE_REFRESH_TOKEN=your_refresh_token # Optional, for OAuth2
MCP Configuration
Add the server to your MCP settings file (usually at ~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json):
{
"mcpServers": {
"youtube": {
"command": "node",
"args": ["path/to/youtube-mcp/build/index.js"],
"env": {
"YOUTUBE_API_KEY": "your_api_key",
"YOUTUBE_CLIENT_ID": "your_client_id",
"YOUTUBE_CLIENT_SECRET": "your_client_secret"
},
"disabled": false,
"alwaysAllow": []
}
}
}
Usage
The server provides the following tools:
1. Get Video Info
use_mcp_tool youtube get_video_info {
"url": "https://www.youtube.com/watch?v=VIDEO_ID"
}
2. Get Captions
use_mcp_tool youtube get_captions {
"url": "https://www.youtube.com/watch?v=VIDEO_ID",
"language": "en" // Optional, defaults to "en"
}
3. Convert to Markdown
use_mcp_tool youtube convert_to_markdown {
"url": "https://www.youtube.com/watch?v=VIDEO_ID",
"template_name": "detailed", // Optional, "basic", "detailed", or "search"
"language": "en", // Optional
"options": { // Optional
"include_chapters": true,
"search_term": "keyword" // Only for search template
}
}
4. List Templates
use_mcp_tool youtube list_templates
Dependencies
{
"dependencies": {
"@modelcontextprotocol/sdk": "latest",
"googleapis": "^146.0.0",
"google-auth-library": "^9.0.0",
"youtube-captions-scraper": "^2.0.0",
"express": "^4.18.2",
"open": "^9.1.0"
},
"devDependencies": {
"@types/node": "^20.0.0",
"typescript": "^5.0.0",
"tsx": "^4.0.0"
}
}
OAuth2 Setup
For OAuth2 authentication (required for private video access):
- Create a project in the Google Cloud Console
- Enable the YouTube Data API v3
- Create OAuth2 credentials (Web application type)
- Run the authentication script:
node src/get-api-key.js
- Follow the browser prompts to authorize the application
- Copy the refresh token to your configuration
Customizing Templates
You can add custom templates by modifying the DEFAULT_TEMPLATES array in src/index.ts. Templates follow this structure:
interface MarkdownTemplate {
name: string;
description: string;
format: {
header?: string;
chapter_format?: string;
caption_block: string;
timestamp_format?: string;
search_result_format?: string;
}
}
License
MIT
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Amap Maps高德地图官方 MCP Server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
ChatWiseThe second fastest AI chatbot™
CursorThe AI Code Editor
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Tavily Mcp
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
WindsurfThe new purpose-built IDE to harness magic
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Serper MCP ServerA Serper MCP Server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
DeepChatYour AI Partner on Desktop
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题;
Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Playwright McpPlaywright MCP server