AI Agent Setup & Tooling
How AI coding agents, LLMs, and autonomous tools can consume YouTube Transcript API documentation and execute data extraction tasks.
The YouTube Transcript & Data API is designed AI-native from the ground up. Autonomous agents, LLMs, and IDE assistants can read clean markdown schemas, query machine-readable indexes, and execute tools via the Model Context Protocol (MCP).
Machine-Readable Endpoints
For LLMs and agents that need to fetch documentation into context windows without parsing heavy HTML:
| Resource | URL | Description |
|---|---|---|
| LLMs Index | https://docs.ytapi.dev/llms.txt | Spec-compliant manifest of all documentation pages with short descriptions. |
| Full LLMs Dump | https://docs.ytapi.dev/llms-full.txt | Single concatenated Markdown document containing the entire platform documentation. |
| Raw Page MDX | https://docs.ytapi.dev/{slug}.mdx | Append .mdx to any documentation URL to retrieve raw, clean Markdown. |
Agent Quick Fetch
In bash-based agents (e.g. Claude Code, Codex, Aider), fetch the entire API reference with:
curl -s https://docs.ytapi.dev/llms-full.txtModel Context Protocol (MCP)
Connect your AI assistants directly to the YouTube Transcript API using the Model Context Protocol (MCP).
Claude Desktop & Cursor Configuration
Add the following to your MCP client configuration (claude_desktop_config.json or .cursor/mcp.json):
{
"mcpServers": {
"youtube-transcript": {
"command": "npx",
"args": ["-y", "@ytapi/mcp-server"],
"env": {
"YT_API_KEY": "YOUR_API_KEY"
}
}
}
}Available MCP Tools
| Tool Name | Parameters | Description |
|---|---|---|
get_transcript | video_id, format, languages | Fetch transcript in markdown, srt, vtt, or word_timestamps. |
get_video_info | video_id, mode (fast / full) | Fetch metadata, author, view counts, and chapter boundaries. |
search_youtube | query, type, limit | Full-text video and channel search without consuming Google Cloud quota. |
get_comments | video_id, sort_by, limit | Retrieve top or recent comment threads with engagement metrics. |
Code Mode & Function Calling
When orchestrating extraction pipelines via OpenAI, Anthropic, or Gemini tool calling, provide the JSON Schema directly:
{
"name": "fetch_youtube_transcript",
"description": "Extract subtitles or transcripts from any YouTube video in structured Markdown or SRT.",
"parameters": {
"type": "object",
"properties": {
"video_id": {
"type": "string",
"description": "11-character YouTube video ID or full URL"
},
"format": {
"type": "string",
"enum": ["markdown", "text", "srt", "vtt", "word_timestamps"],
"default": "markdown"
}
},
"required": ["video_id"]
}
}Platform Skills & System Prompts
Cursor Rules (.cursorrules)
Add this prompt rule to your project to instruct Cursor on how to query YouTube transcripts:
# YouTube Transcript API Guidelines
When writing code that extracts YouTube subtitles or transcripts:
1. Always use `https://api.ytapi.dev/v1/transcripts` with `Authorization: Bearer $YT_API_KEY`.
2. For LLM summaries or context injection, specify `"format": "markdown"`.
3. For video subtitle synchronizing, specify `"format": "word_timestamps"` with `"word_level": true`.
4. Check `X-Cache` response headers (`HIT` or `MISS`) to measure latency.
5. Refer to complete documentation at `https://docs.ytapi.dev/llms.txt`.