Skip to main content
Glama
SulavKharel

YouTube MCP Server

by SulavKharel
README.md
# YouTube MCP Server 🎬

A local MCP (Model Context Protocol) server that connects Claude to your YouTube channel. Analyze videos, track performance, read comments, and get AI-powered niche suggestions — all inside Claude.

---

## Features

| Tool | What it does |
|------|-------------|
| `get_channel_info` | Subscribers, total views, video count, keywords |
| `list_videos` | Recent videos with views, likes, comments, duration |
| `get_video_details` | Deep stats + engagement rate for one video |
| `get_top_comments` | Audience sentiment from top comments |
| `search_channel_videos` | Find videos on your channel by keyword |
| `analyze_channel_performance` | Avg views, top/bottom performers, tag analysis |

---

## Setup

### 1. Get a YouTube Data API Key

1. Go to [Google Cloud Console](https://console.cloud.google.com)
2. Create a new project (or use an existing one)
3. Go to **APIs & Services → Library** → search **YouTube Data API v3** → Enable it
4. Go to **APIs & Services → Credentials → Create Credentials → API Key**
5. Copy the key

### 2. Find Your Channel ID

- Go to your YouTube channel
- The URL will be: `https://www.youtube.com/channel/UCxxxxxxxxxxxxxxxx`
- The part after `/channel/` is your Channel ID
- **Or:** Go to [https://www.youtube.com/account_advanced](https://www.youtube.com/account_advanced) to find it directly

### 3. Configure the Server

```bash
# In the youtube-mcp folder:
cp .env.example .env
```

Edit `.env` and fill in:
```
YOUTUBE_API_KEY=AIzaSy...your key here...
YOUTUBE_CHANNEL_ID=UCxxxxxxxxxxxxxxxx
```

### 4. Build the Server

```bash
npm install
npm run build
```

---

## Connect to Claude.ai

1. Open **Claude.ai** → click your profile icon → **Settings**
2. Go to **Integrations** (or **MCP Servers**)
3. Click **Add MCP Server**
4. Fill in:
   - **Name:** `YouTube Channel`
   - **Type:** `stdio`
   - **Command:** `node`
   - **Args:** `/full/path/to/youtube-mcp/dist/index.js`
   - **Env:** Add `YOUTUBE_API_KEY` and `YOUTUBE_CHANNEL_ID` from your `.env`

### Alternative: claude_desktop_config.json

If you're using the Claude Desktop app, add this to your config file:

**Mac:** `~/Library/Application Support/Claude/claude_desktop_config.json`  
**Windows:** `%APPDATA%\Claude\claude_desktop_config.json`

```json
{
  "mcpServers": {
    "youtube": {
      "command": "node",
      "args": ["/full/path/to/youtube-mcp/dist/index.js"],
      "env": {
        "YOUTUBE_API_KEY": "your_api_key_here",
        "YOUTUBE_CHANNEL_ID": "your_channel_id_here"
      }
    }
  }
}
```

Restart Claude after saving.

---

## Usage Examples

Once connected, just ask Claude naturally:

> "Show me my channel stats"

> "List my last 20 videos sorted by views"

> "Analyze my channel performance and suggest what niches are working"

> "Get the top comments from video ID dQw4w9WgXcQ"

> "Search my channel for videos about cooking"

---

## Free Tier Limits

The YouTube Data API v3 gives you **10,000 units/day** for free.  
Approximate costs:
- `list_videos` (20 videos) ≈ 102 units
- `get_video_details` ≈ 3 units
- `analyze_channel_performance` ≈ 102 units
- `get_top_comments` ≈ 3 units

You can easily do dozens of analyses per day within the free quota.