YouTube Subtitles
YouTube Subtitles MCP Server
A Model Context Protocol (MCP) server that allows AI assistants like Claude to download and analyze YouTube video subtitles.
Features
- Download YouTube Subtitles: Get subtitles from any YouTube video
- Language Support: Download subtitles in any available language
- Video Information: Retrieve video metadata (title, duration, upload date, etc.)
- Multiple Language Detection: List all available subtitle languages for a video
- Seamless AI Integration: Works with Claude and other MCP-compatible assistants
- Docker Support: Easy deployment with Docker
Requirements
- Python 3.10+
- yt-dlp
- ffmpeg
- MCP-compatible client (like Claude Desktop)
- Docker (optional, for containerized deployment)
Installation
Using Docker (Recommended)
-
Clone this repository:
git clone https://github.com/setkyar/youtube-subtitles-mcp.git cd youtube-subtitles-mcp
-
Build and run with Docker:
docker build -t mcp/youtube-subtitles .
Manual Installation
-
Clone this repository:
git clone https://github.com/setkyar/youtube-subtitles-mcp.git cd youtube-subtitles-mcp
-
Install dependencies:
pip install "mcp[cli]>=1.2.0" yt-dlp
-
Install ffmpeg:
- On Ubuntu/Debian:
sudo apt-get install ffmpeg
- On macOS (Homebrew):
brew install ffmpeg
- On Windows: Download from ffmpeg.org
- On Ubuntu/Debian:
-
Run the server:
python youtube_subtitles_server.py
Integration with Claude Desktop
- Open Claude Desktop
- Click on the Claude menu and select "Settings"
- Click on "Developer" in the left sidebar
- Click on "Edit Config"
- Update the configuration to include your MCP server:
{
"mcpServers": {
"youtube-subtitles": {
"command": "docker",
"args": ["run", "-i", "mcp/youtube-subtitles"]
}
}
}
- Save the file and restart Claude Desktop
Usage Examples
Once integrated with an MCP client like Claude Desktop, you can:
-
Get video information:
What's the title and upload date of this YouTube video: https://www.youtube.com/watch?v=dQw4w9WgXcQ
-
List available subtitle languages:
What subtitle languages are available for this video: https://www.youtube.com/watch?v=dQw4w9WgXcQ
-
Download and analyze subtitles:
Can you get the English subtitles for this video and summarize what it's about? https://www.youtube.com/watch?v=dQw4w9WgXcQ
-
Translate subtitles:
Get the Spanish subtitles for this video and translate them to English: https://www.youtube.com/watch?v=dQw4w9WgXcQ
How It Works
The server exposes three main tools to MCP clients:
get_video_info
: Retrieves basic metadata about a YouTube videolist_subtitle_languages
: Shows available subtitle languages for a videodownload_subtitles
: Downloads and formats subtitles in a specific language
All operations are performed using yt-dlp, a powerful YouTube-dl fork with better support for subtitles and formats.
Docker Configuration
The included Dockerfile:
- Uses Python 3.10 as the base image
- Installs ffmpeg for subtitle processing
- Installs required Python dependencies
- Sets up the MCP server to run via stdio transport
For custom Docker setup, you can modify the Dockerfile or docker-compose.yml file according to your needs.
Troubleshooting
Common Issues and Solutions
- Subtitles not available: Not all YouTube videos have subtitles. Try another video.
- Missing languages: Some videos only have auto-generated subtitles in the original language.
- Docker connection problems: Ensure the container is running and Claude Desktop is configured correctly.
Logs
Docker logs can be viewed with:
docker logs youtube-subtitles-mcp
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Acknowledgments
- Thanks to the yt-dlp team for their amazing tool
- Thanks to the Model Context Protocol for enabling AI assistant integrations