yt-subs
Extracts clean text transcripts from YouTube videos using their subtitles and returns them as plain text.
README
YouTube Subtitles MCP Server
An MCP (Model Context Protocol) server that extracts clean text transcripts from YouTube videos using their subtitles.
Features
- Extract English subtitles (auto-generated or manual) from YouTube videos
- Convert subtitle files to clean, deduplicated plain text
- Save transcripts to local files or return them directly
- Works with any MCP-compatible client (Claude Desktop, etc.)
Prerequisites
Before using this MCP server, you must have the following tools installed:
Required Dependencies
-
yt-dlp - YouTube video downloader
# Install via Homebrew (macOS) brew install yt-dlp # Or via pip pip install yt-dlp -
ffmpeg - Media file converter
# Install via Homebrew (macOS) brew install ffmpeg # Or via apt (Linux) sudo apt install ffmpeg -
Node.js - Version 18 or higher
# Check your version node --version # Install via Homebrew (macOS) brew install node
Installation
Quick Start (Using npx)
No installation required! Just add to your MCP client configuration:
{
"mcpServers": {
"yt-subs": {
"command": "npx",
"args": ["-y", "yt-subs-mcp"]
}
}
}
Note: You still need to have yt-dlp and ffmpeg installed on your system (see Prerequisites above).
Claude Desktop Configuration
Edit your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add the server to the mcpServers section:
Option 1: Using npx (recommended)
{
"mcpServers": {
"yt-subs": {
"command": "npx",
"args": ["-y", "yt-subs-mcp"],
"env": {
"YT_SUBS_DOWNLOAD_DIR": "/path/to/your/transcripts"
}
}
}
}
Option 2: Using local installation
{
"mcpServers": {
"yt-subs": {
"command": "node",
"args": ["/absolute/path/to/yt-subs/index.js"]
}
}
}
For Local Development
-
Clone this repository
-
Install dependencies:
npm install -
Make the script executable:
chmod +x index.js
Usage
Once configured in your MCP client, you can use the get_youtube_transcript tool:
Tool: get_youtube_transcript
Extracts the subtitle/transcript text from a YouTube video URL.
Parameters:
url(required): The YouTube video URLsave_to_file(optional): Whether to save the transcript to a file (default: true)
Examples:
// Get transcript and save to file
{
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"save_to_file": true
}
// Get transcript without saving
{
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"save_to_file": false
}
Response:
{
"success": true,
"video_id": "dQw4w9WgXcQ",
"transcript": "Never gonna give you up\nNever gonna let you down...",
"saved_to": "/Users/yourname/Downloads/yts/dQw4w9WgXcQ.txt",
"message": "Transcript extracted and saved to /Users/yourname/Downloads/yts/dQw4w9WgXcQ.txt"
}
Configuration
Environment Variables
- YT_SUBS_DOWNLOAD_DIR: Custom directory for saving transcript files
- If not set, defaults to
~/Downloads/yts/ - Must be an absolute path
- Directory will be created if it doesn't exist
- If not set, defaults to
Example:
export YT_SUBS_DOWNLOAD_DIR="/path/to/your/transcripts"
Setting Environment Variables in Claude Desktop
To use a custom download directory, add the env property to your server configuration:
{
"mcpServers": {
"yt-subs": {
"command": "node",
"args": ["/absolute/path/to/yt-subs/index.js"],
"env": {
"YT_SUBS_DOWNLOAD_DIR": "/path/to/your/transcripts"
}
}
}
}
Output Location
By default, transcript files are saved to:
~/Downloads/yts/
Or to the directory specified by YT_SUBS_DOWNLOAD_DIR environment variable.
Each transcript is saved with the video ID as the filename:
VIDEO_ID.txt
How It Works
- Extracts the video ID from the provided YouTube URL
- Downloads English subtitles (VTT format) using yt-dlp
- Converts VTT to SRT format using ffmpeg
- Extracts and deduplicates text content
- Cleans up temporary files
- Returns the clean transcript text
Troubleshooting
"Missing required dependencies" error
Make sure yt-dlp and ffmpeg are installed and available in your PATH:
which yt-dlp
which ffmpeg
"Failed to download subtitle" error
The video may not have English subtitles available. Try a different video or check if subtitles exist on YouTube.
"Could not extract video ID" error
Ensure you're providing a valid YouTube URL format:
https://www.youtube.com/watch?v=VIDEO_IDhttps://youtu.be/VIDEO_ID
Development
Running Locally
npm start
The server will run on stdio and wait for MCP protocol messages.
Testing
You can test the server using an MCP client or by sending JSON-RPC messages via stdio.
Publishing to npm
If you want to publish your own version to npm:
-
Update the package name in
package.jsonto something unique -
Update the repository URLs to your GitHub repository
-
Add your author information
-
Login to npm:
npm login -
Publish:
npm publish
Before publishing, make sure to:
- Test the package locally using
npm packandnpm install -g ./yt-subs-mcp-1.0.0.tgz - Update the version number following semver
- Ensure README is up to date
- Add appropriate tags and keywords
License
MIT
Credits
Based on the yt-subs bash script for extracting YouTube subtitles.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.