youtube-channel-mcp 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +365 -0
- package/auth.js +48 -0
- package/package.json +56 -0
- package/server.js +540 -0
- package/skills/youtube-channel-audit.md +164 -0
- package/skills/youtube-competitor-spy.md +122 -0
- package/skills/youtube-script-writer.md +202 -0
- package/skills/youtube-seo-optimizer.md +223 -0
- package/skills/youtube-shorts-repurposer.md +135 -0
- package/skills/youtube-thumbnail-auditor.md +196 -0
- package/skills/youtube-topic-finder.md +184 -0
- package/skills/youtube-video-analyzer.md +150 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Aditya Sharma
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
# YouTube MCP Server
|
|
2
|
+
|
|
3
|
+
> **Connect Claude to your YouTube channel.** Read analytics, fetch full video metadata (including unlisted/private/draft), search your uploads, and update titles/descriptions/tags — all from Claude Desktop, Claude Code, or any MCP client.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/youtube-studio-mcp)
|
|
6
|
+
[](https://www.npmjs.com/package/youtube-studio-mcp)
|
|
7
|
+
[](https://github.com/adityaarsharma/youtube-studio-mcp)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
[](https://claude.ai)
|
|
10
|
+
[](https://nodejs.org)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## What Is This?
|
|
15
|
+
|
|
16
|
+
A **Model Context Protocol (MCP) server** that connects Claude to the **YouTube Data API v3** and **YouTube Analytics API** via OAuth2.
|
|
17
|
+
|
|
18
|
+
Instead of copying data from YouTube Studio into AI tools, just ask Claude:
|
|
19
|
+
|
|
20
|
+
- *"Pull the full title, description and tags for this video"*
|
|
21
|
+
- *"What are my top performing videos this month?"*
|
|
22
|
+
- *"Update the title and tags on my latest upload"*
|
|
23
|
+
- *"Where is my traffic coming from?"*
|
|
24
|
+
|
|
25
|
+
Claude reads your **real private channel data** and can **update video SEO directly**.
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Claude → YouTube MCP Server → YouTube APIs → Your Channel Data
|
|
29
|
+
(you) (this repo) (OAuth2) (stays local)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Everything runs on YOUR machine. Read + Write access. Nothing sent to third parties.**
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Tools Available (10 total)
|
|
37
|
+
|
|
38
|
+
### Video Metadata (Read + Write)
|
|
39
|
+
|
|
40
|
+
| Tool | What It Does |
|
|
41
|
+
|------|-------------|
|
|
42
|
+
| `get_video_details` | Full metadata for any video by ID or URL — title, full description, all tags, category, privacy status (public/unlisted/private/draft), stats, duration, thumbnail URL |
|
|
43
|
+
| `search_my_videos` | Search your own channel's videos by keyword. Returns metadata + stats for matching videos |
|
|
44
|
+
| `update_video_seo` | Update title, description, and/or tags on any video directly. Only changes fields you provide |
|
|
45
|
+
|
|
46
|
+
### Channel Analytics
|
|
47
|
+
|
|
48
|
+
| Tool | What It Does |
|
|
49
|
+
|------|-------------|
|
|
50
|
+
| `get_channel_overview` | Subscribers, total views, video count, channel description, creation date |
|
|
51
|
+
| `get_all_videos` | List all videos with stats (views, likes, comments, tags, privacy status). Sort by date or views |
|
|
52
|
+
| `get_analytics_over_time` | Day-by-day views, watch time, subscribers gained/lost for any date range |
|
|
53
|
+
| `get_top_videos_analytics` | Top performing videos ranked by views with retention %, watch time, subs gained |
|
|
54
|
+
| `get_audience_demographics` | Audience breakdown: top countries, device types, age groups, gender |
|
|
55
|
+
| `get_traffic_sources` | Where viewers come from: YouTube Search, Suggested, Browse, External, Direct |
|
|
56
|
+
| `analyze_and_suggest_topics` | Pulls channel + top video data for AI-powered topic analysis |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
|
|
62
|
+
### Option A: npx (Zero Install — just run it)
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npx youtube-studio-mcp
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Option B: Global Install
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm install -g youtube-studio-mcp
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Option C: Clone + Run
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git clone https://github.com/adityaarsharma/youtube-studio-mcp.git
|
|
78
|
+
cd youtube-studio-mcp
|
|
79
|
+
npm install
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Option D: Download ZIP
|
|
83
|
+
|
|
84
|
+
1. Click **Code → Download ZIP** above
|
|
85
|
+
2. Unzip → open Terminal → `cd` into the folder
|
|
86
|
+
3. Run `npm install`
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Setup (15 minutes, one time)
|
|
91
|
+
|
|
92
|
+
### Step 1 — Google Cloud Project
|
|
93
|
+
|
|
94
|
+
1. Go to [console.cloud.google.com](https://console.cloud.google.com)
|
|
95
|
+
2. Create a new project (name: `YouTube MCP`)
|
|
96
|
+
3. Enable these 2 APIs:
|
|
97
|
+
- **YouTube Data API v3** (for video data + updates)
|
|
98
|
+
- **YouTube Analytics API** (for private analytics)
|
|
99
|
+
|
|
100
|
+
### Step 2 — OAuth Consent Screen
|
|
101
|
+
|
|
102
|
+
1. Go to **APIs & Services → OAuth consent screen**
|
|
103
|
+
2. Select **External** → Create
|
|
104
|
+
3. Fill in app name (`YouTube MCP`), your email
|
|
105
|
+
4. Skip scopes → Add your Gmail as test user → Save
|
|
106
|
+
|
|
107
|
+
### Step 3 — Create OAuth Credentials
|
|
108
|
+
|
|
109
|
+
1. Go to **APIs & Services → Credentials**
|
|
110
|
+
2. Click **+ Create Credentials → OAuth client ID**
|
|
111
|
+
3. Select **Desktop app** → Create
|
|
112
|
+
4. **Download JSON** → rename to `credentials.json`
|
|
113
|
+
5. Move into this repo folder
|
|
114
|
+
|
|
115
|
+
### Step 4 — Authenticate
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
node auth.js
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Browser opens → log in with the Google account that owns your YouTube channel → Allow.
|
|
122
|
+
|
|
123
|
+
> **"This app isn't verified"** warning is normal for personal apps. Click **Advanced → Go to YouTube MCP (unsafe)**.
|
|
124
|
+
|
|
125
|
+
### Step 5 — Connect to Claude
|
|
126
|
+
|
|
127
|
+
#### Claude Desktop
|
|
128
|
+
|
|
129
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (Mac) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"mcpServers": {
|
|
134
|
+
"youtube-analytics": {
|
|
135
|
+
"command": "node",
|
|
136
|
+
"args": ["/full/path/to/youtube-studio-mcp/server.js"]
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Or if installed via npm:
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"mcpServers": {
|
|
147
|
+
"youtube-analytics": {
|
|
148
|
+
"command": "npx",
|
|
149
|
+
"args": ["-y", "youtube-studio-mcp"]
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
#### Claude Code (Terminal)
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
claude mcp add youtube-analytics node /full/path/to/youtube-studio-mcp/server.js
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
#### VS Code
|
|
162
|
+
|
|
163
|
+
Add to `.vscode/settings.json`:
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"mcp.servers": {
|
|
168
|
+
"youtube-analytics": {
|
|
169
|
+
"command": "npx",
|
|
170
|
+
"args": ["-y", "youtube-studio-mcp"]
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Restart Claude. Done!
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Ready-to-Use Prompts
|
|
181
|
+
|
|
182
|
+
### SEO Audit (any video)
|
|
183
|
+
```
|
|
184
|
+
Get the full details for this video: [paste URL or ID]
|
|
185
|
+
Check what keywords it's ranking for and suggest optimized title + tags
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Channel Performance Report
|
|
189
|
+
```
|
|
190
|
+
Pull my channel overview, top 20 videos by watch time, 90-day analytics,
|
|
191
|
+
traffic sources and audience demographics. Give me a full performance report.
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Video Topic Research
|
|
195
|
+
```
|
|
196
|
+
Get my top 20 videos by watch time. What patterns do you see —
|
|
197
|
+
topics, lengths, title styles? Suggest 10 new video ideas.
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Update Video SEO
|
|
201
|
+
```
|
|
202
|
+
Search my videos for "elementor menu". Pull the full details.
|
|
203
|
+
Write an optimized title, description, and tags — then update it.
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Audience Deep Dive
|
|
207
|
+
```
|
|
208
|
+
Show my full audience demographics — age, gender, countries, devices.
|
|
209
|
+
What content style and posting schedule fits my actual audience?
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Underperformer Diagnosis
|
|
213
|
+
```
|
|
214
|
+
Get all my videos. Compare bottom 10 vs top 10 by views.
|
|
215
|
+
Why did the lower ones underperform? What would you change?
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## 8 Bundled AI Skills for YouTube Creators
|
|
221
|
+
|
|
222
|
+
This repo includes **ready-to-use AI skill files** in the `skills/` folder that supercharge your YouTube workflow. Each skill is a structured prompt that makes Claude act as a specialized team member.
|
|
223
|
+
|
|
224
|
+
**Install any skill:** Copy the `.md` file into your Claude skills directory and it activates automatically.
|
|
225
|
+
|
|
226
|
+
| Skill | What It Does | Trigger Phrases |
|
|
227
|
+
|-------|-------------|-----------------|
|
|
228
|
+
| **[SEO Optimizer](skills/youtube-seo-optimizer.md)** | Optimizes titles, descriptions, tags. Protects existing ranking keywords. 3 title options + full description + 20 tags | "optimize this video", "write title", "write tags" |
|
|
229
|
+
| **[Channel Audit](skills/youtube-channel-audit.md)** | Full channel health report — views, subs, retention, traffic sources, audience demographics. Identifies problems and prescribes fixes | "audit my channel", "why am I not growing", "channel report" |
|
|
230
|
+
| **[Topic Finder](skills/youtube-topic-finder.md)** | 12 data-backed video topics with keyword volumes, SERP gaps, and competitor analysis. Tier 1/2/3 prioritization | "video ideas", "what should I make next", "find topics" |
|
|
231
|
+
| **[Thumbnail Auditor](skills/youtube-thumbnail-auditor.md)** | 20-point thumbnail scoring (66-point scale). Grades A-F with specific redesign instructions | "audit thumbnail", "review this thumbnail", "CTR is low" |
|
|
232
|
+
| **[Script Writer](skills/youtube-script-writer.md)** | Full production-ready scripts with word-for-word narration, screen cues, timestamps, editor brief, and companion Short script | "write script", "video script", "tutorial script" |
|
|
233
|
+
| **[Competitor Spy](skills/youtube-competitor-spy.md)** | Competitor channel analysis, SERP battle maps, 10 "steal-worthy" topics with differentiation angles | "competitor analysis", "who's beating me", "content gaps" |
|
|
234
|
+
| **[Video Analyzer](skills/youtube-video-analyzer.md)** | Deep single-video analysis — SEO score (21-point), performance benchmarks, and optimized rewrite | "analyze this video", "why isn't this performing", "video audit" |
|
|
235
|
+
| **[Shorts Repurposer](skills/youtube-shorts-repurposer.md)** | Turn any long-form video into 3-5 Shorts with hooks, text overlays, and posting strategy | "make shorts from this", "repurpose video", "extract shorts" |
|
|
236
|
+
|
|
237
|
+
### How the Skills + MCP Work Together
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
You: "Optimize this video: youtube.com/watch?v=abc123"
|
|
241
|
+
|
|
242
|
+
Claude:
|
|
243
|
+
1. youtube-seo-optimizer skill activates
|
|
244
|
+
2. Calls get_video_details → pulls current title, description, tags
|
|
245
|
+
3. Checks YouTube SERP for current rankings
|
|
246
|
+
4. Lists PROTECTED keywords (won't remove)
|
|
247
|
+
5. Writes 3 new title options + full description + 20 tags
|
|
248
|
+
6. Can call update_video_seo to apply changes directly
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
The skills tell Claude **what to do**. The MCP tools give Claude **access to your data**. Together they create a complete YouTube AI workflow.
|
|
252
|
+
|
|
253
|
+
### Install Skills
|
|
254
|
+
|
|
255
|
+
**Claude Desktop / Claude Code:**
|
|
256
|
+
```bash
|
|
257
|
+
# Copy a skill to your Claude skills directory
|
|
258
|
+
cp skills/youtube-seo-optimizer.md ~/.claude/skills/
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**Or install all 8:**
|
|
262
|
+
```bash
|
|
263
|
+
cp skills/youtube-*.md ~/.claude/skills/
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## OAuth Scopes
|
|
269
|
+
|
|
270
|
+
| Scope | Purpose |
|
|
271
|
+
|-------|---------|
|
|
272
|
+
| `youtube` | Read + write video metadata (titles, descriptions, tags) |
|
|
273
|
+
| `youtube.readonly` | Read video data, search, list |
|
|
274
|
+
| `yt-analytics.readonly` | Read private analytics (views, watch time, subs, demographics) |
|
|
275
|
+
| `youtubepartner-channel-audit` | Extended channel audit data |
|
|
276
|
+
|
|
277
|
+
**To enable write access** (update_video_seo), delete `tokens.json` and re-run `node auth.js`. The new auth flow requests the `youtube` write scope.
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## Privacy & Security
|
|
282
|
+
|
|
283
|
+
| Question | Answer |
|
|
284
|
+
|----------|--------|
|
|
285
|
+
| Does my data go to any server? | No — runs 100% on your machine |
|
|
286
|
+
| Can it delete videos? | No — only reads data and updates metadata |
|
|
287
|
+
| Is OAuth safe? | Yes — same system used by TubeBuddy, VidIQ |
|
|
288
|
+
| Can I revoke access? | Yes — anytime at myaccount.google.com/permissions |
|
|
289
|
+
|
|
290
|
+
**Never commit `credentials.json` or `tokens.json` to git.**
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Troubleshooting
|
|
295
|
+
|
|
296
|
+
| Problem | Fix |
|
|
297
|
+
|---------|-----|
|
|
298
|
+
| `credentials.json not found` | Download from Google Cloud Console → move to repo folder |
|
|
299
|
+
| `Not authenticated` | Run `node auth.js` |
|
|
300
|
+
| Port 3000 in use | `lsof -ti:3000 \| xargs kill -9` then retry |
|
|
301
|
+
| Claude doesn't show tools | Check JSON syntax in config, restart Claude fully |
|
|
302
|
+
| "App isn't verified" | Click Advanced → Go to YouTube MCP (unsafe) |
|
|
303
|
+
| `update_video_seo` fails | Delete `tokens.json`, re-run `node auth.js` for write scope |
|
|
304
|
+
| Quota exceeded | YouTube API free limit: 10,000 units/day. Wait 24h |
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## What's New in v2.1
|
|
309
|
+
|
|
310
|
+
- **npm package** — `npx youtube-studio-mcp` for zero-install
|
|
311
|
+
- **8 AI skills** — bundled YouTube workflow skills for Claude
|
|
312
|
+
- **MIT License** — free to use, modify, share
|
|
313
|
+
|
|
314
|
+
## What's New in v2.0
|
|
315
|
+
|
|
316
|
+
- **`get_video_details`** — Full metadata by video ID or URL. Works for public, unlisted, private, and draft videos
|
|
317
|
+
- **`search_my_videos`** — Search your own uploads by keyword
|
|
318
|
+
- **`update_video_seo`** — Update title, description, tags directly on YouTube
|
|
319
|
+
- **YouTube write scope** — OAuth now requests `youtube` scope for SEO updates
|
|
320
|
+
- **URL parsing** — Pass full YouTube URLs or just video IDs
|
|
321
|
+
- **Privacy status** — All video listings now show public/unlisted/private status
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Files
|
|
326
|
+
|
|
327
|
+
```
|
|
328
|
+
youtube-studio-mcp/
|
|
329
|
+
├── server.js ← MCP server (10 tools)
|
|
330
|
+
├── auth.js ← Run once to link YouTube account
|
|
331
|
+
├── package.json ← Dependencies + npm config
|
|
332
|
+
├── skills/ ← 8 AI skills for YouTube creators
|
|
333
|
+
├── LICENSE ← MIT
|
|
334
|
+
├── credentials.json ← YOU add this (never commit!)
|
|
335
|
+
└── tokens.json ← Auto-created after auth (never commit!)
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Contributing
|
|
341
|
+
|
|
342
|
+
PRs welcome! Ideas:
|
|
343
|
+
- Transcript extraction (YouTube captions API)
|
|
344
|
+
- YouTube Shorts-specific analytics
|
|
345
|
+
- Revenue/monetization data (YouTube Reporting API)
|
|
346
|
+
- Playlist management tools
|
|
347
|
+
- Comment management tools
|
|
348
|
+
- Thumbnail upload
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## License
|
|
353
|
+
|
|
354
|
+
[MIT](LICENSE) — free to use, modify, share.
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## Built By
|
|
359
|
+
|
|
360
|
+
**[Aditya Sharma](https://adityaarsharma.com)** — Building AI tools for creators and marketers.
|
|
361
|
+
|
|
362
|
+
- [Twitter/X](https://twitter.com/adityaarsharma)
|
|
363
|
+
- [GitHub](https://github.com/adityaarsharma)
|
|
364
|
+
|
|
365
|
+
If this saved you time — **star the repo** and share with a creator friend!
|
package/auth.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { google } from "googleapis";
|
|
3
|
+
import express from "express";
|
|
4
|
+
import open from "open";
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
8
|
+
|
|
9
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const TOKEN_PATH = path.join(__dirname, "tokens.json");
|
|
11
|
+
const CREDENTIALS_PATH = path.join(__dirname, "credentials.json");
|
|
12
|
+
|
|
13
|
+
const SCOPES = [
|
|
14
|
+
"https://www.googleapis.com/auth/youtube.readonly",
|
|
15
|
+
"https://www.googleapis.com/auth/yt-analytics.readonly",
|
|
16
|
+
"https://www.googleapis.com/auth/yt-analytics-monetary.readonly",
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const creds = JSON.parse(fs.readFileSync(CREDENTIALS_PATH));
|
|
20
|
+
const { client_id, client_secret } = creds.installed || creds.web;
|
|
21
|
+
const REDIRECT = "http://localhost:3000/oauth2callback";
|
|
22
|
+
const auth = new google.auth.OAuth2(client_id, client_secret, REDIRECT);
|
|
23
|
+
|
|
24
|
+
const authUrl = auth.generateAuthUrl({
|
|
25
|
+
access_type: "offline",
|
|
26
|
+
scope: SCOPES,
|
|
27
|
+
prompt: "consent",
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const app = express();
|
|
31
|
+
|
|
32
|
+
app.get("/oauth2callback", async (req, res) => {
|
|
33
|
+
try {
|
|
34
|
+
const { tokens } = await auth.getToken(req.query.code);
|
|
35
|
+
fs.writeFileSync(TOKEN_PATH, JSON.stringify(tokens, null, 2));
|
|
36
|
+
res.send("<h1 style='font-family:sans-serif;padding:40px'>✅ YouTube Connected! Close this tab and go back to Terminal.</h1>");
|
|
37
|
+
console.log("\n✅ tokens.json saved! You can close the browser.\n");
|
|
38
|
+
setTimeout(() => process.exit(0), 1500);
|
|
39
|
+
} catch (e) {
|
|
40
|
+
res.send("Error: " + e.message);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const server = app.listen(3000, () => {
|
|
46
|
+
console.log("\n🔐 Opening browser... Log in with aditya@posimyth.com\n");
|
|
47
|
+
open(authUrl);
|
|
48
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "youtube-channel-mcp",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "MCP server for YouTube — analytics, video metadata, SEO updates. Read your private channel data and update titles/descriptions/tags directly from Claude. OAuth2, 10 tools, works with Claude Desktop + Claude Code.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"youtube-studio-mcp": "server.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "server.js",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "node server.js",
|
|
12
|
+
"auth": "node auth.js"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"mcp",
|
|
16
|
+
"model-context-protocol",
|
|
17
|
+
"youtube",
|
|
18
|
+
"youtube-api",
|
|
19
|
+
"youtube-analytics",
|
|
20
|
+
"youtube-seo",
|
|
21
|
+
"claude",
|
|
22
|
+
"claude-desktop",
|
|
23
|
+
"claude-code",
|
|
24
|
+
"anthropic",
|
|
25
|
+
"ai-tools",
|
|
26
|
+
"video-metadata",
|
|
27
|
+
"oauth2",
|
|
28
|
+
"youtube-data-api"
|
|
29
|
+
],
|
|
30
|
+
"author": "Aditya Sharma <hey@adityaarsharma.com> (https://adityaarsharma.com)",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/adityaarsharma/youtube-mcp-server.git"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/adityaarsharma/youtube-mcp-server/issues"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/adityaarsharma/youtube-mcp-server#readme",
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=18.0.0"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"server.js",
|
|
45
|
+
"auth.js",
|
|
46
|
+
"skills/",
|
|
47
|
+
"LICENSE",
|
|
48
|
+
"README.md"
|
|
49
|
+
],
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
52
|
+
"googleapis": "^140.0.0",
|
|
53
|
+
"open": "^10.1.0",
|
|
54
|
+
"express": "^4.18.0"
|
|
55
|
+
}
|
|
56
|
+
}
|