Content
# YouTube Transcript MCP Server
A FastMCP server designed to fetch YouTube video transcripts by using a full video URL or an 11-character video ID. This server integrates seamlessly with AI coding assistants and agents like Cursor via standard input/output (stdio).
## Features
- **Flexible Input**: Supports full YouTube watch URLs, short links (`youtu.be`), embedded URLs, shorts, and raw 11-character video IDs.
- **Language Priority**: Allows specifying a fallback list of language codes (defaults to English and Spanish).
- **Universal Compatibility**: Implements the modern `fetch()` and `.to_raw_data()` pattern compatible with version 1.x of the underlying transcript library.
## Prerequisites
- Python 3.10 or higher
- A configured virtual environment (`.venv`)
## Installation
1. Clone this repository to your local machine:
```bash
git clone https://github.com/JoseGonzalezAlonso/Local-MCP-server.git
cd Local-MCP-server
```
2. Create and activate a virtual environment:
```bash
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
```
3. Install dependencies:
```bash
pip install -r requirements.txt
```
## Usage
### With Claude Desktop
Add to your `claude_desktop_config.json`:
```json
{
"mcpServers": {
"youtube-transcript": {
"command": "/absolute/path/to/.venv/bin/python",
"args": ["/absolute/path/to/Local-MCP-server/src/server.py"]
}
}
}
```
### With Cursor
Add to `.cursor/mcp.json` in your project:
```json
{
"mcpServers": {
"youtube-transcript": {
"command": "/absolute/path/to/.venv/bin/python",
"args": ["/absolute/path/to/Local-MCP-server/src/server.py"]
}
}
}
```
### Testing locally with the MCP Inspector
```bash
mcp dev src/server.py
```
### Example
Once connected, ask your AI assistant something like:
> Get the transcript for https://www.youtube.com/watch?v=dQw4w9WgXcQ
The `get_youtube_transcript` tool accepts:
| Argument | Type | Required | Description |
|---|---|---|---|
| `video_url_or_id` | `str` | Yes | Full URL, short link, embed link, shorts link, or raw video ID |
| `languages` | `list[str]` | No | Language codes in priority order (default: `["en", "es"]`) |
## License
MIT — see [LICENSE](LICENSE)