Skip to main content
Glama
ujorgeleite

youtube-studio-mcp

by ujorgeleite

youtube-studio-mcp

Local MCP server (stdio) exposing data from your own YouTube channel to Claude Code. OAuth → YouTube Data API v3 + YouTube Analytics API v2 → SQLite cache → MCP tools → stdio.

Tools:

Tool

What it returns

get_channel_overview

subscribers, total views, video count, uploads playlist id

get_channel_metrics

views, minutes watched, avg view duration, subscribers gained/lost/net for a date range

list_videos

every uploaded video (id, title, publish date, ISO-8601 duration)

get_retention_curve

audience retention curve for one video

analyze_pillar_performance

watch time and retention grouped and ranked by content pillar

rank_video_efficiency

videos ranked by efficiency within longos vs shorts (retention, subscribers, comments, likes) — raw metrics + a transparent score for downstream decision-making

⚠️ Phase 1 requires re-consenting once. The Analytics tools need the added yt-analytics.readonly scope, and adding a scope does not widen an existing token. A token minted before Phase 1 is detected as insufficient and the tools ask you to run make auth (or youtube-studio-mcp auth) again to grant the new scope.

List the registered tools without authenticating:

.venv/bin/python -m youtube_studio_mcp.server --self-check

Layout

src/youtube_studio_mcp/
  config.py    paths/settings (env vars), scopes, cache TTLs
  auth.py      OAuth: `login` (CLI, opens browser) / `load_credentials` (server, silent refresh + scope check)
  youtube.py   thin Data API v3 client + response parsing
  analytics.py thin Analytics API v2 client + response parsing
  pillars.py   loads config/pilares.json (videoId -> pillar map)
  cache.py     sqlite3 key/value cache with TTL
  service.py   use cases (clients + cache), no MCP/Google imports
  server.py    MCP tool registration (MCPServer) + --self-check
  __main__.py  entry point: `serve` (default), `auth`, and the CLI commands
config/
  pilares.json hand-maintained videoId -> pillar map
tests/         pytest, no network

To add a tool: API call in youtube.py → use case in service.py@server.tool() in server.py.

Note: mcp 2.x renamed FastMCP to MCPServer (from mcp.server.mcpserver import MCPServer).

Related MCP server: YouTube MCP Server

Setup

make install   # venv + project + dev deps
make test
make           # list all commands (install, test, shell, auth, overview, mcp-add, clean...)

Google OAuth (one time)

📘 Step-by-step guide (credentials, OAuth, Claude Code, troubleshooting): docs/SETUP.md

Summary:

  1. In Google Cloud Console: enable YouTube Data API v3 and YouTube Analytics API.

  2. Configure the OAuth consent screen (add yourself as a test user).

  3. Create an OAuth client ID of type Desktop app and download the JSON to ~/.youtube-studio-mcp/client_secret.json.

  4. Log in (opens the browser): make auth

No API key is used — your own channel's data requires OAuth. The token is stored at ~/.youtube-studio-mcp/token.json and refreshed automatically. The server never opens the browser itself (it would corrupt stdio).

CLI

The same features are available from the terminal (same service and cache as the MCP tools).

Interactive menu with Tab completion — just run it in a terminal:

$ .venv/bin/youtube-studio-mcp
YouTube Studio — 'help' lists commands, Tab completes, 'exit' quits.
yt> help
yt> overview --help
yt> overview --refresh
yt> exit

One-shot commands:

.venv/bin/youtube-studio-mcp --help
.venv/bin/youtube-studio-mcp overview            # JSON, served from cache when fresh
.venv/bin/youtube-studio-mcp overview --refresh  # bypass the cache
.venv/bin/youtube-studio-mcp metrics --start 2026-08-01 --end 2026-08-28
.venv/bin/youtube-studio-mcp videos
.venv/bin/youtube-studio-mcp retention <VIDEO_ID>
.venv/bin/youtube-studio-mcp pillars
.venv/bin/youtube-studio-mcp efficiency

To add a command for a new tool: add a subparser in cli.build_parser, handle it in cli.run_command, and list it in shell.COMMANDS.

Content pillars (config/pilares.json)

analyze_pillar_performance groups your videos by content pillar. You maintain the map by hand — it is the source of truth for videoId -> pillar:

{
  "VIDEO_ID": { "pilar": "imigracao|pedro|holanda|pratico|doceria", "formato": "vlog", "seo": true }
}

Videos not listed here are still counted, under a não classificado bucket, so nothing is silently dropped. Point YTS_PILLARS_FILE elsewhere to use a different file.

Connect to Claude Code

claude mcp add youtube-studio -- "$(pwd)/.venv/bin/youtube-studio-mcp" serve

Configuration

Env var

Default

YTS_DATA_DIR

~/.youtube-studio-mcp

YTS_CLIENT_SECRET

$YTS_DATA_DIR/client_secret.json

YTS_CACHE_TTL

3600 (seconds)

YTS_PILLARS_FILE

config/pilares.json

Available Tools

5 tools
analyze_pillar_performanceA
Read-only

Group each mapped video's watch time and retention by content pillar (config/pilares.json) and rank pillars by minutes watched. Unmapped videos land in a 'não classificado' bucket. Derived from cached metrics.

ParametersJSON Schema
NameRequiredDescriptionDefault
end_dateNo
start_dateNo

TDQS

A3.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The readOnlyHint annotation already establishes safety, and the description adds useful behavioral context: data comes from cached metrics and unmapped videos are placed in a 'não classificado' bucket. This goes beyond the annotation and helps the agent anticipate edge-case grouping behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three focused sentences: the core aggregation and ranking behavior, the unmapped-video edge case, and the data source. There is no filler, and the most important behavior is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the main grouping behavior and the unmapped bucket, but it omits any explanation of the optional date parameters, which are the only inputs. With no output schema and no parameter descriptions, the definition is adequate but leaves meaningful gaps for an agent trying to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description does not compensate by explaining how start_date and end_date affect the aggregation, whether they default to a full range, or what date format is expected. The description adds no meaning to either parameter beyond the bare names.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb ('Group each mapped video's watch time and retention'), a specific resource ('content pillar (config/pilares.json)'), and a specific output behavior ('rank pillars by minutes watched'). It clearly distinguishes itself from broader channel metrics and retention curve siblings by focusing on pillar aggregation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The usage context is clear: use this when you need pillar-level aggregation and ranking rather than channel-wide or per-video metrics. However, it does not explicitly mention when NOT to use it or name alternative sibling tools, so it stops short of full routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_channel_metricsA
Read-only

Channel metrics from the YouTube Analytics API for a date range (default: last 28 days): views, minutes watched, average view duration, subscribers gained/lost and net. Dates are YYYY-MM-DD. Cached per range.

ParametersJSON Schema
NameRequiredDescriptionDefault
refreshNo
end_dateNo
start_dateNo

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already mark the operation read-only, and the description adds useful behavior: default range, date format, and per-range caching. It does not cover rate limits, authentication, or return-shape details, but the read-only annotation lowers the burden.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three compact sentences, front-loaded with the tool's purpose and immediately followed by the metrics and date constraints. Every sentence earns its place and there is no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read-only metrics tool with three optional parameters, the description covers the key call context: metrics returned, default range, date format, and caching. The only notable omission is an explicit explanation of the refresh parameter, but the description still provides enough to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description must carry parameter meaning; it does define date format and default range, and 'Cached per range' hints at caching semantics. It does not explicitly explain the refresh boolean or how start_date/end_date interact, leaving a gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific resource ('Channel metrics from the YouTube Analytics API') and lists the measured fields, making the tool's function clear. It does not explicitly contrast with sibling tools, but the metric list and date-range scope distinguish it from get_channel_overview and list_videos.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives clear context: metrics are for a date range, defaulting to the last 28 days, with dates formatted YYYY-MM-DD and results cached per range. It does not explicitly state when to prefer another sibling tool, but the intended use case is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_channel_overviewA
Read-only

Basic stats of the authenticated owner's YouTube channel: subscribers, total views, video count and uploads playlist id. Cached locally; pass refresh=true to bypass the cache.

ParametersJSON Schema
NameRequiredDescriptionDefault
refreshNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
titleYes
channel_idYes
view_countYes
video_countYes
subscriber_countYes
uploads_playlist_idYes

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The readOnlyHint annotation already signals safety, and the description adds useful behavioral context by disclosing that results are cached locally and that refresh=true bypasses the cache. There is no contradiction with the annotation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two tight sentences. The first front-loads what the tool returns and for whom; the second clarifies the only parameter behavior that matters. No unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read-only tool with one optional parameter and an output schema, the description covers all essentials: scope, returned fields, and caching behavior. Return-value details are already covered by the output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema provides only a bare boolean with a default and no description, so the description carries full responsibility for explaining refresh. It does so explicitly: 'pass refresh=true to bypass the cache.'

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb-resource pair: it gets basic stats of the authenticated owner's YouTube channel, and enumerates the exact fields returned (subscribers, total views, video count, uploads playlist id). However, it does not explicitly contrast this with the sibling get_channel_metrics, so some differentiation is left implicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given for when to choose this tool over get_channel_metrics, list_videos, get_retention_curve, or analyze_pillar_performance. The only usage note is about refresh=true and caching, which addresses parameter behavior rather than tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_retention_curveA
Read-only

Audience retention curve for one video: a list of points {ratio, watch_ratio, relative} across the video's elapsed-time ratio.

ParametersJSON Schema
NameRequiredDescriptionDefault
refreshNo
video_idYes

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare readOnlyHint=true, so the description does not need to restate safety. The description adds useful context about the output structure (list of points with ratio, watch_ratio, relative), but it does not disclose details like whether the curve is normalized, how missing data is handled, or whether refresh forces a recomputation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that front-loads the core purpose and includes the key output structure. Every word earns its place, and there is no redundant restating of the tool name or schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only single-video tool with a simple schema, the description is mostly adequate. However, with no output schema and no explanation of the 'refresh' parameter or the meaning of the returned fields, an agent may not know how to interpret the response or when to set refresh. It is minimally viable but has clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for parameter meaning. It explains the output semantics but does not explain the 'refresh' parameter or the expected format of video_id beyond the schema's basic type. The description adds some value by clarifying the output fields, but leaves parameter-level meaning mostly to the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('get') and resource ('audience retention curve for one video') and defines the returned data shape as a list of points with ratio, watch_ratio, and relative fields. It is clear what the tool does, though it does not explicitly distinguish it from sibling tools like get_channel_metrics or analyze_pillar_performance.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for retrieving retention data for a single video, and the required video_id parameter makes the context clear. However, it does not state when to prefer this over siblings or mention any exclusions, such as not being suitable for channel-level retention analysis.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_videosA
Read-only

Every uploaded video (id, title, publish date, ISO-8601 duration) via the uploads playlist. Cached; pass refresh=true to bypass the cache.

ParametersJSON Schema
NameRequiredDescriptionDefault
refreshNo

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already establish readOnlyHint=true, and the description adds meaningful behavioral context: results are cached, refresh=true bypasses the cache, and the data comes from the uploads playlist. This goes beyond the structured annotation without contradicting it.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single efficient sentence: it front-loads the purpose and output fields, then adds the caching note and parameter behavior. Every phrase contributes useful information with no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple list tool with one optional parameter, the description is complete: it names the exact fields returned, identifies the data source, and explains the cache behavior. The output schema is absent, so the field list in the description adequately compensates.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description carries the full burden for the only parameter, refresh. It explicitly explains that passing refresh=true bypasses the cache, which gives the agent actionable semantics beyond the raw boolean schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('list') and resource ('videos'), and further specifies the scope ('every uploaded video') and return fields (id, title, publish date, ISO-8601 duration). It is immediately clear what this tool does and how it differs from channel-level metric siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'every uploaded video' makes the primary use case explicit: retrieve the complete set of uploaded videos. It does not explicitly name sibling tools or exclusion criteria, but the video-listing scope is clear enough that an agent would not confuse it with channel metrics or retention curves.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv0.1.0
    • First observedanalyze_pillar_performance
    • First observedget_channel_metrics
    • First observedget_channel_overview
    • First observedget_retention_curve
    • First observedlist_videos

TDQS

A3.9/5.0

Scored across 5 tools

Disambiguation5/5

Each tool targets a distinct resource or analytical view: channel overview, channel analytics, video list, retention curve, and pillar aggregation. Even the two channel-level tools are clearly separated by cached current stats vs. date-range analytics.

Naming Consistency5/5

Tool names follow a consistent verb_noun pattern: get_ for single retrievals, list_ for collections, and analyze_ for derived analysis. All names use snake_case and clearly communicate their action.

Tool Count5/5

Five tools is a well-scoped size for an analytics-focused YouTube Studio server. Each tool serves a distinct part of the workflow without unnecessary redundancy or sprawl.

Completeness3/5

The set covers channel-level stats, video listing, retention, and pillar analysis, but there are notable gaps such as per-video performance metrics, video metadata updates, and any management actions. It works well for read-only analytics but is not a complete YouTube Studio surface.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    A local stdio MCP server that gives Claude (or any MCP client) full programmatic control over a single YouTube channel, including video upload, channel management, comments, analytics, and more.
    46
    17 npm
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    A local, privacy-first MCP server providing direct access to official YouTube Data, Analytics, Reporting, and Live Streaming APIs for creators, enabling channel analysis, research, and guarded management operations.
    2
    MIT