video-transcript-fetcher
by alvarosw
README.md
# video-transcript-fetcher
An [MCP](https://modelcontextprotocol.io) server that gets the transcript of an online video from its URL.
- **YouTube**: uses the captions already published on the video first (manual or auto-generated). This is free, takes about a second and needs no API key.
- **Instagram** (reels/posts), and any YouTube video without captions: downloads the audio and runs speech-to-text.
- **Speech-to-text providers you can plug in**: NVIDIA (free API key), Groq (free tier), OpenAI or any OpenAI-compatible API, plus a **local Whisper model** that runs offline with no key at all.
```text
You: summarize https://youtu.be/jNQXAC9IVRw
Claude → transcribe_video(url) → "Title: Me at the zoo … All right, so here we are, in front of the elephants…"
```
## Quick start
### Claude Code
```bash
claude mcp add video-transcript -e VTF_NVIDIA_API_KEY=nvapi-xxx -- npx -y video-transcript-fetcher
```
### Claude Desktop, Cursor and other MCP clients
```json
{
"mcpServers": {
"video-transcript": {
"command": "npx",
"args": ["-y", "video-transcript-fetcher"],
"env": {
"VTF_NVIDIA_API_KEY": "nvapi-xxx"
}
}
}
}
```
With no key at all, YouTube videos that have captions still work. To transcribe audio without any API key, use the local model (see below).
### Interactive setup
```bash
npx video-transcript-fetcher setup
```
`setup` downloads yt-dlp, asks whether you want the local Whisper model (and which size), downloads it, and prints the MCP config to paste into your client. `doctor` shows what is configured:
```bash
npx video-transcript-fetcher doctor
```
## Tools
| Tool | What it does |
|---|---|
| `transcribe_video` | `url` (required), `mode`, `language`, `provider`, `model`, `format` |
| `list_transcription_providers` | Lists the providers, which ones are configured, the default and their models |
- `mode`
- `auto` (default): published captions first, speech-to-text if there are none.
- `captions`: captions only. Fails if the video has none.
- `transcribe`: always runs speech-to-text.
- `format`
- `text` (default): plain transcript with a short metadata header.
- `timestamped`: one `[MM:SS] …` line per segment.
- `srt`: subtitle file.
- `json`: full structured result with segments.
- `language`: for example `pt` or `en`. It picks the caption track and is passed to speech-to-text as a hint. If you leave it out, the server uses the language the platform reports.
## Speech-to-text providers
**Each provider is enabled by setting its environment variable.** All variables use the `VTF_` prefix. The server never reads un-prefixed keys like `OPENAI_API_KEY`, so it can't spend money on a key you set for something else.
| id | Enable with | Free? | Default model | Notes |
|---|---|---|---|---|
| `nvidia` | `VTF_NVIDIA_API_KEY` | ✅ free key at [build.nvidia.com](https://build.nvidia.com) | `whisper-large-v3` | Riva gRPC on NVCF. Whisper returns no word timings, so timestamps are per 60 s chunk. `parakeet-ctc-1.1b-asr` (English only) gives fine-grained timestamps. |
| `groq` | `VTF_GROQ_API_KEY` | ✅ free tier | `whisper-large-v3-turbo` | Very fast |
| `openai` | `VTF_OPENAI_API_KEY` | 💲 | `gpt-4o-mini-transcribe` | `VTF_OPENAI_BASE_URL` works with any OpenAI-compatible API |
| `local` | `setup` (or `VTF_LOCAL_ENABLED=true`) | ✅ offline | `onnx-community/whisper-base` | Runs on your CPU with transformers.js |
When the caller doesn't name a provider, the server uses `VTF_DEFAULT_PROVIDER` if set. Otherwise it takes the first available one in the order nvidia → groq → openai → local.
### Should I use the local model?
It's a good choice when you want privacy, zero cost or no account. Things to know first:
- **Disk:** the runtime (onnxruntime) is about 700 MB, which is why it isn't installed unless you choose it in `setup`. The models range from about 40 MB (`whisper-tiny`) to about 800 MB (`whisper-large-v3-turbo`).
- **Speed:** it runs on the CPU, so it is much slower than the cloud providers, and larger models are slower still. `tiny` and `base` are practical on a laptop; `large-v3-turbo` needs a fast machine.
- **Accuracy:** the cloud providers run `whisper-large-v3`, which is noticeably better for Portuguese and other non-English audio than `tiny` or `base`. If you go local, pick `whisper-small` or larger for non-English content.
## Configuration reference
| Variable | Description |
|---|---|
| `VTF_NVIDIA_API_KEY` | Enables NVIDIA |
| `VTF_NVIDIA_MODEL` | `whisper-large-v3` (default, multilingual) or `parakeet-ctc-1.1b-asr` |
| `VTF_NVIDIA_FUNCTION_ID` | NVCF function id for a model that isn't in the built-in catalog |
| `VTF_NVIDIA_SERVER` | gRPC endpoint (default `grpc.nvcf.nvidia.com:443`) |
| `VTF_GROQ_API_KEY` / `VTF_GROQ_MODEL` | Groq |
| `VTF_OPENAI_API_KEY` / `VTF_OPENAI_MODEL` / `VTF_OPENAI_BASE_URL` | OpenAI or a compatible API |
| `VTF_LOCAL_ENABLED` | `auto` (default) / `true` / `false` |
| `VTF_LOCAL_MODEL` | e.g. `onnx-community/whisper-small` |
| `VTF_LOCAL_CACHE_DIR` | Where model weights are stored |
| `VTF_DEFAULT_PROVIDER` | Provider used when the caller doesn't name one |
| `VTF_CAPTION_LANGUAGES` | Preferred caption languages, e.g. `pt,en` |
| `VTF_COOKIES_FILE` | Netscape `cookies.txt` passed to yt-dlp (Instagram often needs a logged-in session) |
| `VTF_COOKIES_FROM_BROWSER` | e.g. `firefox` or `chrome` (yt-dlp reads cookies from your browser) |
| `VTF_YTDLP_PATH` | Use this yt-dlp binary. If unset: `yt-dlp` on PATH, otherwise downloaded automatically |
| `VTF_FFMPEG_PATH` | Use this ffmpeg. If unset: the bundled `ffmpeg-static` |
| `VTF_MAX_DURATION_SECONDS` | Refuse longer videos (default 14400 = 4 h, `0` = no limit) |
| `VTF_TMP_DIR` / `VTF_CACHE_DIR` | Temporary files / cached binaries and the local runtime |
| `VTF_LOG_LEVEL` | `debug` … `silent` (logs go to stderr) |
## How it works
```text
URL ─► source.parse ─► captions? ──yes──► transcript (free)
│no
▼
temp dir ◄─ yt-dlp audio ─► ffmpeg (mono, resampled, chunked) ─► provider × N chunks ─► merged transcript
└──────────── always deleted afterwards ─────────────┘
```
The code uses ports and adapters: platforms, caption sources, audio processing and speech-to-text providers are all swappable adapters behind small interfaces. See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md), which also explains how to add a provider or a platform.
## CLI
```bash
npx video-transcript-fetcher transcribe "https://www.youtube.com/watch?v=jNQXAC9IVRw" --format timestamped
npx video-transcript-fetcher transcribe "https://www.instagram.com/reel/XXXX/" --provider nvidia --language pt
```
## Development
```bash
npm install
npm test # unit + integration tests (offline)
npm run test:e2e # live tests; provider tests run only when their VTF_* keys are set
npm run lint && npm run typecheck && npm run build
```
Requires Node.js 20 or newer.
## Notes and limitations
- Instagram frequently asks for a login. If a download fails, set `VTF_COOKIES_FROM_BROWSER` or `VTF_COOKIES_FILE`.
- YouTube changes its internals from time to time. Captions are fetched through two independent paths (a direct HTTP call and yt-dlp) so that one breaking doesn't take both down. Keep yt-dlp current by deleting the cached binary, or point `VTF_YTDLP_PATH` at a yt-dlp you keep updated.
- Respect the terms of service of the platforms and the rights of content owners.
## License
MIT
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues