YouTube Subtitle MCP Server
Enables fetching subtitles and transcripts from public YouTube videos with support for multiple output formats (SRT, VTT, TXT, JSON), multi-language subtitle support, and complete timestamp information.
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 Subtitle MCP Serverfetch subtitles from https://youtu.be/dQw4w9WgXcQ in SRT format"
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 Subtitle MCP Server
A Model Context Protocol (MCP) server for fetching YouTube video subtitles/transcripts with support for multiple output formats (SRT, VTT, TXT, JSON).
⨠Features
š„ Fetch subtitles from any public YouTube video
š Multiple output formats: SRT, VTT, TXT, JSON
š Multi-language subtitle support
ā” Two deployment modes: stdio (local) and HTTP (server)
š§ Zero-configuration setup with npx
š Complete timestamp information
š Production-ready with TypeScript
š„ Built with youtubei.js for reliable and stable subtitle extraction
Related MCP server: YouTube Transcript MCP Server
š Quick Start
ā Method 1: stdio Mode (Recommended for Local Use)
Zero configuration required! Simply use npx:
npx -y youtube-subtitle-mcpOr install globally:
npm install -g youtube-subtitle-mcp
youtube-subtitle-mcpš Method 2: HTTP Mode (For Server Deployment)
# Clone repository
git clone https://github.com/guangxiangdebizi/youtube-subtitle-mcp.git
cd youtube-subtitle-mcp
# Install dependencies
npm install
# Build
npm run build
# Start HTTP server
npm run start:httpServer will start at http://localhost:3000
š¦ Installation
For Development
# Clone repository
git clone https://github.com/guangxiangdebizi/youtube-subtitle-mcp.git
cd youtube-subtitle-mcp
# Install dependencies
npm install
# Build
npm run buildFor Production
npm install -g youtube-subtitle-mcpš§ Configuration
ā stdio Mode Configuration (Recommended)
Add to your MCP client configuration file:
Claude Desktop / Cursor Configuration:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"youtube-subtitle": {
"command": "npx",
"args": ["-y", "youtube-subtitle-mcp"]
}
}
}For local development:
{
"mcpServers": {
"youtube-subtitle": {
"command": "node",
"args": ["C:/path/to/youtube-subtitle-mcp/build/index.js"]
}
}
}š HTTP Mode Configuration
{
"mcpServers": {
"youtube-subtitle": {
"type": "streamableHttp",
"url": "http://localhost:3000/mcp",
"timeout": 600
}
}
}š ļø Tool: fetch_youtube_subtitles
Parameters
Parameter | Type | Required | Description | Example |
| string | ā Yes | YouTube video URL or video ID |
|
| string | ā No | Output format (default: JSON) |
|
| string | ā No | Language code (default: auto) |
|
Supported URL Formats
Standard:
https://www.youtube.com/watch?v=VIDEO_IDShort:
https://youtu.be/VIDEO_IDEmbed:
https://www.youtube.com/embed/VIDEO_IDDirect ID:
VIDEO_ID
Language Codes
zh-Hans- Simplified Chinesezh-Hant- Traditional Chineseen- Englishja- Japaneseko- Koreanes- Spanishfr- Frenchde- German
š Usage Examples
Example 1: Fetch JSON Format Subtitles (Default)
Please fetch subtitles from this video:
https://www.youtube.com/watch?v=dQw4w9WgXcQExample 2: Fetch SRT Format Subtitles
Please fetch subtitles in SRT format from:
https://www.youtube.com/watch?v=dQw4w9WgXcQExample 3: Fetch Specific Language Subtitles
Please fetch Simplified Chinese subtitles in VTT format from:
https://www.youtube.com/watch?v=dQw4w9WgXcQ
Language code: zh-HansExample 4: Fetch Plain Text Content
Please fetch plain text subtitles from:
https://youtu.be/dQw4w9WgXcQ
Format: TXTš Output Format Examples
JSON Format
[
{
"text": "Hello world",
"start": 0,
"end": 2000,
"duration": 2000
},
{
"text": "Welcome to YouTube",
"start": 2000,
"end": 5000,
"duration": 3000
}
]SRT Format
1
00:00:00,000 --> 00:00:02,000
Hello world
2
00:00:02,000 --> 00:00:05,000
Welcome to YouTubeVTT Format
WEBVTT
00:00:00.000 --> 00:00:02.000
Hello world
00:00:02.000 --> 00:00:05.000
Welcome to YouTubeTXT Format
Hello world
Welcome to YouTube
This is a subtitle examplešļø Project Structure
youtube-subtitle-mcp/
āāā src/
ā āāā index.ts # stdio mode entry (recommended for local use)
ā āāā httpServer.ts # HTTP mode entry (for server deployment)
ā āāā tools/
ā āāā fetchYoutubeSubtitles.ts # Main tool implementation
ā āāā formatters.ts # Format converters (SRT/VTT/TXT/JSON)
ā āāā utils.ts # Utility functions
āāā build/ # Compiled JavaScript (generated)
āāā package.json
āāā tsconfig.json
āāā README.mdš Development
Build
npm run buildWatch Mode
npm run watchStart stdio Mode
npm run start:stdioStart HTTP Mode
npm run start:httpCustom Port (HTTP Mode)
PORT=8080 npm run start:httpš³ Docker Deployment
Using Docker
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "run", "start:http"]# Build image
docker build -t youtube-subtitle-mcp .
# Run container
docker run -d -p 3000:3000 --name youtube-mcp youtube-subtitle-mcpUsing Docker Compose
version: '3.8'
services:
youtube-subtitle-mcp:
build: .
ports:
- "3000:3000"
environment:
- PORT=3000
restart: unless-stoppeddocker-compose up -dš Deployment
PM2 (Process Manager)
# Install PM2
npm install -g pm2
# Start service
pm2 start build/httpServer.js --name youtube-subtitle-mcp
# View status
pm2 status
# View logs
pm2 logs youtube-subtitle-mcp
# Restart
pm2 restart youtube-subtitle-mcp
# Stop
pm2 stop youtube-subtitle-mcpš API Reference
Health Check (HTTP Mode)
Endpoint: GET /health
Response:
{
"status": "healthy",
"transport": "streamable-http",
"activeSessions": 0,
"name": "youtube-subtitle-mcp",
"version": "1.0.0",
"timestamp": "2024-01-01T12:00:00.000Z"
}MCP Endpoint (HTTP Mode)
Endpoint: POST /mcp
Headers:
Content-Type: application/jsonMcp-Session-Id: <session-id>(after initialization)
Request Body: JSON-RPC 2.0 format
ā ļø Notes
Public videos only: Cannot fetch subtitles from private or restricted videos
Subtitles required: Video must have available subtitles (auto-generated or uploaded)
Language codes: If specified language doesn't exist, an error will be returned
Network required: Requires stable network connection to access YouTube
Terms of Service: Please comply with YouTube's Terms of Service, use for research/analysis purposes only
ā FAQ
Q: Server started but client can't connect?
A: Check the following:
Verify server is running: visit
http://localhost:3000/healthCheck URL in configuration file:
http://localhost:3000/mcpEnsure firewall isn't blocking port 3000
Restart Cursor/Claude Desktop
Q: Why can't I fetch subtitles?
A: Possible reasons:
Video has no subtitles
Video is private or region-restricted
Specified language code doesn't exist
Network connection issue
Server network can't access YouTube
Q: Do you support auto-generated subtitles?
A: Yes, supports YouTube auto-generated subtitles.
Q: Can I batch process multiple videos?
A: Current version processes one video at a time. For batch processing, loop the tool call on the client side.
Q: What's the timestamp unit?
A: Timestamps in JSON format are in milliseconds (ms).
Q: Can I deploy on a remote server?
A: Yes! Just:
Install Node.js on remote server
Clone project and run
npm installStart server with
npm run start:httpUse remote URL in client configuration:
http://your-server:3000/mcpRecommend using HTTPS and reverse proxy (e.g., Nginx) for security
Q: How to change port?
A: Two methods:
Environment variable:
PORT=8080 npm run start:httpCreate
.envfile: addPORT=8080
š¤ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
š License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
š¤ Author
Xingyu Chen
š Acknowledgments
Model Context Protocol - MCP SDK
youtubei.js - Powerful YouTube API wrapper for reliable subtitle extraction
š® Support
If you have any questions or suggestions, please create an Issue.
Made with ā¤ļø by Xingyu Chen
Available Tools
1 toolfetch_youtube_subtitlesFetch YouTube SubtitlesA
Fetch subtitles/transcripts from YouTube videos. Supports multiple output formats (SRT, VTT, TXT, JSON) and language selection. Returns complete subtitle content with timestamps.
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | YouTube video URL or video ID. Supported formats: https://www.youtube.com/watch?v=xxx, https://youtu.be/xxx, or direct video ID | |
| format | No | Output format. SRT: subtitle file format (with sequence numbers), VTT: WebVTT format, TXT: plain text (text only), JSON: structured JSON (with timestamps) | JSON |
| lang | No | Subtitle language code (optional). Examples: zh-Hans (Simplified Chinese), zh-Hant (Traditional Chinese), en (English). Auto-detect if not specified |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions output formats and language auto-detection, which are useful, but lacks details on error handling, rate limits, authentication needs, or whether the operation is read-only (implied by 'fetch'). More behavioral context would improve transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with core functionality and efficiently lists key features in a single, well-structured sentence. Every element ('fetch subtitles/transcripts', 'output formats', 'language selection', 'returns content') adds value without redundancy, making it appropriately sized and easy to parse.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations and no output schema, the description adequately covers the tool's purpose and basic features, but lacks completeness for a tool with 3 parameters and potential behavioral complexities. It does not explain return values in detail or address edge cases, leaving gaps in contextual understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds marginal value by summarizing key parameters ('multiple output formats', 'language selection'), but does not provide additional semantics beyond what's in the schema. Baseline is 3, but the concise mention of parameters in context slightly elevates it.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('fetch subtitles/transcripts'), target resource ('YouTube videos'), and key capabilities ('multiple output formats', 'language selection', 'complete subtitle content with timestamps'). It uses precise verbs and distinguishes what the tool does without redundancy.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage context through features like format and language selection, but provides no explicit guidance on when to use this tool versus alternatives (e.g., for different video platforms or content types). Since no sibling tools are listed, this is less critical, but general best practices are not addressed.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
- First observed
fetch_youtube_subtitles
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap between tools. The tool has a clear, distinct purpose focused on fetching YouTube subtitles.
Since there is only one tool, naming consistency is inherently perfect. The tool name 'fetch_youtube_subtitles' follows a clear verb_noun pattern, but no comparison is needed.
A single tool is too few for a server with the apparent scope of YouTube subtitle management, as it lacks operations like searching for videos, handling errors, or managing subtitle files. This minimal set may cause agent failures due to incomplete functionality.
The server is severely incomplete for its domain; it only provides fetching subtitles but lacks essential operations such as searching for videos, uploading or editing subtitles, or handling multiple videos. This creates significant gaps in coverage for subtitle-related workflows.
Maintenance
Related MCP Connectors
Fetch transcripts, subtitles, chapters, metadata and frames from YouTube and 10+ video platforms
Search YouTube, read video metadata, and fetch transcripts with language preferences
Fetch the full transcript of any YouTube video as clean text. No API key, no signup.
YouTube transcripts, subtitles, and video metadata as structured JSON via an Apify Actor.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables fetching, searching, and analyzing YouTube video transcripts in multiple languages using yt-dlp. Supports timestamp filtering, language detection, and transcript summaries with robust error handling for production use.4MIT
- AlicenseAqualityFmaintenanceRetrieves transcripts from YouTube videos with support for multiple languages, timestamp control, and language detection. Enables video content analysis, summarization, and quote extraction without manually downloading or watching videos.27515MIT
- FlicenseBqualityNot gradedmaintenanceEnables extraction and processing of YouTube video transcripts from individual videos, channels, and playlists. Supports transcript search, batch processing, multiple output formats (JSON, text, SRT, VTT), and bulk operations across multiple videos.1134-
- AlicenseAqualityDmaintenanceEnables fetching, searching, and summarizing YouTube video transcripts with multi-language support.4MIT