YouTube MCP Server
Summary: Turn YouTube videos into citation-ready, timestamp-linked research with optional API-key-powered search, analytics, and discovery.
Transcript research (no API key):
research-video,research-videos,get-video-transcript,enhanced-transcript,get-key-moments, andget-segmented-transcriptextract captions with timestamps, search within transcripts, filter by time range, segment for analysis, and compare evidence across up to 5 videos.Search and comments (API key required):
search-videosfinds videos with filters for channel, order, duration, caption availability, definition, region, and publish date;get-video-commentsretrieves and paginates comments, including reply coverage.Statistics and comparisons (API key required):
get-video-stats,get-channel-stats, andcompare-videosreturn views, likes, comments, subscriber counts, and multi-video metrics.Discovery and trends (API key required):
get-trending-videos,get-video-categories, andanalyze-channel-videossurface regional trends, categories, and channel performance trends.Prompts and resources: Built-in prompts like
video-analysis,transcript-summary, andsegment-by-segment-analysis, plus resources such asyoutube://video/{videoId},youtube://channel/{channelId}, andyoutube://transcript/{videoId}.Deployment modes: Runs over stdio or Streamable HTTP at
/mcp, with Docker, Smithery, MCPB bundle support, optional bearer-token auth, CORS allowlisting, and session limits.
Allows querying YouTube data, including searching for videos, retrieving video and channel information, and fetching video comments through the YouTube Data API.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@YouTube MCP Server search for Python tutorial videos from the last month"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
YouTube Research MCP
Turn YouTube videos into citation-ready research for Codex, Claude, Cursor, and other MCP clients. Paste a video URL and get transcript evidence with timestamps and links that open at the exact quoted moment.
Input: https://youtu.be/dQw4w9WgXcQ
Output: [01:05] ...evidence text...
https://www.youtube.com/watch?v=dQw4w9WgXcQ&t=65sNo YouTube API key is required for transcript research.
Why this server
Citation-ready research — every transcript segment includes a timestamp and source URL.
Zero-key quick start — transcripts work immediately; add an API key only for search and analytics.
URL-first input — accepts normal, short, Shorts, embed, live, and raw video-ID formats.
Agent-efficient filtering — search inside transcripts and return nearby context instead of spending tokens on the entire video.
Full YouTube intelligence — optional API mode adds comments, video/channel statistics, trends, and comparisons.
Remote-native MCP — Streamable HTTP transport at
/mcp, plus Docker and Smithery support.
Related MCP server: YouTube MCP Server
Architecture and trust boundary
flowchart LR
C[MCP client] -->|stdio or Streamable HTTP| T[Transport]
T --> R[Tool and resource registry]
R --> S[YouTubeService]
S --> K[(In-memory cache)]
S -->|no key required| YT[Caption tracks]
S -->|optional API key| API[YouTube Data API v3]The MCP layer validates inputs and returns structured evidence; it does not ask a model to invent summaries or citations. Transcript tools derive timestamps and canonical links from caption segments. Data API tools return an explicit key-required error when YOUTUBE_API_KEY is unavailable, and remote authentication is enforced before MCP session handling.
Focused evidence, not a transcript dump
The included live smoke test asks a focused question about a public video and compares the response with the full timestamped transcript:
Response | Characters returned |
Full transcript | 85,518 |
| 1,550 |
Reduction | 98.2% |
This measures response characters, not model-specific tokens. Reproduce it against the default public fixture—or substitute your own video and query:
npm run test:live
LIVE_TEST_VIDEO='https://youtu.be/VIDEO_ID' LIVE_TEST_QUERY='evaluation' npm run test:liveQuick start — no API key
Requirements: Node.js 22 or newer.
The shortest local install uses stdio and needs no API key:
codex mcp add youtube-research -- npx -y @coyasong/youtube-mcp-server@latestFor Claude Desktop and other MCPB-compatible desktop clients, download the latest one-click MCP bundle and open it. The bundle vendors its runtime dependencies, starts locally over stdio, and asks for a YouTube API key only if you want the optional analytics tools.
Or install from the VS Code command line:
code --add-mcp '{"name":"youtube-research","command":"npx","args":["-y","@coyasong/youtube-mcp-server@latest"]}'For Claude Desktop, Cursor, and other stdio clients, use command npx with arguments -y @coyasong/youtube-mcp-server@latest.
To run the Streamable HTTP transport instead:
git clone https://github.com/coyaSONG/youtube-mcp-server.git
cd youtube-mcp-server
npm install
npm run build
npm startThe server starts at http://localhost:3000/mcp in transcript-only mode. Confirm it with:
curl http://localhost:3000/healthConnect from Codex
With the HTTP server running:
codex mcp add youtube-research --url http://localhost:3000/mcpThen ask Codex:
Use research-video to find what this video says about evaluation,
and cite the exact moments: https://www.youtube.com/watch?v=VIDEO_IDConnect with MCP Inspector
npx @modelcontextprotocol/inspector
# Connect to http://localhost:3000/mcpInstall through Smithery
npx -y smithery@latest auth login
npx -y smithery@latest mcp add coyaSONG/youtube-mcp-server --client claudeEnable search, comments, and analytics
Set a YouTube Data API v3 key to switch from transcript-only to full mode:
export YOUTUBE_API_KEY=your_key_here
npm startYOUTUBE_API_KEY is optional. PORT defaults to 3000. For stdio clients, set YOUTUBE_API_KEY in the MCP server environment configuration.
Secure a remote deployment
Do not expose a full-mode server publicly without authentication: unauthenticated users could consume your YouTube API quota. Set a strong bearer token and restrict browser origins when deploying outside localhost:
export MCP_BEARER_TOKEN='replace-with-a-long-random-secret'
export CORS_ORIGIN='https://your-client.example'
export MAX_SESSIONS=100
export SESSION_IDLE_TIMEOUT_MS=1800000
npm startBrowser origins are denied by default. CORS_ORIGIN accepts a comma-separated
allowlist of exact http:// or https:// origins; wildcard origins are rejected.
Connect Codex using an environment variable rather than writing the secret into its configuration:
export YOUTUBE_MCP_TOKEN='replace-with-a-long-random-secret'
codex mcp add youtube-research \
--url https://your-server.example/mcp \
--bearer-token-env-var YOUTUBE_MCP_TOKEN/health remains public for container health checks. MCP requests return 401 when authentication is enabled and the bearer token is missing or invalid. Idle sessions are removed automatically, and MAX_SESSIONS bounds memory use.
Best first tool
research-video accepts:
video: a YouTube URL or 11-character video IDlanguage: optional caption language such asen,ko, orjaquery: optional phrase to find inside the transcriptcontextLines: surrounding segments to retain, from 0 to 5matchMode:word(default) orsubstringstartSeconds/endSeconds: optional time windowoffset: result offset for paginationmaxSegments: response cap from 1 to 1,000 (default: 200)
It returns structured JSON containing the video title and channel identity, canonical video URL, full caption-track duration and segment count, matching transcript segments, human-readable citation labels, timestamps, directly navigable citation URLs, and pagination metadata. For long videos, use a query or time window first; follow nextOffset only when more evidence is needed.
Compare evidence across videos
research-videos applies one focused query to 2–5 video URLs concurrently. It returns the same structured, timestamp-linked evidence for each source while capping results per video. This is useful for comparing interviews, checking whether multiple sources support a claim, or researching a topic across a short watchlist.
{
"videos": [
"https://youtu.be/VIDEO_ONE",
"https://youtu.be/VIDEO_TWO"
],
"query": "evaluation",
"maxSegmentsPerVideo": 10
}See YouTube Research Recipes for copy-paste workflows for fact-checking claims, comparing interviews, navigating long talks, researching multilingual captions, and building citation-ready notes.
Capability modes
Capability | No-key mode | With |
Transcript research, filtering, key moments, segmentation, summaries | Yes | Yes |
Video search and comments | No | Yes |
Video/channel metadata, statistics, trends, and comparisons | No | Yes |
Captions must be available for the requested video. Age-restricted, private, region-restricted, or caption-disabled videos may not return a transcript.
If this project saves you research time, consider starring the repository so other agent builders can discover it.
See the broader AI tooling portfolio for the
reliability principles shared with ralph-research and tmuxicate.
Docker
docker build -t youtube-research-mcp .
docker run --rm -p 3000:3000 youtube-research-mcp
# Full mode
docker run --rm -p 3000:3000 -e YOUTUBE_API_KEY=your_key youtube-research-mcpDevelopment
npm run dev # HTTP server from TypeScript
npm test # build and run all tests
npm run test:live # live public-video transcript and citation smoke test
npm run test:user # clean-room smoke test against the published npm package
npm run test:mcpb # build, unpack, and exercise the installable MCP bundleMaintainers can follow the release guide. Published GitHub releases run the complete npm, MCP Registry, MCPB, and Smithery delivery pipeline.
API Reference
Resources
youtube://video/{videoId}- Get detailed information about a specific videoyoutube://channel/{channelId}- Get information about a specific channelyoutube://transcript/{videoId}- Get transcript for a specific videoOptional query parameter:
?language=LANGUAGE_CODE(e.g.,en,ko,ja)
Tools
Basic Tools
research-video- Get citation-ready transcript evidence from a URL or video ID without an API keyresearch-videos- Compare timestamp-linked evidence across 2–5 videos without an API keysearch-videos- Search for YouTube videos with advanced filtering optionsget-video-comments- Get comments for a specific videoget-video-transcript- Get transcript for a specific video with optional languageenhanced-transcript- Advanced transcript extraction with filtering, search, and multi-video capabilitiesget-key-moments- Extract key moments with timestamps from a video transcript for easier navigationget-segmented-transcript- Divide a video transcript into segments for easier analysis
Tools requiring YOUTUBE_API_KEY are search, comments, statistics, discovery, and channel analysis. enhanced-transcript needs the key only when includeMetadata is true.
Statistical Tools
get-video-stats- Get statistical information for a specific videoget-channel-stats- Get subscriber count, view count, and other channel statisticscompare-videos- Compare statistics across multiple videos
Discovery Tools
get-trending-videos- Retrieve trending videos by region and categoryget-video-categories- Get available video categories for a specific region
Analysis Tools
analyze-channel-videos- Analyze performance trends of videos from a specific channel
Prompts
video-analysis- Generate an analysis of a YouTube videotranscript-summary- Generate a summary of a video based on its transcript with customizable length and keywords extractionsegment-by-segment-analysis- Provide detailed breakdown of content by analyzing each segment of the video
Examples
Accessing a Video Transcript
youtube://transcript/dQw4w9WgXcQGetting a Transcript in a Specific Language
youtube://transcript/dQw4w9WgXcQ?language=enUsing the Statistical Tools
// Get video statistics
{
"type": "tool",
"name": "get-video-stats",
"parameters": {
"videoId": "dQw4w9WgXcQ"
}
}
// Compare multiple videos
{
"type": "tool",
"name": "compare-videos",
"parameters": {
"videoIds": ["dQw4w9WgXcQ", "9bZkp7q19f0"]
}
}Using the Transcript Summary Prompt
{
"type": "prompt",
"name": "transcript-summary",
"parameters": {
"videoId": "dQw4w9WgXcQ",
"language": "en"
}
}Using the Enhanced Transcript Tool
// Basic multi-video transcript extraction
{
"type": "tool",
"name": "enhanced-transcript",
"parameters": {
"videoIds": ["dQw4w9WgXcQ", "9bZkp7q19f0"],
"format": "timestamped"
}
}
// With search and time filtering
{
"type": "tool",
"name": "enhanced-transcript",
"parameters": {
"videoIds": ["dQw4w9WgXcQ"],
"filters": {
"timeRange": {
"start": 60, // Start at 60 seconds
"end": 180 // End at 180 seconds
},
"search": {
"query": "never gonna",
"contextLines": 2
}
},
"format": "merged"
}
}
// With duration-based segmentation for easier analysis
{
"type": "tool",
"name": "enhanced-transcript",
"parameters": {
"videoIds": ["dQw4w9WgXcQ"],
"filters": {
"segment": {
"count": 5,
"method": "smart" // Balances caption duration across segments
}
},
"format": "timestamped",
"language": "en"
}
}Using the Enhanced Transcript Analysis Features
// Get key moments from a video
{
"type": "tool",
"name": "get-key-moments",
"parameters": {
"videoId": "dQw4w9WgXcQ",
"maxMoments": 5
}
}
// Get a segmented transcript
{
"type": "tool",
"name": "get-segmented-transcript",
"parameters": {
"videoId": "dQw4w9WgXcQ",
"segmentCount": 4
}
}
// Get a segment-by-segment analysis
{
"type": "prompt",
"name": "segment-by-segment-analysis",
"parameters": {
"videoId": "dQw4w9WgXcQ",
"segmentCount": 4
}
}
// Get customized transcript summary
{
"type": "prompt",
"name": "transcript-summary",
"parameters": {
"videoId": "dQw4w9WgXcQ",
"language": "en",
"summaryLength": "detailed",
"includeKeywords": true
}
}Error Handling
The server handles various error conditions, including:
Invalid or missing API key for Data API tools
Video or channel not found
Transcript not available
Network issues
License
MIT
Acknowledgements
Comment pagination and evidence limits
search-videos accepts the provider pageToken. get-video-comments preserves the next top-level token and accepts searchTerms for YouTube-side filtering.
Use includeReplies: true for the embedded reply subset, or completeReplies: true for bounded reply pagination. Full retrieval defaults to 100 replies per thread; maxRepliesPerThread accepts 1–1000. Across all threads, each call returns at most 1000 replies and 1 MiB of reply JSON and makes at most 20 additional reply requests. Each Data API request times out after 10 seconds and does not retry automatically.
Inspect each thread's replyCoverage: available is the provider's reported count, returned counts unique replies, complete confirms full observed coverage, and truncated indicates a local budget or pagination guard stopped collection. Counts may change while YouTube comments are being edited. Missing IDs or early provider termination do not establish complete coverage. Reduce the top-level maxResults to reserve more of the shared budget for each thread; pageToken continues top-level threads, not an incomplete reply list.
Research source metadata includes captionRequestedLanguage, captionTrackLanguage, captionLanguage, captionOrigin (manual, youtube_asr, or translated) and captionSourceOrigin. Unknown provenance is null.
Available Tools
12 toolsanalyze-channel-videosC
Analyze recent videos from a specific channel to identify performance trends
Inputs: channelId (required), maxResults, sortBy.
compare-videosC
Compare statistics for multiple YouTube videos
Inputs: videoIds (required).
enhanced-transcriptA
Advanced transcript extraction tool with filtering, search, and multi-video capabilities. Provides rich transcript data for detailed analysis and processing. This tool offers multiple advanced features: 1) Extract transcripts from multiple videos in one request; 2) Filter by time ranges to focus on specific parts; 3) Search for specific content within transcripts; 4) Segment transcripts for structural analysis; 5) Format output in different ways (raw, timestamped, merged text); 6) Include video metadata. Parameters: videoIds (required) - Array of YouTube video IDs (up to 5); language (optional) - Language code; format (optional) - Output format ("raw", "timestamped", "merged"); includeMetadata (optional) - Whether to include video details; filters (optional) - Complex filtering options including timeRange, search, and segment.
Inputs: videoIds (required), filters, format, includeMetadata, +1 more.
get-channel-statsC
Get statistical information for a specific YouTube channel (subscriber count, total views, video count, etc.)
Inputs: channelId (required).
get-key-momentsA
Extract key moments with timestamps from a video transcript for easier navigation and summarization. This tool analyzes the video transcript to identify important segments based on content density and creates a structured output with timestamped key moments. Useful for quickly navigating to important parts of longer videos. Parameters: videoId (required) - The YouTube video ID; maxMoments (optional) - Number of key moments to extract (default: 5, max: 10). Returns a formatted text with key moments and their timestamps, plus the full transcript.
Inputs: videoId (required), maxMoments.
get-segmented-transcriptA
Divide a video transcript into segments for easier analysis and navigation. This tool splits the video into equal time segments and extracts the transcript for each segment with proper timestamps. Ideal for analyzing the structure of longer videos or when you need to focus on specific parts of the content. Parameters: videoId (required) - The YouTube video ID; segmentCount (optional) - Number of segments to divide the video into (default: 4, max: 10). Returns a markdown-formatted text with each segment clearly labeled with time ranges and containing the relevant transcript text.
Inputs: videoId (required), segmentCount.
get-trending-videosB
Retrieve trending videos by region and category. This helps analyze current popular content trends.
Inputs: categoryId, maxResults, regionCode.
get-video-categoriesC
Retrieve available video categories for a specific region
Inputs: regionCode.
get-video-commentsC
Retrieve comments for a specific YouTube video
Inputs: videoId (required), maxResults.
get-video-statsC
Get statistical information for a specific YouTube video (views, likes, comments, upload date, etc.)
Inputs: videoId (required).
get-video-transcriptA
Get the transcript/captions for a YouTube video with optional language selection. This tool retrieves the full transcript of a video with timestamped captions. Each caption includes the text and its timestamp in the video. Parameters: videoId (required) - The YouTube video ID; language (optional) - Language code for the transcript (e.g., "en", "ko", "ja"). If not specified, the default language for the video will be used. Returns a text with each caption line preceded by its timestamp.
Inputs: videoId (required), language.
search-videosB
Search for YouTube videos with advanced filtering options. Supports parameters: - query: Search term (required) - maxResults: Number of results to return (1-50) - channelId: Filter by specific channel - order: Sort by date, rating, viewCount, relevance, title - type: Filter by resource type (video, channel, playlist) - videoDuration: Filter by length (short: <4min, medium: 4-20min, long: >20min) - publishedAfter/publishedBefore: Filter by publish date (ISO format) - videoCaption: Filter by caption availability - videoDefinition: Filter by quality (standard/high) - regionCode: Filter by country (ISO country code)
Inputs: query (required), channelId, maxResults, order, +7 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Most tools have distinct purposes, but there is notable overlap between transcript-related tools (enhanced-transcript, get-video-transcript, get-segmented-transcript, get-key-moments) which could cause confusion. The descriptions help differentiate them, but an agent might struggle to choose the right one for basic transcript needs.
Tool names follow a consistent verb_noun pattern (e.g., get-video-stats, search-videos, analyze-channel-videos) with clear, descriptive naming. The only minor deviation is 'enhanced-transcript' which uses an adjective instead of a verb, but it still fits the overall readable convention.
With 12 tools, the server is well-scoped for YouTube data analysis, covering channels, videos, transcripts, and trends. Each tool serves a specific function without unnecessary duplication, making the count appropriate for the domain.
The toolset provides comprehensive coverage for YouTube analysis, including video and channel stats, transcripts, comments, search, and trending data. Minor gaps exist, such as no tools for playlist management or direct video upload/modification, but core analytical workflows are well-supported.
Maintenance
Related MCP Connectors
Real-time YouTube transcripts, comments, channels & video search MCP. Local npx or hosted OAuth.
YouTube search, whole channels, video stats, comments and full transcripts with timestamps.
YouTube discovery, transcripts, library search, and monitors with API keys or OAuth.
YouTube video/channel search, suggestions, details, comments/replies, Shorts, transcripts, paging.
Related MCP Servers
- AlicenseAqualityBmaintenanceA Model Context Protocol server that enables access to YouTube video content through transcripts, translations, summaries, and subtitle generation in various languages.55MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables searching YouTube videos, retrieving and storing transcripts, and performing semantic search over video content without using the official YouTube API.46MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables AI assistants to access YouTube data in real-time, with capabilities for searching videos, analyzing channels, retrieving video details, and extracting transcripts.14MIT
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides comprehensive YouTube search functionality, enabling users to search for videos, channels, and playlists with advanced filtering options using the YouTube Data API.-