Skip to main content
Glama
bjornwalther

yt-transcript-mcp

yt-transcript-mcp

MIT Python 3.11+ MCP PyPI yt-transcript MCP server

YouTube transcripts as token-efficient AI context. One fetch, cached forever.

Agent-first: returns structured JSON by default. Zero dependencies on yt-dlp, ffmpeg, or API keys.

Works with Claude Desktop, ChatGPT Desktop, Cursor, Windsurf, and any MCP client.


Why?

When AI browses YouTube for a transcript, it processes the entire page: navigation, ads, recommendations, scripts. That's 75,000-150,000 tokens of noise to extract maybe 6,000 tokens of actual content.

This tool fetches only the transcript.

Tokens

Speed

Repeat queries

AI browses YouTube

75-150k

20-90s

Same cost every time

ytfetch-mcp

6-12k

1-3s

Instant (cached)

~50 KB per video in cache. A year of daily use stays under 120 MB.


Related MCP server: YouTube Transcript MCP

Demo

You say:

Fetch the transcript from https://www.youtube.com/watch?v=dQw4w9WgXcQ

Default response (compact JSON, segments only):

{
  "is_error": false,
  "video_id": "dQw4w9WgXcQ",
  "title": "Never Gonna Give You Up",
  "channel": "Rick Astley",
  "published": "2009-10-25",
  "language": "en",
  "caption_type": "manual",
  "segment_count": 56,
  "transcript_duration_seconds": 213.5,
  "content_hash": "a1b2c3...",
  "cache_hit": false,
  "warnings": [],
  "segments": [
    {"text": "We're no strangers to love", "start": 18.0, "end": 21.4},
    {"text": "You know the rules and so do I", "start": 21.4, "end": 24.8}
  ]
}

Structured, machine-readable, one transcript representation. No HTML, no noise, no wasted tokens.


Install

One line. No git clone needed.

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "yt-transcript": {
      "command": "uvx",
      "args": ["ytfetch-mcp"]
    }
  }
}

Restart Claude Desktop. Done.

ChatGPT Desktop

Same config in your Codex MCP settings, or add manually:

Field

Value

Command

uvx (or full path: ~/.local/bin/uvx)

Arguments

ytfetch-mcp

Tip: Find your uvx path with which uvx. Restart the app after config changes.

Cursor / Windsurf / VS Code

Paste the same JSON block into your MCP server config.

Requires

uv (includes uvx): curl -LsSf https://astral.sh/uv/install.sh | sh


Parameters

Parameter

Description

Default

url

YouTube URL (required, any format)

languages

Language codes in priority order

sv,en

output

segments, text, or both

segments

format

json or markdown

json

include_timestamps

true for [HH:MM:SS] per line in text output

false

title

Override title

channel

Override channel

published

Override date (YYYY-MM-DD)

bypass_cache

true to force fresh fetch

false


Output modes

output

What you get

segments (default)

Array of {text, start, end} for structured consumption

text

Single readable string (clean or timestamped)

both

Both representations

Markdown format (format=markdown) always renders readable text regardless of output mode.


Error handling

Every error returns a structured response with a machine-readable code and a retryable flag so agents can branch automatically:

{
  "is_error": true,
  "error_code": "VIDEO_UNAVAILABLE",
  "error_message": "Video is unavailable, private, or removed.",
  "retryable": false,
  "retry_count": 0
}

Error code

Meaning

Retryable

INVALID_URL

Not a YouTube URL or malformed video ID

No

TRANSCRIPT_NOT_AVAILABLE

Transcripts disabled for this video

No

LANGUAGE_NOT_AVAILABLE

No transcript in requested languages

No

VIDEO_UNAVAILABLE

Video unavailable, private, age-restricted, or unplayable

No

YOUTUBE_IP_BLOCKED

YouTube is blocking your IP

No

PO_TOKEN_REQUIRED

Video requires Proof-of-Origin token

No

RATE_LIMITED

YouTube rate limit (429)

Yes


Provenance

Every response includes provenance so you know exactly where the data comes from:

  • caption_type: manual, auto-generated, or unknown

  • metadata_sources: per-field tracking ({"title": "oembed", "published": "pytubefix"})

  • content_hash: SHA256 of the segments array for reproducibility

  • warnings: AUTO_GENERATED (speech recognition, may contain errors), LANGUAGE_FALLBACK (got a different language than requested), METADATA_FETCH_FAILED (some metadata unavailable)


Cache

Transcripts cached locally in ~/.cache/yt-transcript/. Keyed by video ID + language preference. Second fetch: instant, zero network.

  • Cache entries validated on load (version, types, segments, metadata)

  • Legacy or corrupted entries silently skipped

  • Cache write failures never block transcript delivery


CLI

Also works standalone, no MCP client needed:

uvx ytfetch-mcp  # starts the MCP server
uv run yt_transcript.py https://youtu.be/ABC123  # CLI mode, saves .md file

CLI flags: --date, --title, --channel, --lang, --out, --no-clean, --no-cache.


Roadmap

  • Summary mode -- condensed output for lower token cost

  • Token budget (max_tokens) -- fit any context window

  • Batch URLs -- multiple videos in one call

  • Chapter/topic filtering -- return only relevant sections

  • Remote HTTP transport -- expose as streamable HTTP MCP server

  • Schema.org metadata -- replace pytubefix for publish date

  • MCP outputSchema / structured content


Support

If this saves you time or tokens:

Ko-fi GitHub Sponsors


MIT \u00a9 Bj\u00f6rn Walther

Available Tools

1 tool
fetch_transcriptA

Fetch a YouTube video transcript. Returns compact JSON (default) or markdown. Defaults to segments-only for token efficiency. Cached by language preference. Retries only transient errors. Includes provenance, caption type, and verifiable content hash.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesYouTube video URL (watch, youtu.be, shorts, embed)
titleNoManual title override
formatNoResponse format. JSON is compact (no indent).json
outputNoTranscript representation. 'segments' (default): array of {text,start,end}. 'text': readable string. 'both': both. Markdown always renders text.segments
channelNoManual channel override
languagesNoComma-separated language codes in priority order (default: sv,en)sv,en
publishedNoManual date (YYYY-MM-DD)
bypass_cacheNoForce fresh fetch
include_timestampsNoInclude HH:MM:SS per line in text output

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full disclosure burden and does substantial work: it reveals caching behavior by language preference, retry policy (only transient errors), default output representation, and that responses include provenance, caption type, and a verifiable content hash. The only notable gaps are error/edge-case behavior (e.g., missing transcript) and any rate-limit or auth constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Six short sentences, each carrying distinct information: purpose, format options, default rationale, caching, retry behavior, and response contents. The core purpose is front-loaded and there is zero redundancy or filler — every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 9-parameter tool with no annotations and no output schema, the description is remarkably complete: it covers purpose, formats, default behaviors, caching, retry semantics, and key response elements. Remaining gaps — error handling for missing transcripts and any rate-limit/authentication context — are minor given how much behavioral ground is already covered.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, establishing a baseline of 3. The description adds genuine value beyond the schema by explaining the 'why' behind defaults — 'Defaults to segments-only for token efficiency' maps to the output parameter, and 'Cached by language preference' illuminates the interplay between languages and bypass_cache. This rationale helps the agent reason about parameter choices.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence 'Fetch a YouTube video transcript' uses a specific verb and clearly identifiable resource. It is further enriched by specifying return formats (compact JSON or markdown), default output mode, and content guarantees (provenance, caption type, content hash), leaving no ambiguity about what the tool does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives implied usage context through 'Defaults to segments-only for token efficiency' and 'Cached by language preference,' which signal this is an efficient default path for transcript retrieval. However, there is no explicit when-to-use guidance, no exclusions, and no alternative tools to route toward — though this is partly mitigated by there being no sibling tools listed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev1.2.0
    • First observedfetch_transcript

TDQS

A4.2/5.0
Disambiguation5/5

With only one tool, there is no possibility of confusing it with another. The tool's purpose is narrowly and clearly defined.

Naming Consistency5/5

The single tool name 'fetch_transcript' follows a clear verb_noun convention. There are no other names to contradict this pattern.

Tool Count3/5

One tool is borderline for a server, but it is reasonable for a narrowly focused YouTube transcript service. It feels thin if broader video or transcript management is expected, though the scope appears intentionally minimal.

Completeness4/5

The tool covers the core need of fetching a transcript with useful options like markdown output, caching, and provenance. Minor gaps exist around listing available transcripts or explicitly choosing languages, but these are workable and not fatal for the stated purpose.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Extract YouTube transcripts for AI agents, RAG pipelines, and LLM workflows. Supports any YouTube URL. Returns clean text or timestamped segments. No API keys required.
    1
    4
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Fast, minimal YouTube 'watch' engine for AI agents that extracts clean transcripts, searches, and slices any YouTube video without requiring an API key.
    4
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bjornwalther/yt-transcript'

If you have feedback or need assistance with the MCP directory API, please join our Discord server