YouTube Connector + MCP
Connects one or many YouTube channels via OAuth and provides tools for uploading videos (including resumable uploads), listing and paginating videos, editing video metadata, deleting videos, and managing playlists across multiple accounts.
Click on "Deploy 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 Connector + MCPupload ./trailer.mp4 to my YouTube channel with title 'Launch Trailer'"
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 Connector + MCP
A local Node.js app that connects one or many YouTube channels through Google OAuth 2.0, shows you the resulting tokens (copy / paste between machines), and lets you upload and manage videos — from the browser UI, from a REST API, or from any AI agent over a Streamable HTTP MCP endpoint that needs nothing installed on the client.

┌────────────┐ 1. Connect ┌───────────────┐ 2. login + consent ┌──────────────┐
│ Browser │ ─────────────────► │ App :3000 │ ───────────────────► │ Google │
│ localhost │ │ /auth/start │ │ OAuth 2.0 │
│ │ ◄───────────────── │ /oauth2cb │ ◄─────────────────── │ consent │
└────────────┘ 4. token di UI └───────────────┘ 3. ?code= (redirect)└──────────────┘
│ │
│ ├─► data/tokens.json (one entry per channel, mode 600)
│ ├─► YouTube Data API v3 (upload & manage)
▼ │
copy / paste token ◄──────────► AI agent ──► POST /mcp (MCP Streamable HTTP, 14 tools)Daftar isi
Related MCP server: vunm-youtube-mcp
1. Fitur
Fitur | Keterangan |
OAuth 2.0 lokal | Consent Google → callback |
Token tampil di UI | Access token + refresh token, ter-mask dengan tombol Reveal / Copy, plus expiry dan scope. |
Multiple account | Setiap consent menambah satu channel. Ada dropdown account aktif di topbar; semua endpoint & tool menerima pemilih account. |
Import / export token | Copy JSON token ke mesin lain (local ↔ server), paste, langsung terhubung tanpa OAuth ulang. Bisa 1 account atau semuanya. |
Upload video | Resumable upload streaming dari disk (file besar tidak masuk RAM), title/description/tags/category/privacy, jadwal publish, langsung masuk playlist. |
Manage video | List + pagination, edit (judul, deskripsi, tags, kategori, privacy), hapus, playlist (list/buat/tambah video). |
REST API | Semua operasi tersedia sebagai HTTP JSON, dengan pemilih account lewat |
MCP Streamable HTTP |
|
UI | Satu halaman, light + dark mode otomatis, tanpa build step. |
Token & account | Copy / paste | Manage video |
|
|
|

2. Kebutuhan
Hal | Keterangan |
Node.js | >= 20 (dites di v22) |
Akun Google | yang punya channel YouTube |
Google Cloud project | gratis, untuk OAuth Client ID |
Port lokal | default |
3. Setup Google Cloud Console
Sekali saja per project.
3.1 Buat project
https://console.cloud.google.com/ → dropdown project → New Project → beri nama → Create.
3.2 Aktifkan YouTube Data API v3
APIs & Services → Library → cari YouTube Data API v3 → Enable.
Tanpa ini semua request gagal 403 accessNotConfigured.
3.3 OAuth consent screen / Google Auth Platform
APIs & Services → OAuth consent screen (di console baru: Google Auth Platform)
External → Create, isi app name + support email + developer contact.
Data access → Add or remove scopes → tambahkan
https://www.googleapis.com/auth/youtube→ Update → Save.Kalau app masih Testing: Audience → Test users → tambahkan email Google yang akan connect.
Testing vs Production
Testing: hanya Test users yang bisa connect (maks 100), dan refresh token kedaluwarsa 7 hari → connect ulang tiap minggu.
In production (belum diverifikasi): refresh token tidak kedaluwarsa, tetapi consent menampilkan layar “Google hasn't verified this app” → Advanced → Go to … (unsafe) → Continue. Batas tetap 100 login sensitif seumur project.
3.4 Buat OAuth Client ID
APIs & Services → Credentials → Create credentials → OAuth client ID
Application type: Web application
Name:
youtube-connector-local(bebas)Authorized redirect URIs → Add URI:
http://localhost:3000/oauth2callbackHarus persis sama dengan
GOOGLE_REDIRECT_URI(skema, host, port, path, tanpa trailing slash).Create → copy Client ID dan Client secret.
Contoh hasilnya:
Client ID YOUR_CLIENT_ID.apps.googleusercontent.com
Client secret YOUR_CLIENT_SECRET4. Install & konfigurasi
git clone https://github.com/robzlabz/youtube_connector_with_mcp.git
cd youtube_connector_with_mcp
npm install
cp .env.example .envIsi .env:
GOOGLE_CLIENT_ID=YOUR_CLIENT_ID.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=YOUR_CLIENT_SECRET
PORT=3000Variabel | Wajib | Default | Keterangan |
| ya | — | dari langkah 3.4 |
| ya | — | dari langkah 3.4 |
| tidak |
| port lokal app + MCP |
| tidak |
| override kalau beda host/port |
| tidak |
| pisahkan spasi/koma kalau perlu scope tambahan |
| tidak |
| batas ukuran file upload (MB) |
| tidak |
| interface bind |
| tidak |
| lokasi token store (berguna untuk testing) |
5. Menjalankan aplikasi
npm start # atau: npm run dev (auto-reload)YouTube connector running at http://localhost:3000
MCP (Streamable HTTP): http://localhost:3000/mcp
Redirect URI (must match Google Cloud Console): http://localhost:3000/oauth2callbackBuka http://localhost:3000. Kalau .env belum lengkap, halaman menampilkan banner merah berisi variabel yang kurang dan tombol Connect dinonaktifkan.
6. Alur connect sampai dapat token
Klik Connect to YouTube →
GET /auth/start→https://accounts.google.com/o/oauth2/v2/auth?...(access_type=offline,prompt=consent,scope=.../auth/youtube,state=<acak>).Login, pilih channel (akun pribadi atau brand account), setujui “Manage your YouTube account”.
Google redirect ke
http://localhost:3000/oauth2callback?code=...&state=....Server memverifikasi
state(sekali pakai, 10 menit), menukarcodeke token, memanggil YouTube untuk memastikan token benar dan membaca identitas channel, lalu menyimpan semuanya kedata/tokens.json.Redirect ke
/?connected=1— token tampil di UI.
Contoh isi data/tokens.json:
{
"version": 2,
"activeAccountId": "6e88e76d-c488-f3cd-5215-b52c54db3916",
"accounts": [
{
"id": "6e88e76d-c488-f3cd-5215-b52c54db3916",
"channelId": "UCyFRZZdPCDMdDkeuwuy2JxA",
"channelTitle": "Robbyn Rahmandaru",
"access_token": "ya29.EXAMPLE_ACCESS_TOKEN",
"refresh_token": "1//EXAMPLE_REFRESH_TOKEN",
"token_type": "Bearer",
"scope": "https://www.googleapis.com/auth/youtube",
"expiry_date": 1793497821894
}
]
}7. Multiple YouTube account
Connect sebanyak yang kamu mau:
+ Add account di topbar (atau tombol Connect another YouTube account) menjalankan consent lagi; channel yang dipilih ditambahkan sebagai account baru dan langsung jadi aktif.
Dropdown di topbar berisi semua account; memilih satu akan mengaktifkannya (
POST /api/accounts/:id/activate) dan me-reload video + playlist.Setiap endpoint/tool menerima pemilih account:
?account=, headerX-YouTube-Account, atau argumenaccountdi MCP. Nilainya boleh id account, channel id (UC...), atau judul channel.Tanpa pemilih, yang dipakai adalah account aktif.
Import token yang channel-nya sudah ada meng-update entri itu, bukan menduplikasi (dicocokkan lewat
channelId).Disconnect this account me-revoke satu account saja di Google dan menghapusnya dari store; account lain tidak tersentuh.
Contoh:
curl -s localhost:3000/api/accounts | jq
curl -s "localhost:3000/api/videos?account=UCyFRZZdPCDMdDkeuwuy2JxA" | jq '.items[0]'
curl -s -X POST localhost:3000/api/accounts/<id>/activate | jq '.activeAccountId'8. Copy / paste token antar mesin
Kartu Import / export token memindahkan koneksi tanpa OAuth ulang — misal connect di laptop, lalu pakai di server.
Copy out
Tombol | Isi |
Copy this account | JSON satu account (id, channel, |
Copy all accounts | seluruh store ( |
JSON juga muncul di textarea Export dan otomatis ter-select, jadi tetap bisa di-copy manual kalau clipboard diblokir browser.
Paste in
Tempel JSON (satu account atau seluruh store) → Import token. Format yang diterima:
{"channelId":"UC...","access_token":"ya29...","refresh_token":"1//...","expiry_date":1793497821894}{"version":2,"activeAccountId":"...","accounts":[{ "...": "..." }]}{"access_token":"ya29...","refresh_token":"1//..."} ← minimalSetelah paste, server memverifikasi token ke YouTube dulu (dan mencoba refresh sekali). Kalau ditolak, tidak ada yang disimpan dan account lama tetap aktif. Token tanpa refresh_token diterima tapi akan mati ~1 jam kemudian — export selalu menyertakan refresh token.
Lewat API:
curl -s -X POST localhost:3000/api/accounts/import \
-H 'Content-Type: application/json' \
-d '{"token":"<paste JSON>","activate":true}' | jq
curl -s localhost:3000/api/export | jq # semua account, siap pasteSimpan JSON ini seperti password: siapa pun yang memegangnya bisa mengelola channel sampai token di-revoke.
9. Upload & manage video
Kartu | Fungsi |
Upload video | pilih file → title/description/tags/privacy/category → opsional jadwal publish & playlist → progress bar → video masuk sebagai |
Your videos | daftar video terbaru (thumbnail, privacy, views, durasi), Edit (judul, deskripsi, tags, privacy, kategori, tambah ke playlist), Delete, Load more |
Playlists | daftar playlist + buat playlist baru (private/unlisted/public) |
Catatan upload:
Resumable upload dengan streaming dari disk (
Readable.toWeb(createReadStream)) — file besar tidak masuk RAM.Default privacy private; ubah ke
unlisted/publicbila perlu.Kalau Schedule publish diisi, YouTube mewajibkan video
privatesaat upload — app mengatur otomatis.File sementara di
data/uploads/selalu dihapus setelah upload (sukses maupun gagal).Kuota: 1 upload = 1.600 unit dari 10.000/hari → praktis ~6 upload/hari per project.
10. REST API reference
Semua endpoint mengembalikan JSON. Error berbentuk { "error": { "message": "...", "code": "..." } }.
Pemilih account: ?account=<id|UC...|judul>, header X-YouTube-Account, atau body account.
Method | Path | Fungsi |
GET |
| liveness |
GET |
| status konfigurasi + redirect URI + scopes |
GET |
| konfigurasi, connected, daftar account, token aktif, info channel |
GET |
| URL consent Google (JSON) — untuk automation |
GET |
| redirect ke Google consent |
GET |
| callback OAuth (dipakai Google) |
GET |
| daftar account + |
POST |
| import token ( |
POST |
| jadikan account aktif |
DELETE |
| revoke + hapus satu account |
GET |
| JSON paste-ready satu account |
GET |
| JSON paste-ready semua account |
GET |
| access token valid (auto-refresh) |
POST |
| paksa refresh access token |
POST |
| revoke + hapus account yang dipilih |
GET |
| daftar video channel |
GET |
| detail satu video |
PATCH |
| update |
DELETE |
| hapus video |
GET |
| daftar playlist |
POST |
| buat playlist ( |
POST |
| tambah video ke playlist ( |
POST |
| multipart upload ( |
POST |
| MCP Streamable HTTP (lihat bagian 11) |
# status + token
curl -s localhost:3000/api/status | jq
curl -s localhost:3000/api/token | jq -r .accessToken
# 5 video terbaru
curl -s "localhost:3000/api/videos?maxResults=5" | jq '.items[] | {id, title, privacyStatus}'
# ubah privacy
curl -s -X PATCH localhost:3000/api/videos/VIDEO_ID \
-H 'Content-Type: application/json' -d '{"privacyStatus":"unlisted"}' | jq
# upload
curl -s -X POST localhost:3000/api/upload \
-F video=@/path/video.mp4 -F title='Video uji' -F privacyStatus=private | jq
# upload ke account tertentu
curl -s -X POST "localhost:3000/api/upload?account=UC..." \
-F video=@/path/video.mp4 -F title='Video uji' | jq11. MCP server (Streamable HTTP)
Proses yang sama juga menjadi MCP server, jadi AI (omp, [CC], Cursor, dll.) bisa memakai channel kamu tanpa menulis kode. Transportnya Streamable HTTP: tidak ada yang perlu di-install di sisi client, cukup satu URL.
http://localhost:3000/mcpHidup selama
npm startberjalan (port sama dengan UI, ikutPORT).Stateless — tanpa
Mcp-Session-Id; setiapPOSTberdiri sendiri dan boleh paralel.Respons JSON (
enableJsonResponse), tetap kompatibel dengan client yang mintatext/event-stream.Server mengirim
instructionssaatinitialize: urutan pemakaian, cara memilih account, dan fakta penting (quota, path lokal, delete permanen).
11.1 Daftarkan di client
omp — ~/.omp/agent/mcp.json:
{
"mcpServers": {
"youtube": { "type": "http", "url": "http://localhost:3000/mcp" }
}
}[CC]:
claude mcp add --transport http youtube http://localhost:3000/mcpCursor (.cursor/mcp.json):
{
"mcpServers": {
"youtube": { "url": "http://localhost:3000/mcp" }
}
}Client yang hanya mendukung stdio (Claude Desktop) — bungkus dengan bridge:
{
"mcpServers": {
"youtube": {
"command": "npx",
"args": ["-y", "mcp-remote", "http://localhost:3000/mcp"]
}
}
}11.2 Tools (14)
Tool | Argumen | Fungsi |
|
| config, daftar account, account aktif, info channel, expiry token. Panggil pertama. |
|
| daftar account / ganti account aktif |
| — | URL consent sekali pakai (10 menit) untuk menambah account |
|
| import token hasil paste (single / whole store / raw string) |
|
| JSON paste-ready satu account atau semua |
|
| access token valid + contoh |
|
| daftar video terbaru |
|
| detail satu video |
|
| ubah metadata |
|
| upload resumable dari file lokal |
|
| hapus permanen |
|
| daftar playlist |
|
| buat playlist |
|
| masukkan video ke playlist |
Semua tool mengembalikan JSON di content[0].text; kegagalan datang sebagai isError: true dengan pesan yang bisa langsung ditindak AI, mis. Error: File not found: /tmp/nope.mp4 atau Error: Unknown account "x". Known accounts: ….
11.3 Contoh prompt
“Cek channel YouTube saya, tampilkan 5 video terakhir.”
“Ada berapa account yang terhubung? Pindah ke channel RobzLabz Blog.”
“Upload
/Users/robbyn/Movies/demo.mp4sebagaiprivate, judul ‘Demo MCP’, masukkan ke playlist SEO.”“Video terbaru yang judulnya ChatGPT, ubah privacy-nya jadi
unlisteddi account kedua.”“Export token account aktif supaya bisa saya pakai di server.”
“Kasih access token-nya, saya mau panggil YouTube API langsung.”
11.4 Uji manual (tanpa client)
# daftar tool
curl -s -X POST http://localhost:3000/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | jq '.result.tools[].name'
# panggil satu tool
curl -s -X POST http://localhost:3000/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"youtube_status","arguments":{}}}' \
| jq -r '.result.content[0].text' | jqGET /mcp dan DELETE /mcp mengembalikan 405 — endpoint ini stateless, tidak ada stream yang perlu dibuka atau sesi yang perlu diakhiri.
11.5 Keamanan
Endpoint ikut bind ke
HOST(default127.0.0.1) — hanya lokal.Request dengan header
Originselainlocalhost/127.0.0.1ditolak403(anti DNS-rebinding).Siapa pun yang bisa
POST /mcpdapat memakai token channel, termasuk lewatyoutube_get_token. Jangan setHOST=0.0.0.0atau membuka port ini ke internet tanpa auth.
12. Siklus hidup token
Kejadian | Yang dilakukan app |
Connect / import | simpan |
Access token < 2 menit lagi habis | otomatis refresh sebelum request berikutnya |
Refresh sukses |
|
Refresh gagal | UI menampilkan banner; refresh token atau import ulang |
Disconnect this account | token di-revoke di |
App mode Testing | refresh token kedaluwarsa 7 hari → connect ulang |
13. Troubleshooting
Gejala | Penyebab & solusi |
| Redirect URI di Google Console ≠ |
| YouTube Data API v3 belum di-Enable. |
| Email belum terdaftar di Test users (mode Testing). |
Banner “Missing GOOGLE_CLIENT_ID…” |
|
| Refresh token mode Testing kedaluwarsa → connect ulang atau Publish app. |
| Google menggabungkan grant lama karena |
Layar “Google hasn't verified this app” | App In production tapi scope sensitif belum diverifikasi → Advanced → Go to … (unsafe) → Continue. |
Import ditolak | Token salah/kedaluwarsa/berbeda OAuth client. Export ulang dengan refresh token. |
Import sukses tapi mati setelah ~1 jam | Token yang dipaste hanya |
| Kuota harian habis (10.000 unit; 1 upload = 1.600). Tunggu reset atau minta quota tambahan. |
Upload gagal | File > |
Video tampil tapi tidak bisa diputar | YouTube masih memproses ( |
Account muncul tanpa nama | Token di-import tanpa bisa diverifikasi saat itu; klik Refresh token atau buka |
Port 3000 dipakai | Ganti |
14. Keamanan & catatan
.env,data/tokens.json, dandata/uploads/*sudah masuk.gitignore. Jangan commit.data/tokens.jsonditulis dengan mode600(hanya user kamu).App bind ke
127.0.0.1secara default — jangan expose ke internet: siapa pun yang membuka UI atauPOST /mcpbisa memakai token kamu.Token di UI ter-mask; Reveal menampilkan penuh, Copy menyalin ke clipboard. Export JSON menampilkan token penuh (memang untuk dipindah mesin).
OAuth
stateacak, sekali pakai, kedaluwarsa 10 menit → mencegah CSRF pada callback.Scope
https://www.googleapis.com/auth/youtube= akses penuh channel. Kalau hanya butuh upload, gantiGOOGLE_SCOPESkehttps://www.googleapis.com/auth/youtube.upload(endpoint manage akan gagal).Token bocor? Disconnect this account (revoke) atau cabut manual di https://myaccount.google.com/permissions.
15. Struktur project
youtube_connector_with_mcp/
├── .env.example # template kredensial
├── package.json
├── server.js # Express: OAuth, accounts, REST, upload, mount /mcp
├── src/
│ ├── config.js # baca env, path, default
│ ├── store.js # multi-account token store (data/tokens.json, mode 600)
│ ├── google.js # OAuth: consent URL, state, exchange, refresh, revoke
│ ├── accounts.js # resolve account, import/export token, view
│ ├── youtube.js # YouTube Data API v3 client per account
│ └── mcp.js # MCP Streamable HTTP server (14 tool + instructions)
├── public/
│ ├── index.html # UI: connect, token, transfer, upload, manage
│ ├── app.js # logic UI
│ └── styles.css # styling (light/dark otomatis)
├── docs/screenshots/ # screenshot untuk README
└── data/
├── tokens.json # dibuat saat connect (mode 600, di-ignore git)
└── uploads/ # file sementara upload (selalu dibersihkan)Lisensi
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
YouTube transcripts, search, channel/playlist listings and upload tracking for AI agents.
Hosted video editing for AI agents: cut, caption, mix and export real video. Sign in with OAuth.
OAuth 2.1 short-link tools for AI agents with scoped tokens, approvals, audit logs, and revocation.
The YouTube autopilot: plan, write and schedule YouTube videos, and upload from your machine.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to manage YouTube channels directly, including video publishing, SEO optimization, playlist curation, community interaction, and traffic analytics, all through local OAuth.2MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to interact with YouTube channels, providing analytics, video metadata updates, transcript extraction, and comment management through official Google APIs with OAuth 2.0.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI clients to pull full transcripts from YouTube videos, search videos and channels, browse a channel's complete upload history, search within a single channel, and extract every video in a playlist through one hosted remote endpoint. It supports API-key or OAuth 2.1 sign-in with no local installation, returning metadata and paginated results with stable error codes.23MIT
- AlicenseAqualityBmaintenanceEnables MCP clients like Claude or Cursor to upload videos from your local machine directly to YouTube, schedule them, and manage channel content through Runsheet.11123 npmMIT


