YTAPI

YouTube transcripts, video details, search, channel uploads and playlists for AI agents. Remote MCP server with OAuth sign-in or API key.

Hosted MCP Server

npx add-mcp 'https://api.ytapi.dev/mcp'

Installs into Claude Code, Codex, Cursor and more

Documentation

AI Agent Setup & Tooling

YTAPI provides machine-readable documentation and integration tools for AI coding assistants, LLM pipelines, and Model Context Protocol (MCP) clients.


Machine-Readable Endpoints [#machine-readable-endpoints]

For LLMs and agents that need to fetch documentation into context windows without parsing heavy HTML:

ResourceURLDescription
LLMs Indexhttps://docs.ytapi.dev/llms.txtSpec-compliant manifest of all documentation pages with short descriptions.
Full LLMs Dumphttps://docs.ytapi.dev/llms-full.txtSingle concatenated Markdown document containing the entire platform documentation.
Raw Page MDXhttps://docs.ytapi.dev/{slug}.mdxAppend .mdx to any documentation URL to retrieve raw, clean Markdown.
In bash-based agents (e.g. Claude Code, Codex, Aider), fetch the entire API reference with:
curl -s https://docs.ytapi.dev/llms-full.txt

Model Context Protocol (MCP) [#model-context-protocol-mcp]

YTAPI runs a remote MCP server. There is nothing to install: point your client at the URL, then sign in to your YTAPI account when the client asks, or send your API key.

URLhttps://api.ytapi.dev/mcp
TransportStreamable HTTP
AuthOAuth sign-in, or Authorization: Bearer <YOUR_API_KEY>
BillingSame credits as the REST API. Connecting and listing tools is free.

No key yet? The agent can create the account for its user: see Agent sign-up.

Claude (claude.ai and Claude Desktop) [#claude-claudeai-and-claude-desktop]

Add YTAPI as a custom connector. No API key is needed, and free Claude plans can add one custom connector:

  1. Open Customize → Connectors (also reachable from Settings → Connectors), click + Add, then Add custom connector.
  2. Enter https://api.ytapi.dev/mcp and click Connect.
  3. Sign in to YTAPI, or create an account (200 free credits, no card), then click Allow.

Then ask Claude about any YouTube video, channel or playlist. Requests use your account's credits and appear under Usage. To disconnect Claude, revoke the "Claude" connected app under API keys.

Claude Code [#claude-code]

Install the YTAPI plugin, which adds the server and skills for summaries, channel digests and topic research:

/plugin marketplace add ytapi/youtube-skills
/plugin install ytapi@ytapi

Then run /mcp, pick plugin:ytapi:ytapi and choose Authenticate to sign in. If Claude Code is logged in with a claude.ai account that already has the YTAPI connector, the connector shows up on its own.

To use an API key instead:

claude mcp add --transport http ytapi https://api.ytapi.dev/mcp \
  --header "Authorization: Bearer YOUR_API_KEY"

Codex [#codex]

Export your key, then register the server:

export YTAPI_KEY=YOUR_API_KEY
codex mcp add ytapi --url https://api.ytapi.dev/mcp --bearer-token-env-var YTAPI_KEY

Or add it to ~/.codex/config.toml yourself:

[mcp_servers.ytapi]
url = "https://api.ytapi.dev/mcp"
bearer_token_env_var = "YTAPI_KEY"

Cursor [#cursor]

Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project):

{
  "mcpServers": {
    "ytapi": {
      "url": "https://api.ytapi.dev/mcp",
      "headers": { "Authorization": "Bearer YOUR_API_KEY" }
    }
  }
}

VS Code [#vs-code]

Add to .vscode/mcp.json. VS Code asks for the key once and stores it securely:

{
  "inputs": [
    {
      "type": "promptString",
      "id": "ytapi-key",
      "description": "YTAPI API key",
      "password": true
    }
  ],
  "servers": {
    "ytapi": {
      "type": "http",
      "url": "https://api.ytapi.dev/mcp",
      "headers": { "Authorization": "Bearer ${input:ytapi-key}" }
    }
  }
}

Google Antigravity [#google-antigravity]

Add to ~/.gemini/config/mcp_config.json (all workspaces) or .agents/mcp_config.json (one workspace). Antigravity reads serverUrl, not url:

{
  "mcpServers": {
    "ytapi": {
      "serverUrl": "https://api.ytapi.dev/mcp",
      "headers": { "Authorization": "Bearer YOUR_API_KEY" }
    }
  }
}

OpenClaw [#openclaw]

Add the server under mcp.servers in your OpenClaw config:

{
  mcp: {
    servers: {
      ytapi: {
        url: "https://api.ytapi.dev/mcp",
        transport: "streamable-http",
        enabled: true,
        headers: { Authorization: "Bearer YOUR_API_KEY" }
      }
    }
  }
}

Keep the key in OpenClaw's secret storage rather than in the file where you can.

Other stdio-only clients [#other-stdio-only-clients]

Bridge to the remote server with mcp-remote (requires Node.js):

{
  "mcpServers": {
    "ytapi": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote", "https://api.ytapi.dev/mcp",
        "--header", "Authorization:${AUTH_HEADER}"
      ],
      "env": { "AUTH_HEADER": "Bearer YOUR_API_KEY" }
    }
  }
}

Tools [#tools]

ToolWhat it doesCredits
get_transcriptCaptions of a video as Markdown (with timestamps) or plain text. Accepts a video ID or any YouTube URL, including Shorts.1 for the first page; later pages of the same transcript are free for 30 minutes
get_video_infoTitle, channel, duration and the caption languages a video has.0
search_youtubeSearch videos, channels, playlists or Shorts.1 per page
get_channel_videosA channel's uploads, newest first by default. Accepts a handle, channel ID or URL.1 per page
get_playlist_videosA playlist's details and videos, page by page.1 per page

Long transcripts come back in pages of 40,000 characters (set max_chars up to 100,000). When more remains, the result ends with the offset to pass on the next call. Errors, such as a video without captions, are returned as tool errors and cost nothing.


Code Mode & Function Calling [#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"
      },
      "format": {
        "type": "string",
        "enum": ["markdown", "text", "srt", "vtt", "word_timestamps"],
        "default": "markdown"
      }
    },
    "required": ["video_id"]
  }
}

Platform Skills & System Prompts [#platform-skills--system-prompts]

Cursor Rules (.cursorrules) [#cursor-rules-cursorrules]

Add this prompt rule to your project to instruct Cursor on how to query YouTube transcripts:

# YTAPI 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`.