Content
# YouTube Transcript MCP Server
A Model Context Protocol (MCP) server that provides YouTube video transcript retrieval capabilities using the `youtube_transcript_api` library.
## Features
- Fetch transcripts from any YouTube video using its video ID
- Support for multiple language transcripts
- MCP-compliant server implementation
- Error handling and logging
- Configurable through environment variables
## Prerequisites
- Python 3.x
- UV package manager
## Installation
1. Clone the repository:
```bash
git clone git@github.com:shahshrey/youtube_transcript_mcp.git
cd youtube_transcript_server
```
2. Create a virtual environment and install dependencies:
```bash
uv venv
source .venv/bin/activate # On Unix/macOS
# or
.venv\Scripts\activate # On Windows
uv pip install -r requirements.txt
```
## API
### Resources
- None currently implemented
### Tools
- **get_transcript**
- Retrieves the transcript of a YouTube video
- Input:
- `video_id` (string, required): YouTube video ID
- `languages` (string[], optional): Preferred language codes
- Returns:
- Text content of the transcript with timestamps removed
- Error details if the operation fails
**Example Request:**
```json
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "get_transcript",
"arguments": {
"video_id": "dQw4w9WgXcQ",
"languages": ["en"]
}
},
"id": 1
}
```
**Example Response:**
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [
{
"type": "text",
"text": "First line of transcript\nSecond line of transcript\n..."
}
]
}
}
```
## Server Capabilities
- Protocol Version: Compatible with client's protocol version
- Tools Available: Yes
- Resources Available: No
- Resource Templates Available: No
## Error Handling
The server implements robust error handling for:
- Invalid video IDs
- Unavailable transcripts
- Language availability
- Network issues
- Invalid requests
**Example Error Response:**
```json
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32000,
"message": "Error getting transcript: Video id dQw4w9WgXcQ does not exist"
}
}
```
## Development
The server is built with a focus on:
- Clean separation of concerns
- Comprehensive logging
- Type hints for better code maintainability
- Error handling with informative messages
## Configuration
### Environment Variables
- `PYTHONUNBUFFERED`: Set to '1' to disable output buffering
- `LOGGING_LEVEL`: Set logging level (DEBUG, INFO, WARNING, ERROR)
### Usage with Claude Desktop
Add this to your `claude_desktop_config.json`:
```json
{
"mcpServers": {
"youtube_transcript": {
"command": "path_to_your_python_executable or python",
"args": [
"path_to_ /youtube_transcript_server.py"
]
}
}
}
```
## Testing
Run the test suite using:
```bash
python -m pytest test_transcript.py
```
## Build
To build and package the server:
```bash
python -m build
```
## License
MIT License
Copyright (c) 2023 [Your Name]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
## Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
Please make sure to update tests as appropriate and adhere to the existing coding style.
Connection Info
You Might Also Like
liki
Liki — 专业命理 Skill:天文历算引擎排盘,断语附经典出处,结论可验证。八字 · 紫微 · 六爻 · 奇门 · 黄历择日 · 风水 · 起名...
agentic-career-search
Agentic job-discovery backend: 119 ATS & job-board adapters (Greenhouse,...
awesome-ai-reverse-engineering
AI 辅助逆向工程工具清单,收录 MCP、Skill、插件、Agent 与工作站,覆盖 Web、二进制、移动端、浏览器自动化和流量分析。
Envoy
把链接分享给你的 AI:提取网页、视频与本地媒体中的可追溯材料。 / Share links with your AI: extract...
mctaste-lab
麦麦偏爱实验室|几轮餐品二选一,生成可解释、可调整的偏好与探索推荐。麦当劳 MCP 创意开发大赛独立作品。
maimen-xinshi
麦门心事:把一句心事读成一顿麦当劳,再让三个陌生人决定这顿吃不吃。基于麦当劳中国 MCP 的 Skill + 零依赖单文件演示页。