# YouTube — how to use (mcp.ai)

Busca, vídeo, canal, playlist, comentários, trending e relacionados do YouTube. A leitura é hospedada pela plataforma, sem credencial. Conecte seu canal com o Google para responder, comentar e moderar comentários pela API oficial.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_youtube?ms=1796396520000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `youtube_api`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/youtube`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://new.mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/youtube/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/youtube/api` — Escape hatch: call any path on the YouTube backend. Pass path (e.g. /search), optional method (default GET), query map, and JSON body for POST. Prefer the named youtube_* tools when available; this is
  - body: { path: string, method?: string, query?: object, body?: string }
- `POST https://api.mcp.ai/api/youtube/channel/about` — Channel description, links, country, subscriber count, banner.
  - body: { id?: string, forUsername?: string, ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/channel/community` — Community posts tab for a channel.
  - body: { id?: string, forUsername?: string, token?: string, ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/channel/featured` — Featured channels listed on a channel. Note: YouTube deprecated the featured-channels tab; this route exists upstream but typically returns an empty/error envelope.
  - body: { id?: string, forUsername?: string, token?: string, ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/channel/home` — Channel home page payload (featured shelves + meta).
  - body: { id?: string, forUsername?: string, token?: string, ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/channel/playlists` — Channel playlists tab.
  - body: { id?: string, forUsername?: string, sort_by?: string, token?: string, ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/channel/search` — Search a channel's own videos and playlists.
  - body: { id?: string, forUsername?: string, query: string, token?: string, ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/channel/shorts` — Channel shorts tab.
  - body: { id?: string, forUsername?: string, token?: string, ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/channel/shorts/post` — POST variant of channel shorts. Requires a `params` continuation token from a prior GET response. Skip in daily smoke (no synthetic params).
  - body: { id?: string, forUsername?: string, params: string, token?: string, ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/channel/store` — Store / merch shelf for a channel.
  - body: { id?: string, forUsername?: string, ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/channel/videos` — Channel videos tab.
  - body: { id?: string, forUsername?: string, sort_by?: string, token?: string, ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/channel/videos/post` — POST variant of channel videos. Requires a `params` continuation token captured from a prior GET response — used to fetch deeper pages or filtered shelves that the GET surface can't address. Skip in d
  - body: { id?: string, forUsername?: string, params: string, token?: string, ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/comment/delete` — Apaga DEFINITIVAMENTE um comentário (não tem desfazer). Só funciona em comentário do próprio canal ou em vídeo do canal conectado. Para esconder sem apagar, prefira youtube_comment_moderate com `rejec
  - body: { comment_id: string, account?: string, comment_ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/comment/moderate` — Modera comentários no canal conectado: publica (`published`), segura para revisão (`heldForReview`) ou rejeita (`rejected`). `ban_author` só é aceito junto de `rejected`. Vale apenas para comentários 
  - body: { comment_ids: string[], status: string, ban_author?: boolean, account?: string }
- `POST https://api.mcp.ai/api/youtube/comment/post` — Publica um comentário NOVO de topo em um vídeo, como o canal conectado. Para responder alguém, use youtube_comment_reply. Custa 50 unidades da cota.
  - body: { video_id: string, text: string, account?: string, video_ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/comment/reply` — Responde comentários como o canal conectado. Aceita VÁRIAS respostas numa chamada (`replies`), e um item que falha não derruba os outros. `parent_id` tem que ser o id de um comentário de TOPO (campo `
  - body: { replies: object[], account?: string }
- `POST https://api.mcp.ai/api/youtube/comment/threads` — Comentários de TOPO pela API oficial, com as respostas já existentes. É daqui que sai o `parent_id` usado em youtube_comment_reply (o id do thread), então prefira esta tool a youtube_comments quando a
  - body: { video_id?: string, channel_id?: string, order?: string, moderation_status?: string, search_terms?: string, max_results?: integer, page_token?: string, account?: string, video_ids?: string[], channel_ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/comment/update` — Edita o texto de um comentário ou resposta PUBLICADO pelo canal conectado (corrigir um erro sem apagar e repostar, o que perderia as curtidas e o encadeamento). Só funciona em comentário de autoria do
  - body: { comment_id: string, text: string, account?: string, comment_ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/comments` — Top-level comments thread for a video.
  - body: { id: string, sort_by?: string, token?: string, ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/download` — Stream/download metadata for a video (formats, audio/video URLs, status).
  - body: { id: string, cgeo?: string, ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/hashtag` — Posts under a hashtag (without leading #).
  - body: { tag: string, type?: string, token?: string }
- `POST https://api.mcp.ai/api/youtube/home/feed` — YouTube home feed (anonymous, geo/lang aware).
  - body: { geo?: string, lang?: string, token?: string }
- `POST https://api.mcp.ai/api/youtube/hype` — YouTube Hype: viral / hyped videos feed.
  - body: { geo?: string, lang?: string, token?: string }
- `POST https://api.mcp.ai/api/youtube/my/channels` — Lista os canais do YouTube conectados (os que podem responder e moderar comentários), com id, nome e estatísticas. Use antes de responder para confirmar de qual canal a resposta vai sair. Custa 1 unid
  - body: { account?: string }
- `POST https://api.mcp.ai/api/youtube/playlist` — Playlist items by playlist id.
  - body: { id: string, token?: string, ids?: string[] }
- `POST https://api.mcp.ai/api/youtube/resolve/url` — Resolve a YouTube URL or share link to its videoId / pageType.
  - body: { url: string }
- `POST https://api.mcp.ai/api/youtube/search` — Search videos, channels, playlists.
  - body: { query: string, type?: string, sort_by?: string, duration?: string, upload_date?: string, geo?: string, lang?: string, token?: string }
- `POST https://api.mcp.ai/api/youtube/trending` — Trending videos by region.
  - body: { geo?: string, type?: string, lang?: string }
- `POST https://api.mcp.ai/api/youtube/video/related` — Related videos for a given video id.
  - body: { id: string, token?: string, ids?: string[] }

## Example prompts
- "Busque vídeos sobre "receita fit""
- "Quais comentários do meu canal ainda não foram respondidos?"
- "Responda os comentários do vídeo dQw4w9WgXcQ agradecendo pelo feedback"

## More
- Page: https://new.mcp.ai/youtube
- Agent spec (llms.txt): https://new.mcp.ai/youtube/llms.txt
- Postman collection: https://new.mcp.ai/youtube/postman.json
