New
Apps 854Makers 853This week 854
Promote your app−30%
YouTube MCP Server & CLI screenshot 1
2views in
the last 30 days

YouTube MCP Server & CLI

YouTube MCP server and CLI for Claude Code, Codex and AI agents. 16 tools for transcripts...

Built with Claude Code

by thenavidm · added Oct 29, 2026
no ratings0 comments
YouTube

YouTube MCP Server & CLI

YouTube MCP server and CLI for Claude Code and AI agents. 21 tools for transcripts, most replayed moments, search, channel research, comments, analytics, uploads with scheduling and multi-channel management.

One install gives you both surfaces, the same tools under the same names.

Read the transcript of any public YouTube video, with nothing set up. Search results come back with view counts attached, which YouTube's own search endpoint does not return.

Connect as many channels as you run, with one login each and no config file. Upload a video straight from your disk, a vertical Short included, and schedule it with YouTube's own publish time.

Built and maintained by Navid Moazzez. Built on Slipway, which turns one definition of each tool into the MCP server and the CLI.

You: what does this video actually say about pricing?
     https://youtu.be/dQw4w9WgXcQ

Claude: [search_transcript] Three mentions.

        [2:14] "we never charge for the first seat"
        [7:41] "the pricing page is deliberately one number"
        [11:02] "annual is not a discount, it is a commitment"

        Jump straight to 7:41 for the reasoning.

Two ways to use it

Command line

youtube-cli in your terminal, for scripting, cron, pipes, or a quick question without opening anything:

youtube-cli                                                  # every command, one line each
youtube-cli get-transcript --video https://youtu.be/dQw4w9WgXcQ
youtube-cli list-transcript-languages dQw4w9WgXcQ
youtube-cli search-videos "local-first software"             # with view counts
youtube-cli list-comments --video-id dQw4w9WgXcQ --limit 20
youtube-cli login                                            # connect a channel, once each
youtube-cli list-my-videos --account thenavidm --limit 10
youtube-cli upload-video ~/Movies/short.mp4 --title "One habit #shorts" \
  --no-made-for-kids --publish-at 2026-11-02T15:00:00Z --confirm   # scheduled
youtube-cli get-video-status VIDEO_ID                        # processing, scheduled, live
youtube-cli <command> --help                                 # what any command takes

--confirm is the shell spelling of the confirmation that replying to a comment, deleting a video and uploading one viewers will see require. --agent gives compact JSON with no prompts, and errors are JSON on stderr whichever output you pick.

youtube-cli schema <command> prints the exact JSON Schema an MCP client receives for that tool, which is how you can check the two surfaces really are one thing.

MCP server, for your AI app

youtube-mcp is what Claude Code, Claude Desktop, Cursor and the rest launch. You never run it by hand:

claude mcp add youtube -- npx -y @thenavidm/youtube-mcp-cli@latest

Then just ask: "which of this channel's last 30 videos actually overperformed?"

Replying to a comment, deleting a video and uploading one viewers will see wait for your approval in the client, as section 9 explains.

Channels you connected with youtube-cli login on this machine are read automatically, so the command needs no credentials. Every other client is in section 4.

Which one

Where you are What you can reach
An agent that can run shell commands, like Claude Code or Cursor Both. The CLI is the cheaper one: it costs almost nothing until you type it
claude.ai, the Claude Desktop chat tab, or a phone The server only. There is no shell to run a command in
A terminal, a script, cron or CI The CLI only. There is no MCP client in a shell

They are the same program reading the same tool definitions, so anything one can do, the other can.

Features

Every tool is both a command and an MCP tool, with the same name. The command is the tool name with dashes.

Capability CLI command MCP tool
Transcripts of any public video, no credentials youtube-cli get-transcript / get-transcripts / search-transcript / list-transcript-languages / get-most-replayed get_transcript / get_transcripts / search_transcript / list_transcript_languages / get_most_replayed
Research any channel or video youtube-cli search-videos / get-channel / analyze-channel / get-video search_videos / get_channel / analyze_channel / get_video
Your channels and their numbers youtube-cli list-accounts / get-my-channel / get-channel-analytics / list-my-videos list_accounts / get_my_channel / get_channel_analytics / list_my_videos
Comments youtube-cli list-comments / reply-to-comment list_comments / reply_to_comment
Edit or delete your videos youtube-cli update-video / delete-video update_video / delete_video
Upload from your disk, schedule, follow it youtube-cli upload-video / upload-video-status / get-video-status upload_video / upload_video_status / get_video_status
Connect a channel or an API key youtube-cli login / logout not tools
Check your setup youtube-cli doctor not a tool

All 20 are in section 7.

Contents

# Section What is in it
1 What you can ask it Real prompts, not features
2 Quick install One line, no account needed
3 Set up your account API key, then your channels
4 Connect your client Claude, Cursor, Windsurf, the rest
5 Check it worked And the two things that fail
6 Which surface, and what each costs Measured in Claude Code, and how to spend less
7 Tools All 20, grouped by what they need
8 Output and exit codes What scripts branch on
9 Writing safely What is guarded and what is not
10 Several channels Login once each, pick by name
11 Notes and gotchas How YouTube really behaves
12 Your data What is stored, and where
13 Troubleshooting Symptom to cause
14 FAQ Including what an MCP server is

1. What you can ask it 💬

  • Summarize this video in five bullets.
  • Find where she talks about retention in this talk.
  • Pull the transcripts of these six videos and tell me what the openings have in common.
  • Which of this channel's last 30 videos actually overperformed?
  • Compare how these two channels title their videos.
  • Show me videos about local-first software from the last year with over 50,000 views.
  • Read the comments on this video and group them by what people are asking for.
  • What did my last video do on watch time versus the one before?
  • Fix the typo in the title of that video.
  • Which of my videos are still unlisted?
  • Upload ~/Movies/short.mp4 as a Short and schedule it for Monday at 3pm.
  • Has the video I just uploaded finished processing?

The one thing that is impossible without this: reading what was said in somebody else's video. YouTube's Captions API only serves videos you own, so every official route stops at your own channel. Transcripts here come from the public caption tracks instead, so any public video is readable, and it needs no credentials at all.

2. Quick install ⚡

Node 22 or newer, and yt-dlp for transcripts.

npx -y @thenavidm/youtube-mcp-cli@latest --version

That is the whole install for an MCP client. npx fetches it on demand, so there is nothing to update later.

For the command line, install it globally:

npm install -g @thenavidm/youtube-mcp-cli
youtube-cli

That gives you two commands: youtube-mcp is the server your AI tools launch, youtube-cli is the one you type. They are one program, and the name only decides what happens when you pass no arguments.

Transcripts also need yt-dlp, because YouTube stopped serving caption text directly:

brew install yt-dlp        # macOS
pipx install yt-dlp        # everywhere else

Before you start

You need Check with If missing
Node 22 or newer node -v nodejs.org
yt-dlp, for transcripts yt-dlp --version brew install yt-dlp or pipx install yt-dlp
A Google Cloud project, for search and your channels console.cloud.google.com Free, no card, see section 3

3. Set up your account 🔑

Three levels. Pick the one that matches what you want, because most people never need the third.

Transcripts need nothing. Skip this whole section. It already works.

Search, research and comments need an API key. About ten minutes.

Your own channels need OAuth. About half an hour, most of it forms.

INSTALL.md is the long version, with every click and every failure worth knowing about in advance.

An API key

  1. In the Google Cloud console, create a project.
  2. In APIs & Services > Library, enable YouTube Data API v3. Add YouTube Analytics API too if you will want watch time later.
  3. In APIs & Services > Credentials, choose Create credentials > API key, then click Restrict key and limit it to the YouTube APIs.
  4. Save it:
youtube-cli login --api-key AIza...

It is stored encrypted on this machine, and every MCP client here picks it up. On another machine, set YOUTUBE_API_KEY in the client config instead.

Your own channels

  1. Go to Google Auth platform > Branding, click Get Started, choose External as the audience, and finish.
  2. Open Audience, and under Test users add the Google address that owns each channel. Skipping this is the single most common reason login fails.
  3. Go to Google Auth platform > Clients, click Create Client, choose Desktop app, and copy the client ID and secret.
  4. Connect each channel:
export YOUTUBE_CLIENT_ID=...apps.googleusercontent.com
export YOUTUBE_CLIENT_SECRET=...
youtube-cli login

A browser opens, you pick the channel, and it is saved. Run youtube-cli login once per channel. Login asks for the upload permission too, so upload-video needs nothing more. Then youtube-cli list-accounts shows them all. Section 10 covers using several.

You do not need Google to verify the app, but do click Publish app under Audience. An app left in testing issues refresh tokens that expire after seven days, so login would stop working every week.

4. Connect your client 🔌

Every block below is complete on its own. Pick your client, paste, done.

If you ran youtube-cli login on the same machine, leave the env block out entirely: the server reads your saved channels and API key itself. Otherwise put in whichever of these you have: YOUTUBE_API_KEY, and for your channels YOUTUBE_CLIENT_ID, YOUTUBE_CLIENT_SECRET and YOUTUBE_ACCOUNTS (the entry youtube-cli login --print prints).

Claude Code

claude mcp add youtube -- npx -y @thenavidm/youtube-mcp-cli@latest

With credentials in the environment instead:

claude mcp add youtube \
  -e YOUTUBE_API_KEY=your-key \
  -e YOUTUBE_CLIENT_ID=your-client-id \
  -e YOUTUBE_CLIENT_SECRET=your-client-secret \
  -e YOUTUBE_REFRESH_TOKEN=your-refresh-token \
  -- npx -y @thenavidm/youtube-mcp-cli@latest

Run /mcp inside Claude Code and youtube should be listed. Remove it later with claude mcp remove youtube.

Claude Desktop

The quickest route is the extension: download the .mcpb and double-click it. It carries its own dependencies and asks for your API key and channels in a form, so there is no config file to edit.

To wire it up by hand instead, open Settings, then Developer, then Edit Config. That reveals claude_desktop_config.json. Or go straight there:

System Config file
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
Windows %APPDATA%\Claude\claude_desktop_config.json
Linux ~/.config/Claude/claude_desktop_config.json

On macOS, open -e ~/Library/Application\ Support/Claude/claude_desktop_config.json opens it in TextEdit.

If the file is empty, paste all of this. If you ran youtube-cli login, drop the env block:

{
  "mcpServers": {
    "youtube": {
      "command": "npx",
      "args": ["-y", "@thenavidm/youtube-mcp-cli@latest"],
      "env": {
        "YOUTUBE_API_KEY": "your-key"
      }
    }
  }
}

If the file already has other servers, add only the "youtube" block inside "mcpServers" and put a comma after the entry before it. One bad comma stops every server loading, not just this one.

Then quit Claude Desktop completely and reopen it. On macOS use Cmd+Q, closing the window is not enough. It only reads that file at startup.

To confirm, open a new chat, click the tools icon and look for youtube, then ask: "list the caption languages of https://youtu.be/dQw4w9WgXcQ".

Tip

Claude Desktop does not inherit your shell PATH, so if npx is not found, run which npx and use that absolute path as command.

When it does not show up, the log says why:

System Log
macOS tail -f ~/Library/Logs/Claude/mcp*.log
Windows %APPDATA%\Claude\logs\

The two usual causes are Node not being on the PATH the app sees, which the tip above fixes, and malformed JSON, which a missing or extra comma causes.

Cursor

Edit ~/.cursor/mcp.json for every project, or .cursor/mcp.json inside one:

{
  "mcpServers": {
    "youtube": {
      "command": "npx",
      "args": ["-y", "@thenavidm/youtube-mcp-cli@latest"]
    }
  }
}

Then reload the window: Cmd+Shift+P, Developer: Reload Window. The server appears under Settings > MCP.

Windsurf

Edit ~/.codeium/windsurf/mcp_config.json, with the same mcpServers block as Cursor. Then press the refresh button in the MCP panel, or restart Windsurf.

VS Code

Run MCP: Add Server from the command palette, or create .vscode/mcp.json in a project:

{
  "servers": {
    "youtube": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@thenavidm/youtube-mcp-cli@latest"]
    }
  }
}

VS Code shows a Start link above the entry. Click it, then open Copilot Chat in agent mode and the tools are listed.

Anything else

Zed, Cline, Continue and any other MCP client over stdio all work. They each want the same three things: command (npx), args (["-y", "@thenavidm/youtube-mcp-cli@latest"]), and env.

Docker

No image is published, so build it yourself. The image includes yt-dlp.

git clone https://github.com/thenavidm/youtube-mcp-cli.git && cd youtube-mcp-cli
docker build -t youtube-mcp-cli .
docker run -i --rm -e YOUTUBE_API_KEY=your-key youtube-mcp-cli

A container cannot read the channels you saved on the host, so pass them as YOUTUBE_ACCOUNTS, with YOUTUBE_CLIENT_ID and YOUTUBE_CLIENT_SECRET.

Self-hosted over HTTP

For a machine that is always on:

YOUTUBE_HTTP_TOKEN=a-long-random-string youtube-mcp --http --port=8787

It binds to 127.0.0.1 and serves /health. To reach it from elsewhere, set YOUTUBE_HTTP_HOST=0.0.0.0 together with YOUTUBE_HTTP_TOKEN, and put it behind TLS.

Caution

The HTTP transport holds live credentials for your channels. A connected refresh token can delete videos. Binding it beyond localhost without a token hands your channels to anyone who finds the port.

5. Check it worked 🩺

youtube-cli doctor

Or, without a global install, npx -y @thenavidm/youtube-mcp-cli@latest doctor.

It reports each layer separately, transcripts, the API key, then every channel by name, so you can see how far you got.

Two failures happen far more than the rest. yt-dlp not found means transcripts cannot work until you install it, though everything else still will. unauthorized_client on a channel means that token was issued by a different OAuth client than the one used now, which reads like a revoked grant but is not: check the client before reconnecting anything.

6. Which surface, and what each costs 💰

Both surfaces are the same program with the same 21 tools. The difference is when the model pays for them. Measured in Claude Code on 3.0, before the three upload tools; 3.1.0 has not been measured yet:

Cost MCP server CLI
Every message, with every tool loaded 4,500 tokens nothing
Every message, Claude Code's default 490 tokens nothing
When YouTube comes up nothing more, or the tools it picks 2,350 tokens for SKILL.md, once
20 messages with YouTube in 1, every tool loaded 90,000 tokens 2,350 tokens

Claude Code's tool search is on by default: it sends only the tool names and the server instructions, and loads a tool's full definition when the model reaches for it. An app that loads every tool up front pays the first line on every message, whether YouTube comes up or not. With the skill added, Claude Code also lists its one-line description, about 160 tokens.

To spend less, turn the server off when you are not using it, which in Claude Code is the /mcp panel. YOUTUBE_READ_ONLY=1 takes the 4 write tools off the list, leaving 16. Or install the CLI and add the server on the days it earns its place.

Measured on 2026-10-05 with Claude Code 2.1.286 on Claude Opus 5.5: one short prompt with and without the server connected, once with ENABLE_TOOL_SEARCH=false and once with the default, the difference read from the API's own usage figures. SKILL.md was measured the same way. Other apps and models count tokens a little differently.

Against 2.0.0, measured the same day: every tool loaded costs 4,458 tokens instead of 4,984, tool search 489 instead of 493, and SKILL.md 93 more, because it now says how approval works over MCP and lists every exit code. In Codex 0.159.3 on gpt-6.1-sol, the same task, "find the command that scores a channel's recent videos against that channel's own median, and the flags it requires", read a median of 83,295 input tokens on 3.0.0 against 83,565 on 2.0.0 over the CLI, five runs each: Codex now asks which instead of reading the full command list, and the general help is shorter. Over MCP, Codex prints the tool list with a script and answers from that printout, 6,133 tokens on 3.0.0 against 6,126; the 7 more are the description of confirm on the two irreversible tools. The input totals, a median of 45,053 against 44,924, also carry the model's reasoning into its second request, which three of the five 2.0.0 runs skipped; the two that kept it read 45,065 and 45,074.

7. Tools 🛠️

Every tool is also a command: the tool name with dashes. * marks a write, ! one that needs --confirm in the terminal or confirm: true through MCP.

Transcripts

No credentials. Reads any public video.

Command MCP tool What it does
get-transcript get_transcript The full transcript, as prose or timestamped lines
list-transcript-languages list_transcript_languages Every caption language, and whether it is auto-generated
search-transcript search_transcript Find a phrase, get timestamps that link to the second
get-most-replayed

Description taken from the repository README.

Ratings

–
0 ratings
5 0
4 0
3 0
2 0
1 0

Rate this app

Sign in to rate

Comments 0

Sign in to comment

No comments yet.

Related apps

#youtube · #mcp · #cli