Skip to main content
Glama
README.md
# youtube-mcp

YouTube CLI and MCP tool for humans and AI agents. Upload videos, manage comments, search, view analytics, and more — from your terminal or via any MCP-compatible AI agent.

The CLI command is just `yt` — short and sweet.

## Install

```bash
brew install virat-mankali/tap/youtube-mcp
```

## Setup

1. Go to [console.cloud.google.com](https://console.cloud.google.com)
2. Create a project and enable **YouTube Data API v3**
3. Create an **OAuth 2.0 Client ID** (Desktop App type)
4. Copy your Client ID and Client Secret, then run:

```bash
yt auth login --client-id YOUR_ID --client-secret YOUR_SECRET
```

## CLI Usage

```bash
# Auth
yt auth login
yt auth login --manual        # SSH/headless environments
yt auth logout
yt auth status

# Videos
yt videos list
yt videos get <videoId>
yt videos upload ./video.mp4 --title "My Video" --privacy public
yt videos update <videoId> --title "New Title"
yt videos delete <videoId> --yes

# Comments
yt comments list <videoId>
yt comments reply <commentId> "Thanks!"
yt comments post <videoId> "Great video!"
yt comments delete <commentId>

# Search
yt search "typescript tutorials"
yt search "react hooks" --order viewCount --max-results 5

# Analytics
yt analytics channel
yt analytics video <videoId>

# Playlists
yt playlists list
yt playlists create "My Playlist"
yt playlists add <playlistId> <videoId>

# MCP Server
yt serve
```

## MCP Config

Add to your MCP client config (e.g. Claude Desktop, Kiro, Cursor):

```json
{
  "mcpServers": {
    "youtube": {
      "command": "yt",
      "args": ["serve"]
    }
  }
}
```

Or pass credentials via env vars for headless setups:

```json
{
  "mcpServers": {
    "youtube": {
      "command": "yt",
      "args": ["serve"],
      "env": {
        "YOUTUBE_CLIENT_ID": "your_client_id",
        "YOUTUBE_CLIENT_SECRET": "your_client_secret",
        "YOUTUBE_ACCESS_TOKEN": "ya29.xxx",
        "YOUTUBE_REFRESH_TOKEN": "1//xxx"
      }
    }
  }
}
```

## Environment Variables

| Variable | Description |
|----------|-------------|
| `YOUTUBE_CLIENT_ID` | Google OAuth2 Client ID |
| `YOUTUBE_CLIENT_SECRET` | Google OAuth2 Client Secret |
| `YOUTUBE_ACCESS_TOKEN` | Access token (overrides saved token) |
| `YOUTUBE_REFRESH_TOKEN` | Refresh token (overrides saved token) |

## MCP Tools

| Tool | Description |
|------|-------------|
| `list_my_videos` | List your uploaded videos |
| `get_video` | Get video details |
| `upload_video` | Upload a video |
| `update_video` | Update video metadata |
| `delete_video` | Delete a video |
| `list_comments` | List comments on a video |
| `reply_to_comment` | Reply to a comment |
| `post_comment` | Post a new comment |
| `delete_comment` | Delete a comment |
| `search_youtube` | Search YouTube |
| `get_channel_stats` | Get channel statistics |
| `get_video_stats` | Get video statistics |
| `list_playlists` | List your playlists |
| `create_playlist` | Create a playlist |
| `add_to_playlist` | Add a video to a playlist |

## License

MIT