YouTube Researcher MCP Server
An MCP server for researching YouTube niches. It searches videos, fetches metadata, calculates engagement metrics, downloads thumbnails, and produces aggregate niche statistics for analysis.
README
YouTube Researcher MCP Server
v1.1.0 · MIT License
An MCP (Model Context Protocol) server for researching YouTube niches. Wraps the YouTube Data API v3 to search for videos, fetch metadata, calculate engagement metrics, download thumbnails, and produce aggregate niche statistics.
Built for Claude Code — define your niche, and the server returns structured data on what's working: title patterns, engagement rates, video lengths, top tags, channel sizes, and thumbnail images for visual analysis.
Recommended Workflow
For the leanest context usage, query 10 videos and delegate analysis to a subagent:
- User provides topic — never assume or infer
youtube_analyse_niche(query, maxResults=10)— top 10 by view count with full metricsyoutube_get_thumbnails(videoIds)— download all 10 thumbnails- Spawn a single agent that reads the raw data + thumbnail images, analyses everything, and writes a research report to disk
- Main context receives only the file path and a brief summary
This keeps the main conversation window clean. The analyse_niche tool returns large JSON (100KB+ at 30 videos) — always save to disk rather than processing in the primary context.
Companion Skill
A ready-made Claude Code skill is included in skill/SKILL.md. To install:
mkdir -p .claude/skills/researching-youtube-niche
cp skill/SKILL.md .claude/skills/researching-youtube-niche/SKILL.md
The skill handles the full workflow — topic prompt, niche analysis, thumbnail download, agent delegation, and report generation. Customise the output path and report structure to suit your workspace.
Prerequisites
- Node.js >= 18
- A YouTube Data API v3 key (free tier — see setup below)
Google Cloud Setup
- Go to Google Cloud Console
- Create a new project (or select an existing one)
- Navigate to APIs & Services > Library
- Search for YouTube Data API v3 and click Enable
- Navigate to APIs & Services > Credentials
- Click Create Credentials > API Key
- (Recommended) Restrict the key:
- Click the key name to edit
- Under API restrictions, select Restrict key and choose YouTube Data API v3
- Under Application restrictions, optionally restrict by IP
- Copy the API key
Installation
git clone https://github.com/larrygmaguire-hash/youtube-researcher-mcp.git
cd youtube-researcher-mcp
npm install
Pre-built JavaScript is included in build/ — no TypeScript compilation needed. To rebuild from source: npm run build.
Configuration
Environment Variable
Create a .env file or pass the key directly:
YOUTUBE_API_KEY=your_key_here
The server validates this at startup and exits if the key is missing.
Claude Code Registration
Global — add to ~/.claude.json:
{
"mcpServers": {
"youtube-researcher": {
"type": "stdio",
"command": "node",
"args": ["/path/to/youtube-researcher-mcp/build/index.js"],
"env": {
"YOUTUBE_API_KEY": "your_key_here"
}
}
}
}
Workspace-scoped — add to .mcp.json in the workspace root (same structure). This keeps the server available only within that workspace.
Tools
youtube_search_niche
Search YouTube for videos by keyword. Returns video IDs sorted by view count, date, relevance, or rating.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| query | string | Yes | — | Search keyword(s) |
| maxResults | number | No | 25 | 1–50 |
| order | string | No | viewCount | viewCount, date, relevance, rating |
| publishedAfter | string | No | — | ISO 8601 date filter (e.g. 2025-01-01T00:00:00Z) |
| regionCode | string | No | — | ISO 3166-1 alpha-2 code (e.g. IE, GB, US) |
Returns: { videoIds: string[], count: number, quotaUsed: number }
Note: This is the only tool that supports the rating sort order and the regionCode filter.
youtube_get_video_details
Fetch full metadata for video IDs. Returns title, description, tags, thumbnails, duration, view/like/comment counts, and calculated engagement metrics. Batches up to 50 per API call.
| Parameter | Type | Required | Description |
|---|---|---|---|
| videoIds | string[] | Yes | Video IDs (max 50) |
Returns per video:
| Field | Type | Description |
|---|---|---|
| videoId | string | YouTube video ID |
| title | string | Video title |
| description | string | Full description text |
| tags | string[] | Video tags |
| publishedAt | string | ISO 8601 publish date |
| durationSeconds | number | Duration in seconds |
| durationFormatted | string | Human-readable duration (e.g. 12:34) |
| viewCount | number | Total views |
| likeCount | number | Total likes |
| commentCount | number | Total comments |
| channelId | string | Channel ID |
| channelTitle | string | Channel name |
| categoryId | string | YouTube category ID |
| thumbnailUrls | object | URLs at default/medium/high/standard/maxres sizes |
| engagementRate | number | (likes + comments) / views |
| likeToViewRatio | number | likes / views |
| commentDensity | number | comments / views |
| daysSincePublish | number | Days since publish (minimum 1) |
| viewVelocity | number | views / daysSincePublish |
youtube_get_channel_details
Fetch channel metadata including subscriber count, total views, and video count. Deduplicates channel IDs automatically.
| Parameter | Type | Required | Description |
|---|---|---|---|
| channelIds | string[] | Yes | Channel IDs (max 50; duplicates removed) |
Returns per channel:
| Field | Type | Description |
|---|---|---|
| channelId | string | Channel ID |
| title | string | Channel name |
| description | string | Channel description |
| subscriberCount | number | Subscriber count |
| videoCount | number | Total videos published |
| totalViewCount | number | Lifetime view count |
| publishedAt | string | Channel creation date |
| thumbnailUrl | string | Channel avatar URL |
| hiddenSubscriberCount | boolean | Whether the sub count is hidden |
youtube_analyse_niche
Primary entry point. Compound tool that searches, fetches video/channel details, calculates metrics, and returns aggregate statistics in a single call.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| query | string | Yes | — | Niche keyword(s) |
| maxResults | number | No | 30 | 1–50. Recommend 10 for lean workflow |
| publishedAfter | string | No | — | ISO 8601 date filter |
| minViews | number | No | — | Minimum view count filter (post-fetch — see note) |
| order | string | No | viewCount | viewCount, date, relevance |
Automatic filters (no parameter needed):
- Videos under 60 seconds are excluded (Shorts detection by duration, not YouTube's Shorts flag)
- Active live streams are excluded
minViews gotcha: This is a post-fetch filter. The search and video detail API calls run first (consuming quota), then videos below the threshold are removed from results. A high minViews value can return very few or zero videos while still costing the full quota.
Not available on this tool: regionCode and rating sort order — use youtube_search_niche for those.
Returns:
{
query: string,
fetchedAt: string, // ISO 8601 timestamp
totalVideosAnalysed: number,
videos: VideoMetrics[], // Full per-video data (see youtube_get_video_details)
channels: ChannelMetrics[], // Deduplicated channel data
aggregates: {
medianViewCount: number,
averageViewCount: number,
medianEngagementRate: number,
averageEngagementRate: number,
medianDurationSeconds: number,
medianLikeToViewRatio: number,
topTags: [{ tag, count }], // Top 20 by frequency
durationDistribution: { // Video count per bucket
under5min, fiveToTen, tenToTwenty, overTwenty
},
publishDayDistribution: { // Count by day of week (UTC)
Monday, Tuesday, ...
},
channelSizeDistribution: { // By subscriber count
micro: <10K, mid: 10K-100K, large: 100K-1M, mega: 1M+
}
},
quotaUsed: number
}
youtube_get_thumbnails
Download thumbnail images to a local directory. No API quota cost — fetches directly from YouTube's image CDN.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| videoIds | string[] | Yes | — | Video IDs (max 50) |
| outputDir | string | No | ~/Downloads/youtube-thumbnails/YYYY-MM-DD/ |
Save path |
Behaviour: Tries maxresdefault.jpg first; falls back to hqdefault.jpg on 404. Files saved as [videoId].jpg.
Returns: { downloaded: number, outputDir: string, files: { [videoId]: "/absolute/path.jpg" } }
youtube_quota_status
Report estimated quota usage for the current server session. No parameters.
Returns:
{
"quotaUsed": 103,
"dailyLimit": 10000,
"remaining": 9897,
"note": "Quota resets at midnight Pacific Time. Usage is estimated..."
}
Note: The counter tracks usage within the current server process. It resets when the server restarts, and does not reflect the actual Google-side daily total.
Calculated Metrics
For each video, the server calculates:
| Metric | Formula |
|---|---|
| Engagement rate | (likes + comments) / views |
| Like-to-view ratio | likes / views |
| Comment density | comments / views |
| Days since publish | (now - publishedAt) / 86400000, minimum 1 |
| View velocity | views / days since publish |
Quota
YouTube Data API v3 provides 10,000 free units per day.
| Operation | Cost |
|---|---|
| Search (search.list) | 100 units |
| Video details (videos.list, batch 50) | 1 unit |
| Channel details (channels.list, batch 50) | 1 unit |
| Thumbnail download | 0 (direct fetch) |
A typical full niche analysis: ~103 units. Daily budget allows ~48 analyses per day.
Quota resets at midnight Pacific Time.
Development
npm run dev # Watch mode — recompiles on changes
npm run build # One-time build
npm start # Run the server
Tech stack: TypeScript 5.3, ES2022 target, NodeNext modules, @modelcontextprotocol/sdk ^1.0.0. No runtime dependencies beyond the MCP SDK — uses Node 18+ native fetch for all HTTP calls.
Licence
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。