Enables interaction with YouTube videos by extracting metadata, captions in multiple languages, and converting content to markdown with various templates.
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.
git clone [repository-url] cd youtube-mcp
npm install
npm run build
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
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": [] } } }
The server provides the following tools:
use_mcp_tool youtube get_video_info { "url": "https://www.youtube.com/watch?v=VIDEO_ID" }
use_mcp_tool youtube get_captions { "url": "https://www.youtube.com/watch?v=VIDEO_ID", "language": "en" // Optional, defaults to "en" }
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 } }
use_mcp_tool youtube list_templates
{ "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" } }
For OAuth2 authentication (required for private video access):
node src/get-api-key.js
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; } }
MIT
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!