YouTube & Shorts Analytics MCP Server
Provides tools for fetching YouTube video and Shorts transcripts, extracting opening hook segments for retention analysis, retrieving video metadata and tags, and listing top audience comments for sentiment analysis.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@YouTube & Shorts Analytics MCP Server pull the transcript and first-10s hook from this Short: https://youtube.com/shorts/abc123"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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? |
| Fetch full video or Shorts transcript text | No |
| Extract opening 10s (or custom duration) for retention analysis | No |
| Get title, description, tags, views, likes, and comment count | Yes |
| 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 buildConnect 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 listStart 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 listOpen 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 toolsget_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
Scored across 4 tools
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.
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.
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.
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
Related MCP Connectors
YouTube for AI agents: transcripts, comments, video stats, channel monitor, Shorts captions.
YouTube transcripts, search, channel/playlist listings and upload tracking for AI agents.
YouTube transcripts, search, channels, playlists and bulk transcript jobs for AI agents. 14 tools.
Search YouTube videos, read transcripts and get public video information in your AI assistant.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI models to interact with YouTube content through 18 MCP tools for videos, transcripts, channels, and playlists.-
- FlicenseAqualityDmaintenanceProvides YouTube video transcripts (text and metadata) as MCP tools for AI hosts like Claude Code, enabling summarization, search, and Q&A without watching the video.2-
- FlicenseNot gradedqualityFmaintenanceGives MCP clients access to YouTube video transcripts and metadata. It lets AI agents read and summarize video content from a URL.-
- AlicenseNot gradedqualityBmaintenanceEnables ChatGPT to retrieve current YouTube metadata, channel uploads, search results, and transcripts via read-only MCP tools.1Apache 2.0