syia-youtube-mcp-server
v1.0.0
Published
YouTube MCP server with search and transcript generation capabilities
Maintainers
Readme
YouTube MCP Server
A Model Context Protocol (MCP) server that provides YouTube search and transcript generation capabilities.
Features
- YouTube Search: Search for videos with filters for duration, sorting, and publication date
- Transcript Generation: Extract transcripts/captions from YouTube videos using RapidAPI with timestamped segments
Installation
- Clone this repository
- Install dependencies:
npm install - Build the project:
npm run build
Usage
Starting the Server
You must provide a YouTube API key to use this server. You can obtain one from the Google Cloud Console.
For transcript extraction, you also need a RapidAPI key for the YouTube Transcript Extractor API. You can obtain one from RapidAPI.
# Using command line arguments
node dist/index.js --youtube-api-key YOUR_YOUTUBE_API_KEY --rapidapi-key YOUR_RAPIDAPI_KEY
# Using environment variables
export YOUTUBE_API_KEY=YOUR_YOUTUBE_API_KEY
export RAPIDAPI_KEY=YOUR_RAPIDAPI_KEY
node dist/index.js
# Optional: specify custom RapidAPI host (default: youtube-transcript-extractor1.p.rapidapi.com)
export RAPIDAPI_HOST=custom-host.p.rapidapi.comAvailable Tools
1. youtube_search
Search for YouTube videos based on a query.
Parameters:
query(required): The search querymax_results: Maximum number of results (1-50, default: 10)order: Sort order - "relevance", "date", "rating", "viewCount", "title" (default: "relevance")video_duration: Filter by duration - "any", "short", "medium", "long" (default: "any")published_after: Filter videos published after this date (ISO 8601 format)
Example Response:
{
"query": "machine learning tutorial",
"total_results": 10,
"results": [
{
"position": 1,
"videoId": "dQw4w9WgXcQ",
"title": "Introduction to Machine Learning",
"description": "Learn the basics of machine learning...",
"channelTitle": "Tech Channel",
"videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"viewCount": "1234567",
"duration": "10m 30s"
}
]
}2. youtube_transcript
Get the transcript/captions for a YouTube video using RapidAPI.
Note: Requires RapidAPI key to be configured.
Parameters:
video_id(required): YouTube video ID or URLlanguage: Preferred language code (currently not used by RapidAPI endpoint)
Example Response:
{
"videoId": "dQw4w9WgXcQ",
"title": "Video Title",
"channel": "Channel Name",
"language": "en",
"segments": [
{
"text": "Hello and welcome...",
"timestamp": "00:00",
"start": 0.0
}
],
"fullText": "Hello and welcome...",
"hasTimestamps": true
}Development
# Run in development mode
npm run dev
# Build the project
npm run build
# Test with MCP inspector
npm testLicense
MIT
