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.
Metadata
Release files for mcp-youtube-analytics 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mcp_youtube_analytics-0.1.0.tar.gz | 57.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_youtube_analytics-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 67.6 kB
Release files / mcp_youtube_analytics-0.1.0.tar.gz
| Download URL | mcp_youtube_analytics-0.1.0.tar.gz |
|---|---|
| Size | 57.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de996211ff37667071b47fa723aad88bd9d99b9ed3b130a8708c08a156adc0fa
|
|
BLAKE2b-256 checksum How to use checksums |
3843392485ff9381770ebfb2933f1ffe39cd80f65c6577c5df2590e75fca6668
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 4, 2026.
Transparency logRelease files / mcp_youtube_analytics-0.1.0-py3-none-any.whl
| Download URL | mcp_youtube_analytics-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e91d9de3f62a3b90d78f0ded023907778472e08ed6e8720621f3efcbcadb3460
|
|
BLAKE2b-256 checksum How to use checksums |
098da67c0845c5595c53b243c4d9af37cbf9c652e76491867d33c8bb767ac9cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 4, 2026.
Transparency log