YouTube Comments MCP Server
Fetches YouTube video comments and replies through the YouTube Data API, allowing retrieval of top-level comments with configurable ordering and limits for analysis and reporting.
Click on "Install 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 Comments MCP Serverfetch_comments videoUrl="https://www.youtube.com/watch?v=dQw4w9WgXcQ" order="relevance" max=100"
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.
yt_mcp — YouTube Comments MCP Server
一個遵循 Model Context Protocol (MCP) 的本機伺服器。提供工具:
fetch_comments(videoUrl, order="relevance|time", max=300)以 YouTube Data API v3 取得並展開 頂層留言+回覆,回傳 JSON 字串。
需求
Python 3.10+
已啟用 YouTube Data API v3 的 API 金鑰
Related MCP server: mcp-server-youtube
安裝
uv venv
source .venv/bin/activate
uv pip install "mcp[cli]" httpx python-dotenv設定金鑰(擇一)
A. 用 .env(推薦)
在專案根目錄建立 .env:
YOUTUBE_API_KEY=YOUR_API_KEY_HEREB. 寫在客戶端設定的 env(見下方範例)
在 Claude Desktop 使用(本機 STDIO)
開啟:Settings → Developer → Local MCP servers → Edit Config
加入(請把絕對路徑換成你的實際路徑):
{
"mcpServers": {
"yt_comments": {
"command": "<abs path>/yt_mcp/.venv/bin/python",
"args": ["<abs path>/yt_mcp/server.py"],
"env": { "YOUTUBE_API_KEY": "YOUR_API_KEY" } // 若已用 .env,可移除此段
}
}
}也可不填
env,改用專案根目錄的.env。
回到 Local MCP servers 啟動
yt_comments。新開對話請 Claude 呼叫:
yt_comments.fetch_comments(
videoUrl="https://www.youtube.com/watch?v=XXXXXXXXXXX",
order="relevance",
max=300
)接著請模型做摘要/分類/翻譯並輸出報告。
在 MCP Inspector 測試
Transport:
STDIOCommand:
<abs path>/yt_mcp/.venv/bin/pythonArguments:
<abs path>/yt_mcp/server.pyEnvironment(可選):
YOUTUBE_API_KEY=YOUR_API_KEY
輸出格式(節選)
{
"video_id": "abcdEFGhijk",
"order": "relevance",
"requested": 300,
"total_returned": 278,
"items": [
{
"id": "...",
"parentId": null,
"author": "Somebody",
"publishedAt": "2025-01-01T12:34:56Z",
"likeCount": 42,
"text": "Great video!"
}
]
}Troubleshooting
Missing YOUTUBE_API_KEY 在
.env或設定的env補上金鑰,並確認金鑰已啟用 YouTube Data API v3。找不到
server.py在設定裡把args改用絕對路徑(例如"/Users/you/yt_mcp/server.py")。ModuleNotFoundError 確認已在虛擬環境內安裝相依套件(
"mcp[cli]" httpx python-dotenv)。HTTP 403/400 可能是配額不足、影片關閉留言、或金鑰權限未開。
安全
.env已在.gitignore中,請勿提交金鑰。若曾不小心提交金鑰,請 旋轉金鑰 並清理 Git 歷史。
授權
MIT License。
Available Tools
1 toolfetch_commentsA
Fetch public comments for a YouTube video and return a JSON string. Args: videoUrl: Full YouTube video URL. order: "relevance" (default) or "time". max: Max total comments to return (100–1000 建議).
| Name | Required | Description | Default |
|---|---|---|---|
| videoUrl | Yes | ||
| order | No | relevance | |
| max | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations exist, so description bears full burden. It mentions 'public' but omits authentication requirements, rate limits, error handling, or side effects. Fails to disclose important behavioral traits.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences with args list, front-loaded with purpose. No wasted words, concise yet informative.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Output schema exists but description does not leverage it. Lacks mention of pagination, error responses, or field details. Adequate for simple tool but could be more complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema coverage, description adds meaning: specifies videoUrl as full URL, order options, and max range suggestion. Enhances understanding beyond schema types.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states verb 'Fetch' and resource 'public comments for a YouTube video', with immediate purpose. No siblings exist, so no differentiation needed.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides parameter usage (order default, max range suggestion) and notes public availability. Lacks explicit when-to-use/alternatives, but no siblings make this acceptable.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
With only one tool, there is no possibility of confusion or overlap between tools.
A single tool named 'fetch_comments' follows a clear and consistent verb_noun pattern.
One tool is borderline; it is appropriate for a highly focused purpose, but most servers benefit from at least a few related tools.
The server only provides fetching of comments, lacking common operations like replying, deleting, or retrieving replies, which are expected for a YouTube Comments server.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
YouTube public video, comment, reply, channel, search, and speech-to-text transcript tools.
Provide token-optimized, structured YouTube data to enhance your LLM applications. Access efficien…
YouTube transcripts, subtitles, and video metadata as structured JSON via an Apify Actor.
YouTube transcripts, search, channel/playlist listings and upload tracking for AI agents. No signup.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables access to YouTube data including channel videos, live streams, shorts, video details, transcripts, screenshots, and related content through the Yt API with support for localization and pagination.34MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to search videos, read channels, browse playlists, fetch comments, and get transcripts from YouTube using the YouTube Data API v3 and InnerTube API for captions.2GPL 3.0
- FlicenseNot gradedqualityCmaintenanceEnables AI assistants to search videos, channels, and playlists, retrieve video metadata, transcripts, and comments via the YouTube Data API v3.71
- AlicenseCqualityDmaintenanceEnables AI assistants to research YouTube videos by collecting captions, comments, and channel information for analysis and comparison.109MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/878787ya/yt_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server