youtube-mcp-server
Provides full programmatic control over a single YouTube channel, including tools for channel management, video upload and editing, playlist management, comments, captions, search, subscriptions, and analytics.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@youtube-mcp-serverlist my recent videos"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
youtube-mcp-server
A local stdio MCP server that gives Claude (or any MCP client) full programmatic control over a single YouTube channel. Built with the MCP SDK, googleapis, and strict TypeScript/ESM.
What It Does
The server exposes ~46 tools grouped across eight domains:
Channel (4 tools)
Tool | Description |
| Fetch full details (stats, branding, playlists) for the authenticated channel |
| Fetch public details for any channel by ID, @handle, or username |
| Update description, keywords, country, language, or trailer video |
| List all sections on the channel home page |
Videos (8 tools)
Tool | Description |
| Fetch full metadata for any video by ID |
| List videos uploaded to the authenticated channel (paginated) |
| Upload a local video file to the channel |
| Update title, description, tags, category, or privacy for a video |
| Permanently delete a video (requires |
| Upload a local image file as the custom thumbnail |
| Like, dislike, or remove a rating on any video |
| List available video category IDs for a given region |
Playlists (6 tools)
Tool | Description |
| List playlists owned by the authenticated channel |
| Fetch details for any playlist by ID |
| Create a new playlist with title, description, and privacy |
| Update title, description, or privacy of a playlist |
| Permanently delete a playlist (requires |
| List items (videos) inside any playlist (paginated) |
| Add a video to a playlist |
| Remove an item from a playlist (requires |
Comments (6 tools)
Tool | Description |
| List top-level comment threads on a video or channel |
| Fetch a single comment thread with replies |
| Post a new top-level comment on a video |
| Post a reply to an existing comment thread |
| Edit the text of a comment you own |
| Delete a comment (requires |
| Set a comment's moderation status (hold/publish/reject) |
Captions (5 tools)
Tool | Description |
| List caption tracks for a video |
| Download the raw caption track content |
| Upload a new caption file to a video |
| Replace an existing caption track |
| Delete a caption track (requires |
Search (2 tools)
Tool | Description |
| Full YouTube search with filters (type, channel, order, date, region) |
| Search within only the authenticated channel's videos |
Subscriptions (3 tools)
Tool | Description |
| List channels the authenticated account is subscribed to |
| Subscribe to a channel by channel ID |
| Unsubscribe from a channel (requires |
Analytics (6 tools)
Tool | Description |
| Core channel metrics (views, watchTime, subscribers) over a date range |
| Per-video metrics over a date range |
| Traffic source breakdown (search, suggested, external, etc.) |
| Age/gender audience breakdown |
| Top N videos by a chosen metric (views, watchTimeMins, etc.) |
| Revenue and ad metrics (requires monetized channel) |
Prerequisites
Node.js >= 18 (ESM +
fetchbuiltins required)A Google account with a YouTube channel
A Google Cloud project (see setup below)
Credentials & Configuration
This server authenticates to Google as you via OAuth 2.0. Nothing is hard-coded — you supply credentials at runtime, and none of them are ever committed (all are listed in .gitignore). You need three secret values, all obtained during the Google OAuth setup below:
Value | What it is | Where it comes from |
| OAuth client identifier (ends in |
|
| OAuth client secret |
|
| Long-lived token authorizing access to your channel | produced by |
You provide these in one of two ways:
Option A — file-based (recommended). Drop the downloaded credentials.json into the project root and run npm run auth. That writes token.json (containing all three values) and the server picks it up automatically. Nothing else to configure.
Option B — environment variables. Instead of token.json, set the three values directly (handy for CI, Docker, or a secrets manager):
YT_CLIENT_ID=your-client-id.apps.googleusercontent.com
YT_CLIENT_SECRET=your-client-secret
YT_REFRESH_TOKEN=your-refresh-tokenSee .env.example for a fully-commented template covering both options. Never commit credentials.json, token.json, or a real .env — anyone holding these can fully control your YouTube channel.
Google OAuth Setup
1. Create or Select a Google Cloud Project
Go to console.cloud.google.com.
Click the project selector (top-left) → New Project.
Name it (e.g.
my-youtube-app), click Create.Make sure the new project is selected in the dropdown before continuing.
2. Enable the Required APIs
In the left menu: APIs & Services → Library.
Search for and Enable each of the following:
YouTube Data API v3 (required)
YouTube Analytics API (required)
YouTube Reporting API (optional — bulk reporting jobs)
3. Configure the OAuth Consent Screen
Go to APIs & Services → OAuth consent screen.
Select External as the User Type, click Create.
Fill in the required fields:
App name (e.g.
My YouTube Tool)User support email (your own Google account)
Developer contact email (your own Google account)
Click Save and Continue through the Scopes step (you will add scopes in code, not here — or add them here if prompted).
On the Test users step: click + Add Users and add your own Google account email. Click Save and Continue.
Submit/finish the wizard.
Important — 7-day token expiry warning: While the app's publishing status is Testing, Google issues refresh tokens that expire after 7 days, regardless of any other setting. When your token expires, your app will get an
invalid_granterror and you must re-authenticate.To avoid this disruption:
Option A (recommended for personal use): Keep the app in Testing but make sure your own account is listed as a Test User — re-auth when needed, or click Publish App to move to Production.
Option B: Click Publish App → your app moves to "In Production" and refresh tokens no longer have the 7-day limit (tokens only expire if unused for 6+ months or manually revoked).
For a personal channel tool you own, publishing is safe and removes the friction.
4. Create OAuth Client Credentials (Desktop App)
Go to APIs & Services → Credentials.
Click + Create Credentials → OAuth client ID.
Application type: Desktop app.
Name it (e.g.
youtube-desktop-client), click Create.Click Download JSON on the confirmation dialog (or find it in the credentials list and click the download icon).
Save the file as
credentials.jsonin your project root.Keep this file private — never commit it to version control.
5. Scopes Requested
The server requests all six of these scopes:
https://www.googleapis.com/auth/youtube
https://www.googleapis.com/auth/youtube.force-ssl
https://www.googleapis.com/auth/youtube.upload
https://www.googleapis.com/auth/youtubepartner
https://www.googleapis.com/auth/yt-analytics.readonly
https://www.googleapis.com/auth/yt-analytics-monetary.readonlyThese cover full channel management, uploads, partner operations, and read access to both standard and monetary analytics.
6. Quota Limits
Resource | Cost |
Default daily quota | 10,000 units/day |
| 100 units per call |
| ~1,600 units per call |
Most read operations | 1–5 units |
Monitor usage at APIs & Services → Quotas & System Limits. You can request a quota increase via the console if needed.
7. Local Auth Flow with @google-cloud/local-auth
The npm run auth command uses @google-cloud/local-auth to open a browser consent flow and writes token.json to the project root.
import { authenticate } from '@google-cloud/local-auth';
import path from 'path';
const SCOPES = [
'https://www.googleapis.com/auth/youtube',
'https://www.googleapis.com/auth/youtube.force-ssl',
'https://www.googleapis.com/auth/youtube.upload',
'https://www.googleapis.com/auth/youtubepartner',
'https://www.googleapis.com/auth/yt-analytics.readonly',
'https://www.googleapis.com/auth/yt-analytics-monetary.readonly',
];
const client = await authenticate({
scopes: SCOPES,
keyfilePath: path.join(process.cwd(), 'credentials.json'),
});
// client.credentials includes access_token AND refresh_tokenHow the flow works:
authenticate()starts a local loopback HTTP server onlocalhost(a random port).It opens the Google consent URL in the user's default browser.
After the user grants consent, Google redirects to
http://localhost:<port>with an auth code.The library exchanges the code for tokens and returns an
OAuth2Client.client.credentials.refresh_tokenis present on the first authorization — persist it (e.g.token.json) and reuse it to avoid re-prompting on subsequent runs.
import fs from 'fs';
const TOKEN_PATH = path.join(process.cwd(), 'token.json');
// After first auth, save credentials:
fs.writeFileSync(TOKEN_PATH, JSON.stringify(client.credentials));
// On subsequent runs, load and restore:
import { google } from 'googleapis';
const savedCreds = JSON.parse(fs.readFileSync(TOKEN_PATH, 'utf8'));
const oauth2Client = new google.auth.OAuth2();
oauth2Client.setCredentials(savedCreds);
// Pass oauth2Client to google.youtube({ version: 'v3', auth: oauth2Client })Sources:
Install and Build
# Install dependencies
npm install
# Compile TypeScript to dist/
npm run buildAuthorize
Run the one-time OAuth flow to generate token.json:
npm run authThis opens a browser window. Sign in with the Google account that owns your YouTube channel, grant all requested scopes, and the token is saved automatically.
Security note:
credentials.jsonandtoken.jsonare listed in.gitignoreand must never be committed or shared. Anyone with these files can fully manage your YouTube channel.
Connect to Claude Code
Option A — claude mcp add command
claude mcp add youtube-mcp-server \
--transport stdio \
-- node "/ABSOLUTE/PATH/TO/youtube-mcp-server/dist/index.js"If you want to pass the token path explicitly via an environment variable:
claude mcp add youtube-mcp-server \
--transport stdio \
--env YT_TOKEN_PATH="/ABSOLUTE/PATH/TO/youtube-mcp-server/token.json" \
-- node "/ABSOLUTE/PATH/TO/youtube-mcp-server/dist/index.js"Option B — JSON config block
Add the following entry to your Claude Code MCP config file (.claude/settings.json or the global equivalent):
{
"mcpServers": {
"youtube-mcp-server": {
"type": "stdio",
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/youtube-mcp-server/dist/index.js"],
"env": {
"YT_TOKEN_PATH": "/ABSOLUTE/PATH/TO/youtube-mcp-server/token.json"
}
}
}
}Option C — Environment-variable auth (no token.json)
Instead of token.json, you can supply credentials directly via environment variables — useful for CI or shared environments:
export YT_CLIENT_ID="your-client-id"
export YT_CLIENT_SECRET="your-client-secret"
export YT_REFRESH_TOKEN="your-refresh-token"
node dist/index.jsCopy .env.example to .env and fill in the values if you use a .env-loading approach.
Quota and Safety Notes
Daily quota: 10,000 units by default. A single
youtube_searchcall costs 100 units; a video upload costs ~1,600 units. Read operations cost 1–5 units each.Destructive tools (
youtube_delete_video,youtube_delete_playlist,youtube_delete_comment,youtube_delete_caption,youtube_remove_playlist_item,youtube_unsubscribe) all requireconfirm: truein the call. This prevents accidental data loss when the model mis-fires.Revenue analytics (
youtube_get_revenue_analytics) requires a monetized channel enrolled in the YouTube Partner Program.Token expiry: If you leave the OAuth app in "Testing" status, refresh tokens expire after 7 days. Either add yourself as a Test User and re-run
npm run authwhen needed, or publish the app to Production to remove the limit.
Testing
Interactive inspector (recommended for exploring tools)
npx @modelcontextprotocol/inspector node dist/index.jsOpen the URL printed in the terminal to browse and call tools interactively.
Smoke test (CI-friendly)
npm run build
node scripts/smoke.mjsExpected output:
TOOLS:46Exit code 0 means at least one tool is registered; exit code 1 means the server failed to respond or registered no tools.
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/tuitamogamer-gpt/youtube-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server