A Model Context Protocol (MCP) server for querying and analyzing YouTube channel performance data.
Project description
mcp-youtube-analytics
An MCP server for retrieving channel analytics through the YouTube Analytics API.
Available MCP Tools
| Tool | Description |
|---|---|
channel_overview |
Overall channel KPIs: views, watch time, subscriber delta, and engagement |
top_videos |
Top-performing videos by views, including title, thumbnail, and other metadata |
daily_trends |
Daily trend data for spotting peaks and drawing charts |
traffic_sources |
Traffic source breakdown: search, suggested videos, external links, and more |
top_countries |
Top audience countries |
top_subscriber_sources |
Videos that drove the most subscribers |
video_retention |
Audience retention curve for a specific video |
playlist_performance |
Traffic and watch performance by playlist |
All tools support custom start_date and end_date values in YYYY-MM-DD format. The default range is the last 30 days.
Setup
1. Create a Google Cloud project
- Go to Google Cloud Console
- Create a new project or select an existing one
- Under APIs & Services → Library, enable these APIs:
- YouTube Analytics API
- YouTube Data API v3
2. Configure the OAuth consent screen
- Go to APIs & Services → OAuth consent screen
- Choose External as the user type
- Fill in the basic app information and save
- Add your Google account under Test users so you can authorize the app before publishing
3. Create an OAuth client ID
- Go to APIs & Services → Credentials
- Click Create Credentials → OAuth client ID
- Choose Desktop app as the application type
- Download the generated JSON file
- Rename it to
client_secrets.jsonand place it in the project root
4. Install dependencies and run
uv sync
uv run mcp-youtube-analytics
On first run, the app opens a browser window for Google authorization. After authorization succeeds, token.json is stored in the project root and reused on later runs.
Development Testing
Use the built-in CLI tester to exercise each API function individually. All results are printed as JSON.
# Show all available commands
uv run mcp-youtube-analytics-debug --help
# Get the channel ID
uv run mcp-youtube-analytics-debug channel-id
# Overall channel performance for the default last-30-days window
uv run mcp-youtube-analytics-debug channel-overview
# Custom date range
uv run mcp-youtube-analytics-debug channel-overview --start-date 2026-01-01 --end-date 2026-01-31
# Top 5 videos by views
uv run mcp-youtube-analytics-debug top-videos --max-results 5
# Daily trend data
uv run mcp-youtube-analytics-debug daily-trends
# Traffic source breakdown
uv run mcp-youtube-analytics-debug traffic-sources
# Top audience countries
uv run mcp-youtube-analytics-debug top-countries --max-results 10
# Videos that drove the most subscribers
uv run mcp-youtube-analytics-debug top-subscriber-sources
# Retention curve for a specific video
uv run mcp-youtube-analytics-debug video-retention --video-id <VIDEO_ID>
# Playlist performance
uv run mcp-youtube-analytics-debug playlist-performance
# Fetch metadata for multiple videos
uv run mcp-youtube-analytics-debug video-metadata --ids <ID1>,<ID2>
Notes
client_secrets.jsonandtoken.jsonare already listed in.gitignore; do not commit them.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_youtube_analytics-0.1.0.tar.gz.
File metadata
- Download URL: mcp_youtube_analytics-0.1.0.tar.gz
- Upload date:
- Size: 57.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de996211ff37667071b47fa723aad88bd9d99b9ed3b130a8708c08a156adc0fa
|
|
| MD5 |
9536e76a550dd0c7cdd173406e96404b
|
|
| BLAKE2b-256 |
3843392485ff9381770ebfb2933f1ffe39cd80f65c6577c5df2590e75fca6668
|
Provenance
The following attestation bundles were made for mcp_youtube_analytics-0.1.0.tar.gz:
Publisher:
publish.yml on asgard-ai-platform/mcp-youtube-analytics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_youtube_analytics-0.1.0.tar.gz -
Subject digest:
de996211ff37667071b47fa723aad88bd9d99b9ed3b130a8708c08a156adc0fa - Sigstore transparency entry: 1437537398
- Sigstore integration time:
-
Permalink:
asgard-ai-platform/mcp-youtube-analytics@d4f33fde4ecef05227638d53d7519af01a5e4ea3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/asgard-ai-platform
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d4f33fde4ecef05227638d53d7519af01a5e4ea3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_youtube_analytics-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_youtube_analytics-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e91d9de3f62a3b90d78f0ded023907778472e08ed6e8720621f3efcbcadb3460
|
|
| MD5 |
3f7c062bf50f73a6cf19d890da913512
|
|
| BLAKE2b-256 |
098da67c0845c5595c53b243c4d9af37cbf9c652e76491867d33c8bb767ac9cc
|
Provenance
The following attestation bundles were made for mcp_youtube_analytics-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on asgard-ai-platform/mcp-youtube-analytics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_youtube_analytics-0.1.0-py3-none-any.whl -
Subject digest:
e91d9de3f62a3b90d78f0ded023907778472e08ed6e8720621f3efcbcadb3460 - Sigstore transparency entry: 1437537401
- Sigstore integration time:
-
Permalink:
asgard-ai-platform/mcp-youtube-analytics@d4f33fde4ecef05227638d53d7519af01a5e4ea3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/asgard-ai-platform
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d4f33fde4ecef05227638d53d7519af01a5e4ea3 -
Trigger Event:
push
-
Statement type: