Skip to main content

MCP-powered YouTube Shorts discovery tool for finding viral videos using VPH and engagement analysis

Project description

YouTube Shorts Viral Agent

License: MIT Python 3.11+

MCP-powered YouTube Shorts discovery tool for finding viral videos using natural language in Claude Desktop

Features

  • ๐Ÿ”ฅ Discover trending Shorts
  • ๐Ÿ“Š Analyze viral potential
  • ๐ŸŽฏ Track trending topics
  • ๐Ÿ” Find niche trends
  • ๐Ÿ“ Summarize video stories

Tech Stack: YouTube Data API v3 โ€ข VPH (Views Per Hour) โ€ข Engagement Rate โ€ข MCP Protocol


Quick Start

Prerequisites

  • Python 3.11+ (optional, uvx auto-manages)
  • YouTube Data API Key
  • Claude Desktop or MCP client

1. Get YouTube API Key

  1. Visit Google Cloud Console
  2. Create a new project
  3. Enable YouTube Data API v3
  4. Create API Key
  5. (Recommended) Restrict key to YouTube Data API v3 only

2. Configure Claude Desktop

Edit Claude Desktop config:

Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Add:

{
  "mcpServers": {
    "youtube-shorts-viral": {
      "command": "uvx",
      "args": ["--from", "youtube-shorts-viral-agent", "shorts-server"],
      "env": {
        "YOUTUBE_API_KEY": "your-api-key-here"
      }
    }
  }
}

Note:

  • Replace your-api-key-here with your actual API key
  • uvx auto-downloads from PyPI
  • No manual installation needed

3. Start Using

  1. Restart Claude Desktop completely
  2. Use natural language:
Find trending AI Shorts from the last 24 hours

Usage Examples

Example 1: Discover Trends

Show me viral AI Shorts from the last 24 hours

Returns Markdown table with:

  • Title, Channel, Views, VPH, Engagement Rate, Viral Score, Age

Example 2: Analyze Video

Analyze this video's potential: https://www.youtube.com/shorts/abc123

Example 3: Find Topics

What's trending in tech category?

Example 4: Custom Parameters

Find programming Shorts from last 12 hours with 500k+ views

Claude auto-extracts:

  • Keyword: "programming"
  • Time range: 12 hours
  • Min views: 500,000

Available Tools

1. get_youtube_shorts_trends

Discover trending YouTube Shorts.

Parameters:

  • keyword (string): Search keyword, empty for global trends
  • hours_ago (int): Time range in hours, default 24
  • max_results (int): Result count, default 10
  • min_views (int): Min view threshold, default 100,000

2. analyze_video_potential

Deep analysis of a single video.

Parameters:

  • video_url (string): YouTube Shorts URL

3. get_trending_topics

Find trending topics.

Parameters:

  • category (string): tech/entertainment/education/gaming/all
  • hours_ago (int): Time range, default 24

4. summarize_video_story

Extract video story and core content.

Parameters:

  • video_url (string): YouTube Shorts URL

5. discover_niche_trends

Find niche viral trends within a topic.

Parameters:

  • main_topic (string): Main keyword (e.g., "AI", "tutorial")
  • hours_ago (int): Time range, default 24
  • min_videos (int): Min videos per niche, default 3
  • top_niches (int): Top N niches to return, default 10

Core Metrics

VPH (Views Per Hour)

  • Formula: Total Views รท Hours Since Published
  • Meaning: Growth velocity
  • Thresholds:
    • โ‰ฅ 10,000: ๐Ÿ”ฅ Super viral
    • โ‰ฅ 5,000: โญ High potential
    • โ‰ฅ 1,000: โœจ Potential

Engagement Rate

  • Formula: (Likes + Comments) รท Views ร— 100
  • Meaning: Content quality
  • Thresholds:
    • 10%: Excellent

    • 5%: Good

    • 2%: Average

Viral Score

  • Formula: VPH ร— Time Weight ร— (1 + Engagement Boost)
  • Meaning: Comprehensive ranking score
  • Features:
    • Newer videos weighted higher
    • High engagement significantly boosts score

API Quota Management

YouTube Data API v3 Quota

  • Default: 10,000 units/day
  • Reset: Daily at Pacific Time midnight

Cost Breakdown

Operation Cost Description
search.list 100 units Search videos
videos.list 1 unit Get video details
channels.list 1 unit Get channel info

Best Practices

  • Keep max_results โ‰ค 10 per search
  • Limit to ~50 calls/day
  • Use min_views to filter results
  • Use view count for overall popularity
  • Use VPH for fast-growing new videos

Project Structure

shorts/
โ”œโ”€โ”€ .env.example            # MCP config example
โ”œโ”€โ”€ .gitignore              # Git ignore rules
โ”œโ”€โ”€ LICENSE                 # MIT License
โ”œโ”€โ”€ README.md               # Documentation
โ”œโ”€โ”€ MCP_EXPLAINED.md        # MCP protocol explained
โ”œโ”€โ”€ pyproject.toml          # PyPI config
โ”œโ”€โ”€ uv.lock                 # Dependency lock
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ server.py           # MCP Server (annotated)
โ”‚   โ”œโ”€โ”€ youtube/
โ”‚   โ”‚   โ”œโ”€โ”€ client.py       # YouTube API client
โ”‚   โ”‚   โ””โ”€โ”€ analyzer.py     # Viral analysis
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ””โ”€โ”€ video.py        # Data models
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ””โ”€โ”€ config.py       # Config (env vars)
โ””โ”€โ”€ tests/
    โ””โ”€โ”€ test_youtube.py     # Unit tests

FAQ

Q: "YOUTUBE_API_KEY not set" error

  1. Check claude_desktop_config.json has env.YOUTUBE_API_KEY set
  2. Ensure no extra spaces or quotes in API key
  3. Fully restart Claude Desktop

Q: "API quota exhausted" error

  1. Wait for quota reset (Pacific Time midnight)
  2. Request quota increase in Google Cloud Console
  3. Reduce search frequency or lower max_results

Q: Claude can't find tools

  1. Verify claude_desktop_config.json format is correct
  2. Fully restart Claude Desktop
  3. Check Claude Desktop logs for errors

Q: No search results

  1. Expand time range (e.g., 12h โ†’ 24h)
  2. Use broader keywords
  3. Lower min_views threshold

Tech Stack

  • Python: 3.11+
  • MCP: FastMCP 2.13.1+
  • API: google-api-python-client 2.187.0+
  • Validation: Pydantic 2.12.4+

License

MIT License - see LICENSE


Links


Start discovering viral videos with natural language! ๐Ÿš€

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

youtube_shorts_viral_agent-0.2.2.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

youtube_shorts_viral_agent-0.2.2-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file youtube_shorts_viral_agent-0.2.2.tar.gz.

File metadata

File hashes

Hashes for youtube_shorts_viral_agent-0.2.2.tar.gz
Algorithm Hash digest
SHA256 ee5619b289c0640a55c1902dffeaf019c513ae70d60a97c3310d873d33711002
MD5 cd44105246b9061f558e6c2a7a93b944
BLAKE2b-256 d70a4ad7ac135719f41f82699f03d44a29095c24a7104468bc81601615fd39fb

See more details on using hashes here.

File details

Details for the file youtube_shorts_viral_agent-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for youtube_shorts_viral_agent-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 73367f166c6ba93b235858da059e4769db78cd7d5ceca3f698bc6f5792fb0cdc
MD5 dd7197f1f6b95ca9cb05c7bbf91204e6
BLAKE2b-256 40609a992d918d3bb9d46c0af646650e93bf9541aab55b3390e5ddc2e76cd4e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page