Skip to main content
Glama
YouTube & Shorts Analytics MCP Server

YouTube & Shorts Analytics MCP Server

by ara0440-wq

YouTube & Shorts Analytics MCP Server

An open-source Model Context Protocol (MCP) server that gives Claude, Cursor, and other AI agents direct access to YouTube video & Shorts transcripts, retention hooks, metadata, tags, and top audience comments.

Tools Included

Tool

Description

API Key Needed?

get_video_transcript

Fetch full video or Shorts transcript text

No

get_shorts_hook

Extract opening 10s (or custom duration) for retention analysis

No

get_video_metadata

Get title, description, tags, views, likes, and comment count

Yes

get_top_comments

Fetch top comments sorted by relevance for sentiment analysis

Yes

Related MCP server: YouTube Transcripts MCP Server

Local Setup

Use Node.js 20 or later. Open a terminal in the project directory and run:

npm ci
npm run build

Connect to Codex

After building, register the server with the absolute path to build/index.js:

codex mcp add youtube-analytics -- node "/absolute/path/to/youtube-analytics-mcp/build/index.js"
codex mcp list

Start a new Codex session to load the server. To pass an existing YOUTUBE_API_KEY environment variable to the server, add env_vars = ["YOUTUBE_API_KEY"] to its [mcp_servers.youtube-analytics] table. See the Codex MCP guide.

Connect to Gemini CLI

From the directory where you use Gemini CLI, register the server with the absolute path to the compiled file:

gemini mcp add --scope project --env 'YOUTUBE_API_KEY=$YOUTUBE_API_KEY' youtube-analytics node "/absolute/path/to/youtube-analytics-mcp/build/index.js"
gemini mcp list

Open Gemini CLI, trust the project folder if prompted, and run /mcp to verify the tools. The Gemini web app uses a reachable MCP server URL for custom connected apps. See the Gemini CLI MCP guide and the Gemini Apps guide.

Connect to Claude Desktop

Add this entry to your claude_desktop_config.json. Replace the path with the absolute path to the compiled file. Forward slashes also work on Windows.

{
  "mcpServers": {
    "youtube-analytics": {
      "command": "node",
      "args": ["/absolute/path/to/youtube-analytics-mcp/build/index.js"],
      "env": {
        "YOUTUBE_API_KEY": "YOUR_YOUTUBE_DATA_API_V3_KEY"
      }
    }
  }
}

Restart Claude Desktop after saving the config. You can omit the env block when using caption tools only. For metadata and comments, enable YouTube Data API v3 in Google Cloud and set YOUTUBE_API_KEY in your MCP client's configuration.

Caption retrieval depends on the video's available subtitles and the upstream YouTube transcript service. The hook tool selects caption segments that start before the requested cutoff.

Example Prompts

  • "Analyze the first 10 seconds hook of this Short and explain why it holds attention: https://youtube.com/shorts/..."

  • "Fetch the top 20 comments from this video and list the top 5 questions viewers are asking."

  • "Get the metadata and tags of this video and suggest a higher-CTR title."

License

MIT

Available Tools

4 tools
get_shorts_hookB

Extract the opening seconds (hook) of a YouTube video or Short for retention analysis.

Inputs: url (required), seconds.

get_top_commentsB

Fetch the top comments of a YouTube video for audience sentiment analysis.

Inputs: url (required), limit.

get_video_metadataB

Fetch title, description, tags, views, likes, and comment count via YouTube Data API v3.

Inputs: url (required).

get_video_transcriptC

Fetch the full transcript text of a YouTube video or Short.

Inputs: url (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool targets a clearly distinct data type: transcript text, opening hook seconds, metadata, and comments. There is no overlap in purpose, so an agent can select unambiguously based on the desired output.

    Naming Consistency5/5

    All four tools follow the consistent get_<noun> pattern (get_video_transcript, get_shorts_hook, get_video_metadata, get_top_comments). The convention is predictable and readable throughout.

    Tool Count4/5

    Four tools is a focused, well-scoped set for video-level analytics, with each tool earning its place. It leans slightly thin for a server branded 'analytics,' but nothing is redundant or excessive.

    Completeness4/5

    The read-only surface covers the main video-level analysis needs: content (transcript), retention (hook), performance (metadata), and sentiment (comments). Missing pieces like video search/discovery or channel-level metrics are minor workarounds since agents can supply IDs directly.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers