YouTube MCP Server & CLI
A free, open source YouTube MCP server and CLI that lets Claude Code, Codex, Cursor and other AI agents read any public video's transcript, research channels and manage your own.
0.0(0 ratings)- 1
Add it with a single command in a terminal.
claude mcp add youtube \
-- npx -y @thenavidm/youtube-mcp-cli@latest - 2
In Claude Code, type /mcp. YouTube should show as connected.
/mcp
- 1
Add it with a single command in a terminal.
claude mcp add youtube -- npx -y @thenavidm/youtube-mcp-cli@latest - 2
In Claude Code, type /mcp. YouTube should show as connected.
/mcp
- 1
Add it with a single command in a terminal.
claude mcp add youtube \
-- npx -y @thenavidm/youtube-mcp-cli@latest - 2
In Claude Code, type /mcp. YouTube should show as connected.
/mcp
- 1Download the extension
Download the Claude Desktop extension.
- 2
Double-click it, and Claude Desktop installs it.
- 1
Add it with a single command in a terminal.
codex mcp add youtube \
-- npx -y @thenavidm/youtube-mcp-cli@latest - 2
Check that Codex lists it.
codex mcp list
- 1
Add it with a single command in a terminal.
codex mcp add youtube -- npx -y @thenavidm/youtube-mcp-cli@latest - 2
Check that Codex lists it.
codex mcp list
- 1
Add it with a single command in a terminal.
codex mcp add youtube \
-- npx -y @thenavidm/youtube-mcp-cli@latest - 2
Check that Codex lists it.
codex mcp list
- 1
Open Cursor's settings, go to the MCP tab, and click Add new global MCP server.
- 2
Add the server.
{
"mcpServers": {
"youtube": {
"command": "npx",
"args": ["-y", "@thenavidm/youtube-mcp-cli@latest"]
}
}
} - 3
Open the MCP tab again. It should show 16 tools.
- 1
Open the Command Palette and run MCP: Open User Configuration.
- 2
Add the server to that mcp.json.
If the file already has servers, add only this one inside servers.
{
"servers": {
"youtube": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@thenavidm/youtube-mcp-cli@latest"]
}
}
}
- 1
Add it with a single command in a terminal.
copilot mcp add youtube \
-- npx -y @thenavidm/youtube-mcp-cli@latest - 2
Check that Copilot CLI has it.
copilot mcp get youtube
- 1
Add it with a single command in a terminal.
copilot mcp add youtube -- npx -y @thenavidm/youtube-mcp-cli@latest - 2
Check that Copilot CLI has it.
copilot mcp get youtube
- 1
Add it with a single command in a terminal.
copilot mcp add youtube \
-- npx -y @thenavidm/youtube-mcp-cli@latest - 2
Check that Copilot CLI has it.
copilot mcp get youtube
- 1
Open your Gemini CLI settings.
~/.gemini/settings.json - 2
Add the server to settings.json.
If the file already has servers, add only this one inside mcpServers.
{
"mcpServers": {
"youtube": {
"command": "npx",
"args": ["-y", "@thenavidm/youtube-mcp-cli@latest"]
}
}
} - 3
Restart Gemini CLI and type /mcp to check it.
/mcp
- 1
Open your Gemini CLI settings.
%USERPROFILE%\.gemini\settings.json - 2
Add the server to settings.json.
If the file already has servers, add only this one inside mcpServers.
{
"mcpServers": {
"youtube": {
"command": "npx",
"args": ["-y", "@thenavidm/youtube-mcp-cli@latest"]
}
}
} - 3
Restart Gemini CLI and type /mcp to check it.
/mcp
- 1
Open your Gemini CLI settings.
~/.gemini/settings.json - 2
Add the server to settings.json.
If the file already has servers, add only this one inside mcpServers.
{
"mcpServers": {
"youtube": {
"command": "npx",
"args": ["-y", "@thenavidm/youtube-mcp-cli@latest"]
}
}
} - 3
Restart Gemini CLI and type /mcp to check it.
/mcp
- 1
Open your OpenCode config.
~/.config/opencode/opencode.json - 2
Add the server under mcp.
If the file already has servers, add only this one inside mcp.
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"youtube": {
"type": "local",
"command": ["npx", "-y", "@thenavidm/youtube-mcp-cli@latest"],
"enabled": true
}
}
} - 3
Restart OpenCode.
- 1
Open your OpenCode config.
%USERPROFILE%\.config\opencode\opencode.json - 2
Add the server under mcp.
If the file already has servers, add only this one inside mcp.
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"youtube": {
"type": "local",
"command": ["npx", "-y", "@thenavidm/youtube-mcp-cli@latest"],
"enabled": true
}
}
} - 3
Restart OpenCode.
- 1
Open your OpenCode config.
~/.config/opencode/opencode.json - 2
Add the server under mcp.
If the file already has servers, add only this one inside mcp.
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"youtube": {
"type": "local",
"command": ["npx", "-y", "@thenavidm/youtube-mcp-cli@latest"],
"enabled": true
}
}
} - 3
Restart OpenCode.
- 1
Add it with a single command in a terminal.
openclaw mcp add youtube \
--command npx \
--arg -y \
--arg @thenavidm/youtube-mcp-cli@latest - 2
Check that it starts and lists its tools.
openclaw mcp doctor youtube --probe
- 1
Add it with a single command in a terminal.
openclaw mcp add youtube --command npx --arg -y --arg @thenavidm/youtube-mcp-cli@latest - 2
Check that it starts and lists its tools.
openclaw mcp doctor youtube --probe
- 1
Add it with a single command in a terminal.
openclaw mcp add youtube \
--command npx \
--arg -y \
--arg @thenavidm/youtube-mcp-cli@latest - 2
Check that it starts and lists its tools.
openclaw mcp doctor youtube --probe
- 1
In the agent panel, click the … menu, then MCP Servers, Manage MCP Servers and View raw config.
- 2
Add the server to mcp_config.json.
If the file already has servers, add only this one inside mcpServers.
{
"mcpServers": {
"youtube": {
"command": "npx",
"args": ["-y", "@thenavidm/youtube-mcp-cli@latest"]
}
}
}
- 1
Open your Hermes config.
~/.hermes/config.yaml - 2
Add the server under mcp_servers.
If the file already has mcp_servers, add only this one under it.
mcp_servers:
youtube:
command: "npx"
args: ["-y", "@thenavidm/youtube-mcp-cli@latest"]
- 1
Open your Hermes config.
%USERPROFILE%\.hermes\config.yaml - 2
Add the server under mcp_servers.
If the file already has mcp_servers, add only this one under it.
mcp_servers:
youtube:
command: "npx"
args: ["-y", "@thenavidm/youtube-mcp-cli@latest"]
- 1
Open your Hermes config.
~/.hermes/config.yaml - 2
Add the server under mcp_servers.
If the file already has mcp_servers, add only this one under it.
mcp_servers:
youtube:
command: "npx"
args: ["-y", "@thenavidm/youtube-mcp-cli@latest"]
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Give Claude Code the skill, so it knows every command.
The skill is the SKILL.md in the package. It tells Claude Code what each command does and which ones ask first.
mkdir -p ~/.claude/skills/youtube
cp "$(npm root -g)/@thenavidm/youtube-mcp-cli/SKILL.md" ~/.claude/skills/youtube/ - 3
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 4
Ask Claude Code to use youtube-cli.
Running youtube-cli on its own lists every command, so Claude Code finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Give Claude Code the skill, so it knows every command.
The skill is the SKILL.md in the package. It tells Claude Code what each command does and which ones ask first.
New-Item -ItemType Directory -Force "$HOME\.claude\skills\youtube" | Out-Null
Copy-Item "$(npm root -g)\@thenavidm\youtube-mcp-cli\SKILL.md" "$HOME\.claude\skills\youtube\" - 3
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 4
Ask Claude Code to use youtube-cli.
Running youtube-cli on its own lists every command, so Claude Code finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Give Claude Code the skill, so it knows every command.
The skill is the SKILL.md in the package. It tells Claude Code what each command does and which ones ask first.
mkdir -p ~/.claude/skills/youtube
cp "$(npm root -g)/@thenavidm/youtube-mcp-cli/SKILL.md" ~/.claude/skills/youtube/ - 3
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 4
Ask Claude Code to use youtube-cli.
Running youtube-cli on its own lists every command, so Claude Code finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Give Codex the skill, so it knows every command.
The skill is the SKILL.md in the package. It tells Codex what each command does and which ones ask first.
mkdir -p ~/.agents/skills/youtube
cp "$(npm root -g)/@thenavidm/youtube-mcp-cli/SKILL.md" ~/.agents/skills/youtube/ - 3
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 4
Ask Codex to use youtube-cli.
Running youtube-cli on its own lists every command, so Codex finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Give Codex the skill, so it knows every command.
The skill is the SKILL.md in the package. It tells Codex what each command does and which ones ask first.
New-Item -ItemType Directory -Force "$HOME\.agents\skills\youtube" | Out-Null
Copy-Item "$(npm root -g)\@thenavidm\youtube-mcp-cli\SKILL.md" "$HOME\.agents\skills\youtube\" - 3
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 4
Ask Codex to use youtube-cli.
Running youtube-cli on its own lists every command, so Codex finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Give Codex the skill, so it knows every command.
The skill is the SKILL.md in the package. It tells Codex what each command does and which ones ask first.
mkdir -p ~/.agents/skills/youtube
cp "$(npm root -g)/@thenavidm/youtube-mcp-cli/SKILL.md" ~/.agents/skills/youtube/ - 3
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 4
Ask Codex to use youtube-cli.
Running youtube-cli on its own lists every command, so Codex finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 3
Ask Cursor to use youtube-cli.
Running youtube-cli on its own lists every command, so Cursor finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 3
Ask VS Code to use youtube-cli.
Running youtube-cli on its own lists every command, so VS Code finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Give Copilot CLI the skill, so it knows every command.
The skill is the SKILL.md in the package. It tells Copilot CLI what each command does and which ones ask first.
mkdir -p ~/.copilot/skills/youtube
cp "$(npm root -g)/@thenavidm/youtube-mcp-cli/SKILL.md" ~/.copilot/skills/youtube/ - 3
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 4
Ask Copilot CLI to use youtube-cli.
Running youtube-cli on its own lists every command, so Copilot CLI finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Give Copilot CLI the skill, so it knows every command.
The skill is the SKILL.md in the package. It tells Copilot CLI what each command does and which ones ask first.
New-Item -ItemType Directory -Force "$HOME\.copilot\skills\youtube" | Out-Null
Copy-Item "$(npm root -g)\@thenavidm\youtube-mcp-cli\SKILL.md" "$HOME\.copilot\skills\youtube\" - 3
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 4
Ask Copilot CLI to use youtube-cli.
Running youtube-cli on its own lists every command, so Copilot CLI finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Give Copilot CLI the skill, so it knows every command.
The skill is the SKILL.md in the package. It tells Copilot CLI what each command does and which ones ask first.
mkdir -p ~/.copilot/skills/youtube
cp "$(npm root -g)/@thenavidm/youtube-mcp-cli/SKILL.md" ~/.copilot/skills/youtube/ - 3
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 4
Ask Copilot CLI to use youtube-cli.
Running youtube-cli on its own lists every command, so Copilot CLI finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 3
Ask Gemini CLI to use youtube-cli.
Running youtube-cli on its own lists every command, so Gemini CLI finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Give OpenCode the skill, so it knows every command.
The skill is the SKILL.md in the package. It tells OpenCode what each command does and which ones ask first.
mkdir -p ~/.config/opencode/skills/youtube
cp "$(npm root -g)/@thenavidm/youtube-mcp-cli/SKILL.md" ~/.config/opencode/skills/youtube/ - 3
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 4
Ask OpenCode to use youtube-cli.
Running youtube-cli on its own lists every command, so OpenCode finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Give OpenCode the skill, so it knows every command.
The skill is the SKILL.md in the package. It tells OpenCode what each command does and which ones ask first.
New-Item -ItemType Directory -Force "$HOME\.config\opencode\skills\youtube" | Out-Null
Copy-Item "$(npm root -g)\@thenavidm\youtube-mcp-cli\SKILL.md" "$HOME\.config\opencode\skills\youtube\" - 3
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 4
Ask OpenCode to use youtube-cli.
Running youtube-cli on its own lists every command, so OpenCode finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Give OpenCode the skill, so it knows every command.
The skill is the SKILL.md in the package. It tells OpenCode what each command does and which ones ask first.
mkdir -p ~/.config/opencode/skills/youtube
cp "$(npm root -g)/@thenavidm/youtube-mcp-cli/SKILL.md" ~/.config/opencode/skills/youtube/ - 3
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 4
Ask OpenCode to use youtube-cli.
Running youtube-cli on its own lists every command, so OpenCode finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Give OpenClaw the skill, so it knows every command.
The skill is the SKILL.md in the package. It tells OpenClaw what each command does and which ones ask first.
mkdir -p ~/.openclaw/skills/youtube
cp "$(npm root -g)/@thenavidm/youtube-mcp-cli/SKILL.md" ~/.openclaw/skills/youtube/ - 3
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 4
Ask OpenClaw to use youtube-cli.
Running youtube-cli on its own lists every command, so OpenClaw finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Give OpenClaw the skill, so it knows every command.
The skill is the SKILL.md in the package. It tells OpenClaw what each command does and which ones ask first.
New-Item -ItemType Directory -Force "$HOME\.openclaw\skills\youtube" | Out-Null
Copy-Item "$(npm root -g)\@thenavidm\youtube-mcp-cli\SKILL.md" "$HOME\.openclaw\skills\youtube\" - 3
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 4
Ask OpenClaw to use youtube-cli.
Running youtube-cli on its own lists every command, so OpenClaw finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Give OpenClaw the skill, so it knows every command.
The skill is the SKILL.md in the package. It tells OpenClaw what each command does and which ones ask first.
mkdir -p ~/.openclaw/skills/youtube
cp "$(npm root -g)/@thenavidm/youtube-mcp-cli/SKILL.md" ~/.openclaw/skills/youtube/ - 3
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 4
Ask OpenClaw to use youtube-cli.
Running youtube-cli on its own lists every command, so OpenClaw finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 3
Ask Antigravity to use youtube-cli.
Running youtube-cli on its own lists every command, so Antigravity finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 3
Ask Hermes to use youtube-cli.
Running youtube-cli on its own lists every command, so Hermes finds the one it needs.
- 1
Install the CLI. It needs Node 22 or newer.
npm install -g @thenavidm/youtube-mcp-cli@latest - 2
Check your setup.
It names anything that's wrong and the fix.
youtube-cli doctor - 3
List every command, then try one.
youtube-cli
youtube-cli get-transcript --video https://youtu.be/jNQXAC9IVRw
Needs Node 22 or newer and yt-dlp for transcripts. Search needs an API key, and your own channels need OAuth. Set it up.
It's free and open source. If it saves you time, star it on GitHub, so more people find it.
This free YouTube MCP server and CLI gives your AI real access to YouTube: the transcript of any public video, search and channel research, and your own channels' videos, comments and analytics. It reads what was said in any public video, compares channels, and manages your own videos and comments.
It's one install with two ways in. Claude, Codex, Cursor or any other MCP app calls its 16 tools for you, and the same tools work as a CLI that agents like Claude Code, Codex and OpenCode run, or that you type yourself.
In this guide, I'll show you:
- What the YouTube MCP server & CLI is, and what you can ask it
- How to install it and check that it works
- When to use the MCP server, and when the CLI
- Every tool, and how to keep your account safe
Every tool on this page comes from the server itself, and every cost was measured in Claude Code.
Key takeaways
What is the YouTube MCP server & CLI?
The YouTube MCP server & CLI is a free, open source program that lets AI agents read transcripts, research channels and manage your own YouTube channels for you, in two ways. The MCP server is what an AI app like Claude, Codex or Cursor connects to, through MCP (Model Context Protocol), the open standard AI apps use to call outside tools.
You ask in plain language. Your AI picks the right tool, and the server makes the call to YouTube, and to Google's API with your own key.
The CLI is the same program as commands. youtube-cli get-transcript --video <url> runs the same code your AI runs when you ask what a video says, whether an agent like Claude Code runs it or you do.
In an AI OS, the layer that connects your AI to your context, your data and your tools, a server like this is how your AI reaches YouTube. I explain how the parts fit together in how to build an AI operating system, and here's how I use AI myself.
What can you ask it?
Once it's set up, you ask the way you'd ask an assistant. These are real prompts it handles:
Try askingSummarize 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?
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?
The first one shows why this is useful. YouTube's own caption API only serves videos you own, and this reads the public captions of any video, with no key at all.
It works well next to my TikTok MCP server and Vimeo MCP server, so your AI can publish videos to TikTok and add captions in Vimeo in the same chat. Every server I've made is on my MCP servers page.
For your videos, my free YouTube title checker and YouTube thumbnail preview help too.
How to install the YouTube MCP server
Pick your app in the box at the top of this page. Each one is a single command or a pasted block, and transcripts work with nothing else set up.
Windsurf, Zed and Cline take the same server, though they don't have a tab in the box yet. Follow the box's Cursor tab, and put its block here instead:
| App | Where the block goes |
|---|---|
| Windsurf | In the Cascade panel, open the Actions menu (…) and choose Open MCP config file, then paste the block. |
| Cline | Click the MCP Servers icon in the Cline panel, open the Configure tab, click Configure MCP Servers, and paste the block. |
| Zed | Go to Settings, then AI, then MCP Servers, and choose Add Server, then Add Local Server. Enter the block's command, arguments and variables, and Zed saves them under context_servers. |
brew install yt-dlp on a Mac.Pro tip: Start with transcripts. They need no key and no account, so you can try the server before any Google setup.
Watch out: Publish the OAuth app under Audience. An app left in testing gets refresh tokens that expire after 7 days, and the login stops working every week.
Set up YouTube
There are 3 levels, and most people never need the third.
Transcripts need nothing. Search, research and comments need an API key, which takes about 10 minutes. Your own channels need OAuth, which takes about half an hour, most of it forms.
youtube-cli login --api-key <key>, or set YOUTUBE_API_KEY in your app's config.YOUTUBE_CLIENT_ID and YOUTUBE_CLIENT_SECRET, then run youtube-cli login once per channel.The saved channels live in ~/.youtube-mcp-cli/channels.json, encrypted, and every app on this computer uses them. The full walkthrough is in the repo's INSTALL.md.
Check that it works
Run the doctor. It checks yt-dlp, the API key and each connected channel separately.
npx -y @thenavidm/youtube-mcp-cli doctorExit code 10 means nothing is configured for that level yet. unauthorized_client means the token came from a different OAuth client than the one set now.
In Claude Code, /mcp also shows whether the YouTube server is connected. It's one of the Claude Code commands worth knowing.
Use the YouTube CLI
The CLI is the same 16 tools as commands. AI agents that run commands, like Claude Code, Codex and OpenCode, use it on their own, and you can type the same commands in a terminal or a script.
Every tool name becomes a command with dashes, so get_transcript runs as youtube-cli get-transcript.
npm install -g @thenavidm/youtube-mcp-cli
youtube-cli
youtube-cli get-transcript --video https://youtu.be/jNQXAC9IVRw
youtube-cli search-videos --query "claude code" --max-results 5
youtube-cli list-my-videos --limit 10The bare youtube-cli lists every command, youtube-cli which <words> finds the command for a task, and youtube-cli <command> --help shows what a command takes. Deleting a video and replying to a comment need --confirm, the terminal's version of your approval.
youtube-cli install <app> adds the server to Claude Code, Codex, Claude Desktop, Cursor, VS Code or Gemini CLI, in each app's own format.
These are the flags you'll use most:
| Flag | What it does |
|---|---|
--json | Prints JSON |
--compact | Prints the JSON on one line |
--select a,b.c | Keeps only those fields, and a dotted path goes deeper |
--agent | Machine mode: compact JSON, no prompts, and it never confirms anything |
--confirm | Lets a write that asks first go ahead |
--dry-run | Shows what a write would do, without doing it |
A script can branch on the exit code:
| Exit code | What it means |
|---|---|
| 0 | It worked |
| 1 | Something unexpected went wrong |
| 2 | The command was typed wrong, or a write needed --confirm |
| 3 | It wasn't found |
| 4 | YouTube rejected the credentials |
| 5 | YouTube failed or couldn't be reached |
| 7 | You hit a rate limit, so wait and try again |
| 10 | Nothing is set up yet |
MCP server or CLI: which one?
Both are the same program with the same 16 tools. The difference is when your AI pays for them, in the tokens it reads.
- MCP server
- 4,500 tokens
- CLI
- Nothing
- MCP server
- 490 tokens
- CLI
- Nothing
- MCP server
- Nothing more, or in Claude Code the tools it picks
- CLI
- 2,300 tokens, once
- MCP server
- 89,000 tokens
- CLI
- 2,300 tokens
- MCP server
- Yes
- CLI
- No, there's no terminal there
- MCP server
- No
- CLI
- Yes
An app that loads every tool up front sends the full list with every message, whether you mention YouTube or not. Claude Code doesn't by default: its tool search sends only the tool names and the server's instructions, and loads a tool's full definition when your AI reaches for it.
The CLI costs nothing until YouTube comes up. Then your agent reads its skill file once and runs the commands it needs. With the skill added, Claude Code also lists its one-line description with every message, about 160 tokens.
When the whole conversation is about YouTube, the gap closes. Then the MCP server is the better experience, because you ask in plain language and your AI never has to look up a command.
How to spend less
In Claude Code, leave tool search on, which it is unless you've set ENABLE_TOOL_SEARCH=false.
Turn the server off when you aren't using YouTube, with your AI app's own switch. YOUTUBE_READ_ONLY=1 cuts it to the 13 reading tools.
Or install the CLI and connect the server later, on the days it earns its place. Every tool stays in reach, and the standing cost drops to nothing.
Every number here was measured on October 5, 2026 in Claude Code 2.1.286 with Claude Opus 5.5. It's the same one-line prompt with and without the server connected, once with tool search off so every tool loads, and once with Claude Code's default. The skill was measured the same way, and other apps and models count tokens a little differently.
What YouTube actually does
A few things on YouTube's side explain most surprises.
Search has its own small allowance
A search draws from its own bucket of 100 calls a day, separate from the 10,000 units the rest of the API shares. It's almost always search that runs out first.
Analytics is only for your own channels
Watch time, retention and traffic sources aren't public for anyone else's channel, at any price, and they lag about 2 days.
Public subscriber counts are rounded
YouTube rounds counts above 1,000 in its public API, so your channel's public count and its own count differ. The one from your own channel is exact.
Shorts skew the averages
Shorts views aren't comparable to long videos on the same channel, so analyze_channel flags them rather than averaging them in.
Every YouTube tool
The tables below list all 16 tools, grouped the way the repo groups them. Of these, 13 only read, and three change something on your channel.
Transcripts
get_transcript- What it does
- Read the transcript of ANY public YouTube video, not just your own.
- Kind
- Reads
list_transcript_languages- What it does
- List every caption language on a video and whether each was written by a human or auto-generated.
- Kind
- Reads
search_transcript- What it does
- Find every place a phrase is said in a video and get the timestamps, each as a link that jumps to that second.
- Kind
- Reads
get_transcripts- What it does
- Fetch transcripts for up to 20 videos in one call.
- Kind
- Reads
Research
search_videos- What it does
- Search YouTube and get results WITH view counts, likes and duration attached.
- Kind
- Reads
get_channel- What it does
- Look up any channel by @handle, id or URL.
- Kind
- Reads
analyze_channel- What it does
- Score a channel's recent videos against its OWN median views, so you can see which ones genuinely outperformed rather than which are simply oldest.
- Kind
- Reads
get_video- What it does
- Full detail for one video: title, description, channel, views, likes, comments, duration and tags.
- Kind
- Reads
Your channels
list_accounts- What it does
- List every YouTube channel connected to this server.
- Kind
- Reads
get_my_channel- What it does
- Details for a connected channel: subscribers, total views, video count and the uploads playlist id.
- Kind
- Reads
get_channel_analytics- What it does
- Watch time, average view duration, retention percentage, traffic sources and subscriber change for a connected channel.
- Kind
- Reads
list_my_videos- What it does
- List videos on a connected channel, newest first, with views and likes.
- Kind
- Reads
list_comments- What it does
- Read comment threads on a video, newest or most relevant first.
- Kind
- Reads
update_video- What it does
- Change a video's title, description, tags or privacy.
- Kind
- Writes
reply_to_comment- What it does
- Post a public reply to a comment thread as the connected channel.
- Kind
- Asks first
delete_video- What it does
- Permanently delete a video from a connected channel.
- Kind
- Asks first
Is the YouTube MCP server safe?
Writes work from the start, because managing a channel is the point. The two that can't be undone ask first.
delete_video and reply_to_comment ask first, marked "Asks first" in the tool tables above. YouTube deletes a video at once, with no trash, and a reply is public and notifies someone.
When your AI calls one of them, the call needs a yes first. Where you use it decides who gives it:
- Claude Code (2.1.246 and later) asks you before every call, in every one of its permission modes.
- An app that can show forms asks you in a form.
- Any other app takes your AI's
confirm: trueas the yes, so tell your AI to check with you first. - An agent with no person to ask needs
YOUTUBE_CONFIRM=model, so itsconfirm: truecounts in every app. - In a terminal, you add
--confirmto the command.
If the answer is no, nothing reaches YouTube.
Make it read-only
Set YOUTUBE_READ_ONLY=1 and every write disappears from the tool list, leaving 13. YOUTUBE_ALLOW_DESTRUCTIVE=0 keeps editing titles and blocks the two irreversible tools.
Keep a log of every write
Set YOUTUBE_AUDIT_LOG to a file path. The server writes one line per attempted write, allowed or blocked, with what it was about to do and who approved it.
Watch out: Comments, titles, descriptions and transcripts are written by other people, and some are written to steer whatever reads them. The server tells your AI to treat them as data, but for an agent working on its own, YOUTUBE_READ_ONLY=1 is the real defense.
Your data
There's no server of ours in between. Every request goes from your computer to YouTube and Google directly.
youtube-cli login saves your channels and API key to ~/.youtube-mcp-cli/channels.json, encrypted with a key derived from your computer and never stored, so a copied file is useless elsewhere. The audit log is written only when you set YOUTUBE_AUDIT_LOG.
Several channels
Run youtube-cli login once per channel, picking a different one in Google's chooser each time. Brand channels on the same Google account show up there too, and youtube-cli list-accounts shows them all.
Pass --account on the command line, or account through your AI, to pick one. With a single channel connected, you never need it.
YouTube MCP server settings
Every setting is an environment variable in your app's config. None are needed for transcripts, or on a computer where you ran youtube-cli login.
YOUTUBE_API_KEY- Default
- the saved key
- What it does
- Unlocks search, channel lookup and comments
YOUTUBE_CLIENT_ID- Default
- none
- What it does
- Names your OAuth client, for login and your own channels
YOUTUBE_CLIENT_SECRET- Default
- none
- What it does
- Holds that client's secret
YOUTUBE_ACCOUNTS- Default
- none
- What it does
- Lists several channels at once, as the JSON
youtube-cli login --printprints
YOUTUBE_READ_ONLY- Default
0- What it does
1hides every write
YOUTUBE_ALLOW_DESTRUCTIVE- Default
1- What it does
0blocks deleting videos and replying to comments
YOUTUBE_TRANSCRIPT_LANG- Default
en- What it does
- Sets the default transcript language
YOUTUBE_YTDLP_PATH- Default
yt-dlpon your PATH- What it does
- Points at yt-dlp, when your app can't find it
YOUTUBE_REFRESH_TOKEN- Default
- none
- What it does
- One channel
YOUTUBE_ACCESS_TOKEN- Default
- none
- What it does
- One channel, short-lived, for testing
YOUTUBE_CHANNEL_NAME- Default
default- What it does
- What to call that one channel
YOUTUBE_MCP_HOME- Default
~/.youtube-mcp-cli- What it does
- Where
loginsaves channels
YOUTUBE_YTDLP_COOKIES- Default
- none
- What it does
- A cookies.txt from a browser signed in to YouTube, for the bot check
YOUTUBE_OAUTH_CLIENT_ID- Default
- none
- What it does
- Another name for YOUTUBE_CLIENT_ID
YOUTUBE_OAUTH_CLIENT_SECRET- Default
- none
- What it does
- Another name for YOUTUBE_CLIENT_SECRET
YOUTUBE_OAUTH_PORT- Default
8765- What it does
- The localhost port
loginlistens on
YOUTUBE_REQUEST_TIMEOUT_MS- Default
30000- What it does
- Per-request deadline
YOUTUBE_SURFACE- Default
full- What it does
searchlists three tools that find, describe and run the rest
YOUTUBE_AUDIT_LOG- Default
- none
- What it does
- Names a file that gets one line per attempted write
YOUTUBE_TOOL_TIMEOUT_MS- Default
- none
- What it does
- Gives up on any tool after this many milliseconds
YOUTUBE_CONFIRM- Default
human- What it does
modellets your AI'sconfirm: trueapprove on its own, for an agent with no person to ask
YOUTUBE_HTTP_PORT- Default
8787- What it does
- Sets the port for
--http
YOUTUBE_HTTP_HOST- Default
127.0.0.1- What it does
- Sets the address for
--http, and any other needs a token
YOUTUBE_HTTP_TOKEN- Default
- none
- What it does
- Sets the bearer token every
--httprequest needs
YOUTUBE_HTTP_ALLOWED_ORIGINS- Default
- none
- What it does
- Lists other websites allowed to call
--http, comma separated
YOUTUBE_DEBUG- Default
- off
- What it does
1prints debug lines
Troubleshooting
Run the doctor first. It names the step that failed and the fix.
| What you see | What to do |
|---|---|
| "yt-dlp is not installed" | Transcripts need it: brew install yt-dlp |
| "Access blocked" at the consent screen | The channel's Google address isn't a test user in your Cloud project |
| The login stops working after a week | The OAuth app is still in testing. Publish it under Audience and log in again |
quotaExceeded | The daily quota resets at midnight Pacific |
| Search stops working before anything else | Search has its own 100-call daily allowance |
| A command lists your channels and stops | Two or more are connected. Pass --account |
If the server doesn't show up in your app at all, run the command your app runs, in a terminal, and read the error.
More free tools for YouTube
Find videos that beat their channel's average, write chapter timestamps, or check a title before you publish.
Free tools
FAQs about the YouTube MCP server & CLI
Here are the questions people ask most about the YouTube MCP server and CLI.
The YouTube MCP server & CLI is a free, open source program that lets an AI app like Claude, Codex or Cursor read transcripts, research channels and manage your own YouTube channels.
It has 16 tools for transcripts, research, and your own channels' videos, comments and analytics, and the same tools run as a CLI that agents like Claude Code and Codex use, or that you type yourself.
An MCP server is a standard way to give an AI app real access to a tool, so it can act instead of guessing.
MCP stands for Model Context Protocol, and Claude, Codex, Cursor and many other AI apps speak it.
Every server I've made is on my MCP servers page.
The YouTube CLI is the same program as the YouTube MCP server, run as commands.
AI agents like Claude Code, Codex and OpenCode run them for you, and you can type them in a terminal or a script.
One npm package installs both.
Use the YouTube MCP server in an AI app with no terminal, like Claude Desktop's chat, and the CLI in a terminal, a script or a cron job.
In an AI app that can run commands, like Claude Code, Codex or Cursor, the CLI is the lighter choice, because it costs nothing until it runs.
Yes, the YouTube MCP server is free and open source under the MIT license, and Google's API costs nothing within its daily quota.
Transcripts need no key at all.
Yes, it reads any public video with captions, including other people's, with no key and no account.
It reads the public caption tracks through yt-dlp, which needs to be installed.
You need one only for search, channel research and comments.
Transcripts need nothing, and your own channels need an OAuth login instead.
Yes, run youtube-cli login once per channel, brand channels included.
Each tool then takes an account to pick one.
Only when you ask, and only after you approve it, because YouTube deletes a video at once with no trash.
YOUTUBE_READ_ONLY=1 removes every write.
The YouTube MCP server works with any app that speaks MCP.
That includes Claude Code, Claude Desktop, Codex, Cursor, VS Code, Windsurf, Zed, Cline, GitHub Copilot CLI, Gemini CLI, OpenCode, OpenClaw, Antigravity and Hermes.
I did.
I'm Navid Moazzez, and I made the YouTube MCP server & CLI as one of my free tools on navid.me.
You can read more about me.
The code is on GitHub under the MIT license, and the package is on npm.
More MCP servers & CLIs
Related free tools
Navid.me is reader-supported. When you buy through links on this site, I may earn an affiliate commission. Read the affiliate disclaimer.
On this page
The most actionable AI newsletter for founders
Every week, get proven AI strategies, curated tools, and step-by-step systems to grow your audience, create better content, and build a profitable creator business.
No fluff, no filler, no BS. Just five minutes each week that might level up your online business and life.
P.S. Sign up now to get free access to my ultimate AI tools guide for creators.
