YouTube MCP Server

YouTube MCP Server

Gives AI coding agents full control over a YouTube channel with 22 tools for channel management, videos, playlists, comments, search, analytics, thumbnails, and captions.

Category
访问服务器

README

YouTube MCP Server

A Model Context Protocol (MCP) server that gives AI coding agents full control over a YouTube channel. Works with Claude Code, Cursor, Windsurf, and any MCP-compatible client.

22 tools covering channel management, video operations, playlists, comments, search, analytics, thumbnails, and captions.

What Can It Do?

Category Actions
Channel Get channel info, update description/keywords/trailer
Videos List, get details, upload from local file, update metadata, delete, set thumbnails
Playlists List, create, update, delete, add/remove videos
Comments List comment threads, reply to comments, delete comments
Search Search YouTube for videos, channels, or playlists
Analytics Channel analytics (views, watch time, subs, revenue), top videos
Captions List available captions/subtitles
Categories List assignable video categories by region

Quick Start

1. Get Google API Credentials

  1. Go to the Google Cloud Console
  2. Create a project (or select an existing one)
  3. Enable the YouTube Data API v3 and YouTube Analytics API
  4. Create an OAuth 2.0 Client ID (type: Desktop app)
  5. Note your Client ID and Client Secret

2. Install

git clone https://github.com/mrchevyceleb/youtube-mcp.git
cd youtube-mcp
npm install
npm run build

3. Set Environment Variables

export GOOGLE_CLIENT_ID="your-client-id.apps.googleusercontent.com"
export GOOGLE_CLIENT_SECRET="your-client-secret"

Or create a .env file (it is gitignored):

GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-client-secret

4. Authorize

npm run auth

This opens an interactive prompt:

  1. It gives you a URL to open in your browser
  2. Sign in with the Google account that owns your YouTube channel
  3. Grant permissions
  4. Copy the authorization code from the redirect URL
  5. Paste it back into the terminal

Tokens are saved locally in tokens.json (gitignored). They auto-refresh, so you only need to do this once.

5. Add to Your MCP Client

Claude Code

Add to your Claude Code MCP config (~/.claude.json or project .mcp.json):

{
  "mcpServers": {
    "youtube": {
      "command": "node",
      "args": ["/absolute/path/to/youtube-mcp/dist/index.js"],
      "env": {
        "GOOGLE_CLIENT_ID": "your-client-id",
        "GOOGLE_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}

Cursor

Add to your Cursor MCP settings (.cursor/mcp.json):

{
  "mcpServers": {
    "youtube": {
      "command": "node",
      "args": ["/absolute/path/to/youtube-mcp/dist/index.js"],
      "env": {
        "GOOGLE_CLIENT_ID": "your-client-id",
        "GOOGLE_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}

Usage

Once connected, your AI agent gets a single youtube tool with an action parameter. Examples:

Get your channel info

youtube({ action: "get_channel" })

List your latest videos

youtube({ action: "list_videos", params: { maxResults: 10, orderBy: "date" } })

Update a video's title and tags

youtube({
  action: "update_video",
  params: {
    videoId: "dQw4w9WgXcQ",
    title: "New Title",
    tags: ["tag1", "tag2", "tag3"]
  }
})

Upload a video

youtube({
  action: "upload_video",
  params: {
    filePath: "/path/to/my-video.mp4",
    title: "How I Built This in 24 Hours",
    description: "Full walkthrough of building an app with AI coding agents.",
    tags: ["ai", "coding", "tutorial"],
    categoryId: "28",
    privacyStatus: "unlisted",
    playlistId: "PLxxxxxx"
  }
})

Get analytics for the last 30 days

youtube({
  action: "get_analytics",
  params: {
    startDate: "2026-02-01",
    endDate: "2026-03-01",
    metrics: ["views", "estimatedMinutesWatched", "subscribersGained"]
  }
})

Search YouTube

youtube({
  action: "search_youtube",
  params: { query: "vibe coding", type: "video", maxResults: 5 }
})

Set a custom thumbnail

youtube({
  action: "set_thumbnail",
  params: {
    videoId: "dQw4w9WgXcQ",
    imageBase64: "<base64-encoded-image>",
    mimeType: "image/jpeg"
  }
})

All 22 Actions

Channel

  • get_channel - Get channel info (name, stats, branding)
  • update_channel - Update description, keywords, language, country, trailer

Videos

  • list_videos - List videos from a channel or playlist
  • get_video - Get full video details (stats, tags, status)
  • upload_video - Upload a video from a local file path (resumable, any size)
  • update_video - Update title, description, tags, category, privacy
  • delete_video - Permanently delete a video
  • set_thumbnail - Upload a custom thumbnail (JPEG/PNG/BMP, max 2MB)

Playlists

  • list_playlists - List playlists from a channel
  • create_playlist - Create a new playlist
  • update_playlist - Update playlist title, description, privacy
  • add_to_playlist - Add a video to a playlist
  • remove_from_playlist - Remove a video from a playlist
  • delete_playlist - Permanently delete a playlist

Comments

  • list_comments - List comment threads on a video
  • reply_to_comment - Reply to a comment
  • delete_comment - Delete a comment you own

Search

  • search_youtube - Search for videos, channels, or playlists

Analytics

  • get_analytics - Channel analytics (views, watch time, subs, revenue)
  • get_top_videos - Top-performing videos by any metric

Captions & Categories

  • list_captions - List available captions/subtitles for a video
  • list_categories - List assignable video categories by region

How It Works

This server uses the Model Context Protocol to expose YouTube API operations as tools that AI agents can call. It communicates over stdio, which is the standard transport for local MCP servers.

Under the hood:

  • YouTube Data API v3 for channel, video, playlist, comment, and search operations
  • YouTube Analytics API v2 for analytics and top video queries
  • Google OAuth 2.0 with offline access for automatic token refresh
  • Zod for input validation on every action
  • Router pattern to expose all 21 actions as a single tool (reduces context token overhead)

Requirements

  • Node.js 20+
  • A Google Cloud project with YouTube Data API v3 and YouTube Analytics API enabled
  • OAuth 2.0 credentials (Desktop app type)

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选