Connect Claude Desktop to your private YouTube channel analytics via OAuth2
📺 YouTube Channel Data MCP
Connect Claude Desktop to your private YouTube channel. Ask AI to analyze your real videos, watch time, subscribers, traffic sources, audience demographics — all from your actual YouTube Studio data. 100% free, open source, runs locally.
🤔 What Is This?
This is a Model Context Protocol (MCP) server that connects Claude Desktop directly to the YouTube Analytics API using OAuth2.
Instead of manually copying data from YouTube Studio into ChatGPT, you can just ask Claude:
"Analyze my channel and tell me why I'm not growing" "Which videos should I make more of?" "Where are my viewers coming from?"
And Claude reads your real private data — watch time, subscriber trends, demographics, traffic sources — and gives you actual AI-powered answers.
Claude Desktop → YouTube MCP Server → YouTube Analytics API → Your Private Data
(you) (this repo) (Google OAuth2) (stays local)
Everything runs on YOUR machine. Nothing is sent to any third party.
✨ What Data Claude Can Access
📊 Channel Level
| What | Details | |------|---------| | Subscribers | Total count, gained per day, lost per day | | Views | Total lifetime views, daily breakdown | | Watch Time | Estimated minutes watched, average view duration | | Video Count | Total uploads | | Channel description, creation date, branding |
🎬 Video Level
| What | Details | |------|---------| | All videos | Title, views, likes, comments, duration, publish date | | Top performers | Ranked by views, watch time, likes, subs gained, comments | | Per-video analytics | Day-by-day views, watch time, engagement for any video | | Video search | Search your own uploads by keyword | | Comments | Top comments from any video for audience research |
📡 Traffic Sources
| Source | What It Tells You | |--------|-----------------| | YouTube Search | People finding you via search | | Suggested Videos | YouTube recommending your content | | Browse Features | Homepage, trending, subscriptions feed | | External | Links from outside YouTube | | Direct / Other | Direct URL, unknown sources |
👥 Audience Demographics
| Dimension | Data | |-----------|------| | Age groups | 13-17, 18-24, 25-34, 35-44, 45-54, 55-64, 65+ | | Gender | Male / Female breakdown | | Countries | Top 20 countries by views | | Devices | Mobile, Desktop, Tablet, TV, Game Console |
🚀 Install — 3 Ways
Option A — One Command (Easiest)
git clone https://github.com/itsadityasharma/youtube-channel-data-mcp.git
cd youtube-channel-data-mcp
bash install.sh
The script guides you through everything. Takes ~15 minutes.
Option B — Download ZIP (No Git needed)
- Click the green Code button above → Download ZIP
- Unzip to your Desktop
- Open Terminal →
cd ~/Desktop/youtube-channel-data-mcp - Run
bash install.sh
Option C — Manual Step by Step
Follow the detailed guide below ↓
📋 What You Need Before Starting
| Requirement | Where to get it | Cost | |------------|----------------|------| | Mac (10.15+) | You have it | Free | | Node.js 18+ | nodejs.org → Download LTS | Free | | Claude Desktop | claude.ai/download | Free | | Google account | The one that owns your YouTube channel | Free | | Google Cloud project | console.cloud.google.com | Free |
🔧 Manual Setup — Full Guide
STEP 1 — Create Google Cloud Project
- Go to console.cloud.google.com
- Click "Select a project" (top left) → "New Project"
- Name:
YouTube MCP→ Click Create - Make sure your new project is selected in the top bar
STEP 2 — Enable YouTube APIs
In your project:
- Go to APIs & Services → Library
- Search "YouTube Data API v3" → Click → Enable
- Go back to Library
- Search "YouTube Analytics API" → Click → Enable
⚠️ You need BOTH. YouTube Data API gets video info. YouTube Analytics API gets private stats like watch time and demographics.
STEP 3 — Set Up OAuth Consent Screen
- Go to APIs & Services → OAuth consent screen
- User type → select External → Click Create
- Fill in:
- App name:
YouTube MCP - User support email: your Gmail
- Developer contact: your Gmail
- App name:
- Click Save and Continue
- On Scopes page → click Save and Continue (skip for now)
- On Test Users page → click + Add Users → add your YouTube channel Gmail → click Save
- Click Save and Continue → Back to Dashboard
STEP 4 — Create OAuth Credentials
- Go to APIs & Services → Credentials
- Click + Create Credentials → OAuth client ID
- Application type → select Desktop app
- Name:
YouTube MCP Desktop - Click Create
- A popup appears → click Download JSON
- Rename the downloaded file to exactly:
credentials.json
STEP 5 — Install the MCP Server
Open Terminal on your Mac (Cmd + Space → type Terminal → Enter):
# Download this repo
git clone https://github.com/itsadityasharma/youtube-channel-data-mcp.git
cd youtube-channel-data-mcp
# Move your credentials file in
mv ~/Downloads/credentials.json ./credentials.json
# Install dependencies
npm install
STEP 6 — Authenticate With YouTube
node auth.js
Your browser opens → log in with the Google account that owns your YouTube channel → click Allow.
If you see "This app isn't verified" → click Advanced → Go to YouTube MCP (unsafe) — this is totally normal for personal apps.
You'll see ✅ YouTube Connected! in the browser. Done.
STEP 7 — Connect to Claude Desktop
Open this file in TextEdit:
~/Library/Application Support/Claude/claude_desktop_config.json
Via Terminal:
open -a TextEdit ~/Library/Application\ Support/Claude/claude_desktop_config.json
Add this (replace YOURNAME with your Mac username):
{
"mcpServers": {
"youtube-analytics": {
"command": "node",
"args": ["/Users/YOURNAME/youtube-channel-data-mcp/server.js"]
}
}
}
To find your username run:
echo $USERin Terminal
Restart Claude Desktop. Done! ✅
💬 Ready-to-Use Claude Prompts
Copy-paste these directly into Claude Desktop after setup:
🔍 First test
Use youtube-analytics MCP and show me my channel overview
📊 Full channel audit
Pull my YouTube channel overview, top 20 videos by watch time,
90-day analytics, traffic sources and audience demographics.
Give me a complete performance report with actionable growth recommendations.
🎯 Video topic strategy
Get my top 20 videos by watch time. Analyze patterns — what topics,
video lengths, and title styles perform best? Suggest 10 new video
ideas based on what's actually working on my channel.
👥 Audience deep dive
Show me my full audience demographics — age groups, gender, top countries,
device types. Based on this real data, what content style, posting schedule
and topics would resonate most with my actual audience?
📡 Traffic source audit
Show my traffic sources breakdown. How dependent am I on one source?
What specific steps can I take to grow YouTube Search traffic for my channel?
💬 Comment mining for ideas
Get the top comments from my 5 most-viewed videos. What questions are
people asking? What are they requesting? What frustrations come up?
Turn this into a 30-day content calendar.
📉 Underperformer diagnosis
Get all my videos. Compare my bottom 10 vs top 10 by view-to-subscriber ratio.
Why did the lower ones underperform? What would you do differently with that content?
🚀 Growth acceleration
Analyze my channel analytics for the last 6 months. Which months had the
best growth? What videos drove it? What patterns do you see that I should
double down on? Give me a 90-day growth plan.
🔒 Privacy & Security
| Question | Answer | |----------|--------| | Does my data go to any server? | ❌ No. Runs 100% on your Mac | | Can it post or delete videos? | ❌ No. Read-only access only | | Is it safe to use OAuth? | ✅ Same system used by TubeBuddy, VidIQ, Hootsuite | | Who can see my analytics? | Only you — it's on your machine | | Can I revoke access? | ✅ Any time at myaccount.google.com/permissions |
Never commit credentials.json or tokens.json to any git repository.
🛠 Troubleshooting
"credentials.json not found"
ls ~/youtube-channel-data-mcp/
# You should see credentials.json listed
# If not: mv ~/Downloads/credentials.json ~/youtube-channel-data-mcp/
"Not authenticated. Run node auth.js"
cd ~/youtube-channel-data-mcp && node auth.js
Port 3000 already in use
lsof -ti:3000 | xargs kill -9 && node auth.js
Claude Desktop doesn't show YouTube tools
- Check JSON syntax in config (missing comma = broken)
- Replace
YOURNAMEwith your actual Mac username (echo $USER) - Force quit Claude completely via Activity Monitor → reopen
"This app isn't verified" Google warning
- Click Advanced → Go to YouTube MCP (unsafe)
- Normal for personal apps — you built it, you trust it
Access blocked / org_internal error
- You're logged into a Google Workspace account in the browser
- Open an Incognito window → run auth.js again → log in with personal Gmail
Quota exceeded
- YouTube Data API free limit: 10,000 units/day
- Analytics queries cost ~1–10 units each
- Wait 24h or request quota increase in Google Cloud Console
📁 Files in This Repo
youtube-channel-data-mcp/
├── server.js ← The MCP server Claude connects to
├── auth.js ← Run once to link your YouTube account
├── install.sh ← Automated installer script
├── package.json ← Node.js dependencies
├── .gitignore ← Keeps your credentials out of git
├── README.md ← This guide
├── credentials.json ← ⚠️ YOU add this (never commit!)
└── tokens.json ← ⚠️ Auto-created after auth (never commit!)
🤝 Contributing
PRs welcome! Things that would be great:
- Windows support
- Linux support
- Additional MCP tools (YouTube Reporting API, revenue data)
- Better error messages and recovery flows
📄 License
MIT — free to use, modify, share, and build on.
👨💻 About
Built by Aditya Sharma
I build tools at the intersection of AI and marketing. Follow along:
- 🌐 Website: adityaarsharma.com
- 🐦 Twitter/X: @adityaarsharma
- 💻 GitHub: @adityaarsharma
If this saved you time → star the repo ⭐ and share it with a creator friend!
Keywords: youtube mcp server, claude desktop youtube, youtube analytics mcp, connect claude to youtube, youtube api claude, youtube analytics ai, private youtube data claude, youtube mcp oauth2, claude youtube channel analysis, model context protocol youtube