Skip to main content
Glama

Yt-to-transcript-MCP

Turn any YouTube video into a transcript from inside Claude, Gemini, or ChatGPT.

A single Model Context Protocol server, written in Python. It speaks stdio for desktop clients (Claude Desktop, Claude Code, Gemini CLI) and streamable-http / sse for remote clients (ChatGPT web, the OpenAI Responses API). One codebase, three assistants.

Repository: https://github.com/YassineBadriDev/Yt-to-transcript-MCP


What it does

YouTube URL / video ID
   │
   ├─ 1. youtube-transcript-api  → human captions, then auto-generated captions
   ├─ 2. yt-dlp                  → direct caption-track download (fallback if 1 is IP-blocked)
   └─ 3. Whisper (optional)      → download audio + local speech-to-text (videos with NO captions)
   │
   ▼
text · timestamped lines · Markdown · SRT · WebVTT · JSON

It also lists available caption languages, translates auto-captions, searches inside a transcript, slices a time range, and exposes video metadata (title, channel, duration, chapters). MCP resources and a prompt template are included too.

No API key required. It uses YouTube's public caption tracks. Whisper runs locally and needs no external service either.

Related MCP server: YouTube Transcript MCP Server

Tools

Tool

Purpose

get_transcript

Main tool. URL or ID → transcript in text, timestamped, markdown, srt, vtt, or json. Supports language, translate_to, prefer, max_chars.

get_video_info

Title, channel, duration, chapters, views, upload date (via yt-dlp, with an oEmbed fallback).

list_transcript_languages

All caption tracks, human vs auto-generated, and available translation targets.

get_transcript_range

Only the captions between two timestamps — essential for long videos.

search_transcript

Find a word/phrase and get timestamped matches with surrounding context.

save_transcript

Write the transcript to .txt / .srt / .vtt / .md / .json.

transcribe_audio

Whisper fallback for videos with no captions at all.

Resources: youtube://video/{id}/info, youtube://video/{id}/transcript/{lang}. Prompt: summarize_video.

Install

Requires Python 3.10+.

git clone https://github.com/YassineBadriDev/Yt-to-transcript-MCP.git
cd Yt-to-transcript-MCP

python -m venv .venv
.venv\Scripts\activate            # Windows  |  source .venv/bin/activate on Unix
python -m pip install -e .

python -m youtube_mcp --selftest  # offline check, no network needed

Or without cloning: python -m pip install -r requirements.txt and set PYTHONPATH=<repo>/src.

Optional extras:

python -m pip install -e ".[whisper]"   # audio -> text fallback; also needs ffmpeg on PATH
python -m pip install -e ".[dev]"       # pytest
python -m pytest tests -q

Use with Claude

Claude Desktop

Merge config/claude_desktop_config.json into:

OS

Path

Windows

%APPDATA%\Claude\claude_desktop_config.json

macOS

~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "youtube-transcript": {
      "command": "python",
      "args": ["-m", "youtube_mcp"],
      "env": { "YOUTUBE_MCP_DEFAULT_LANGUAGE": "en" }
    }
  }
}

Restart Claude Desktop. If python is not on its PATH (common on Windows), replace command with the absolute path to your venv's python.exe.

Claude Code

claude mcp add youtube-transcript -- python -m youtube_mcp

Or copy config/claude_code.mcp.json to your project root as .mcp.json.

See config/README.md for all details.

Use with Gemini

Gemini CLI uses the same mcpServers schema. Add config/gemini_settings.json to ~/.gemini/settings.json (global) or <project>/.gemini/settings.json:

gemini mcp add youtube-transcript python -- -m youtube_mcp

Then run /mcp to confirm the tools are discovered. Gemini CLI also supports reading MCP resources with @youtube://video/<id>/info.

Use a hyphenated server name (youtube-transcript), not an underscored one — Gemini CLI splits policy names on underscores.

Optionally point it at the HTTP server instead:

{ "mcpServers": { "youtube-transcript": { "httpUrl": "http://127.0.0.1:8000/mcp" } } }

Use with ChatGPT

ChatGPT is remote-only: it cannot spawn a local stdio process. Start the HTTP transport and expose it over HTTPS:

python -m youtube_mcp --transport streamable-http --port 8000 --auth-token "a-long-random-secret"
cloudflared tunnel --url http://127.0.0.1:8000    # or: ngrok http 8000

Then either:

  • ChatGPT web (Business / Enterprise / Edu; Pro has read/fetch-only): Settings → Plugins → Add custom MCP server → https://<tunnel>/mcp.

  • OpenAI Responses API from code (any plan), using the mcp tool type:

from openai import OpenAI

resp = OpenAI().responses.create(
    model="gpt-5.2",
    tools=[{
        "type": "mcp",
        "server_label": "youtube_transcript",
        "server_url": "https://<tunnel>/mcp",
        "authorization": "a-long-random-secret",
        "require_approval": "never",
    }],
    input="Transcribe https://youtu.be/dQw4w9WgXcQ and give 3 timestamped highlights.",
)
print(resp.output_text)
  • OpenAI Agents SDK can use the local stdio server, exactly like Claude/Gemini.

Full instructions (auth options, tunnels, Docker, approvals): config/chatgpt.md. Runnable example: examples/openai_responses_api.py.

Example prompts

Transcribe https://www.youtube.com/watch?v=VIDEO_ID as SRT and save it to talk.srt.
What does https://youtu.be/VIDEO_ID say about diffusion models?
Find the relevant timestamps and quote them.
List the caption languages available for this video, then translate the
French auto-captions into English.
Summarize this 2-hour lecture chapter by chapter using its chapters and
get_transcript_range.

Configuration

All settings are environment variables (see .env.example).

Variable

Default

Meaning

YOUTUBE_MCP_DEFAULT_LANGUAGE

en

Language used when a tool call omits language.

YOUTUBE_MCP_TRANSPORT

stdio

stdio | streamable-http | sse.

YOUTUBE_MCP_HTTP_HOST

127.0.0.1

Bind address for HTTP transports.

YOUTUBE_MCP_HTTP_PORT

8000

Bind port for HTTP transports.

YOUTUBE_MCP_AUTH_TOKEN

(empty)

Require Authorization: Bearer <token> on HTTP. Empty = no auth.

YOUTUBE_MCP_OUTPUT_DIR

./transcripts

Only directory save_transcript may write into.

YOUTUBE_MCP_PROXY

(empty)

HTTP proxy, useful on cloud IPs blocked by YouTube.

YOUTUBE_MCP_COOKIES_FROM_BROWSER

(empty)

e.g. chrome, for age-restricted / members-only videos.

YOUTUBE_MCP_COOKIES_FILE

(empty)

Netscape-format cookie file for yt-dlp.

YOUTUBE_MCP_WHISPER_MODEL

base

tiny | base | small | medium | large-v3.

CLI flags override the environment:

python -m youtube_mcp --transport streamable-http --host 0.0.0.0 --port 8080 --auth-token SECRET

GET /health is always public so tunnels and load balancers can probe it.

Output formats

format

Shape

text

One clean paragraph of plain text.

timestamped

[00:12] line of speech — one line per caption segment.

markdown

Title/metadata header plus bold timestamps.

srt / vtt

Ready-to-use subtitle files.

json

full_text plus segments[{start, end, text}] and metadata.

Long videos: pass max_chars, or use search_transcript + get_transcript_range instead of loading the whole transcript into context.

Whisper fallback (videos with no captions)

python -m pip install -e ".[whisper]"   # faster-whisper
# also install ffmpeg (winget install ffmpeg / choco install ffmpeg / apt install ffmpeg)

Then ask the model to call transcribe_audio. It downloads the audio with yt-dlp and transcribes locally. This is slow — roughly minutes for a long video — and is deliberately a separate tool so normal caption retrieval stays instant.

Troubleshooting

Symptom

Fix

IpBlocked / RequestBlocked

The server automatically falls back to yt-dlp. If both fail, set YOUTUBE_MCP_PROXY, or run from a residential IP.

No 'en' captions

Call list_transcript_languages, pass the right language, or use translate_to.

No captions at all

Use transcribe_audio (Whisper).

Age-restricted / "Sign in to confirm"

Set YOUTUBE_MCP_COOKIES_FROM_BROWSER=chrome (or YOUTUBE_MCP_COOKIES_FILE).

Client cannot find python

Use an absolute interpreter path in the config (config/README.md).

save_transcript refuses the path

Files must stay inside YOUTUBE_MCP_OUTPUT_DIR.

YouTube layout changed

yt-dlp updates fast: python -m pip install -U yt-dlp youtube-transcript-api.

WebVTT/json3 parse issues

Try prefer="api" or a different language.

Debug with the MCP Inspector:

npx @modelcontextprotocol/inspector python -m youtube_mcp

Security notes

  • save_transcript is sandboxed to YOUTUBE_MCP_OUTPUT_DIR; it cannot write anywhere else.

  • When exposing HTTP publicly, always set YOUTUBE_MCP_AUTH_TOKEN (or put the server behind OAuth). /health remains unauthenticated.

  • Never expose an unauthenticated server to the internet just to test ChatGPT; use a short-lived tunnel instead.

  • Transcripts are third-party content. Treat anything returned by a tool as untrusted data, and be mindful of prompt-injection text inside captions.

This tool reads publicly available caption tracks; it does not bypass DRM or download protected video streams. YouTube captions and video content may be copyrighted. Summarise and quote short excerpts rather than reproducing entire works, and comply with YouTube's Terms of Service and your local law.

Development

src/youtube_mcp/
  core.py       # retrieval engine (no MCP imports, usable as a library)
  formats.py    # text / timestamped / markdown / srt / vtt / json
  server.py     # FastMCP tools, resources, prompts
  __main__.py   # transports, bearer auth, CLI
config/         # ready-to-edit client configs
examples/       # offline smoke test + Responses API example
tests/          # offline unit tests
python -m pytest tests -q
python -m youtube_mcp --selftest
python examples/smoke_test.py dQw4w9WgXcQ   # one real network call

License

MIT — see LICENSE.

Available Tools

7 tools
get_transcriptA

Convert a YouTube video into a transcript.

Returns human captions when available, otherwise YouTube auto-generated captions, with an automatic yt-dlp fallback if the caption API is blocked. Use format='timestamped' or format='json' to keep timing information.

Inputs: video (required), format, prefer, language, +2 more. Returns: result

get_transcript_rangeA

Return only the part of a transcript between two timestamps.

Useful for long videos: fetch metadata/chapters, then pull just the relevant section instead of the whole transcript.

Inputs: video (required), end_seconds (required), start_seconds (required), format, +1 more. Returns: result

get_video_infoA

Get metadata for a YouTube video: title, channel, duration, chapters, upload date, views.

No transcript is fetched, so this is cheap. Use it before pulling a long transcript.

Inputs: video (required). Returns: result

list_transcript_languagesA

List all caption tracks for a video (language code, human vs auto, translatable targets).

Call this when get_transcript reports that the requested language is unavailable.

Inputs: video (required). Returns: result

save_transcriptA

Fetch a transcript and write it to a file (txt / srt / vtt / md / json).

Returns the absolute path written. Writes are restricted to the YOUTUBE_MCP_OUTPUT_DIR directory for safety.

Inputs: video (required), filename (required), format, prefer, +1 more. Returns: result

search_transcriptA

Find where a word or phrase is spoken in a video.

Returns timestamped matches so the model can jump straight to the relevant part of a long video with get_transcript_range.

Inputs: query (required), video (required), context, language, +1 more. Returns: result

transcribe_audioA

Speech-to-text fallback for videos with NO captions.

Downloads the audio with yt-dlp and transcribes it locally with Whisper. Requires pip install '.[whisper]' and the ffmpeg binary on PATH. This is slow (minutes for a long video) - only use it when get_transcript fails.

Inputs: video (required), format, language, model_size. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool has a clearly distinct role: metadata, language discovery, full transcript, timestamped range, search, file saving, and audio fallback. The only apparent overlap, get_transcript vs transcribe_audio, is explicitly separated by captions vs no-captions fallback usage.

    Naming Consistency5/5

    All tool names use consistent snake_case verb_noun conventions such as get_transcript, search_transcript, list_transcript_languages, and save_transcript. Compound names like get_transcript_range still follow the same predictable pattern.

    Tool Count5/5

    Seven tools is well-scoped for a YouTube transcript server. Each tool earns its place by covering a distinct workflow step without redundant or filler operations.

    Completeness5/5

    The surface covers the full practical lifecycle: inspect video info, discover caption languages, fetch transcripts, search and slice long transcripts, save outputs, and fall back to local speech-to-text when captions are absent. No obvious dead ends exist for the stated transcript-extraction purpose.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers