home / mcp / yt_mcp mcp server

yt_mcp MCP Server

Provides access to YouTube comments via MCP, returning top-level comments and replies for analysis.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "878787ya-yt_mcp": {
      "command": "<abs path>/yt_mcp/.venv/bin/python",
      "args": [
        "<abs path>/yt_mcp/server.py"
      ],
      "env": {
        "YOUTUBE_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

You run a local MCP server that exposes YouTube comments data through a simple, scriptable interface. This server fetches the top-level YouTube comments and their replies for a given video using YouTube Data API v3 and returns the results as a JSON string. You can connect to it from an MCP client to perform analysis, summarization, translation, or categorization tasks on the retrieved comments.

How to use

Start your local MCP server and connect to it from your MCP client. Use the provided fetch_comments function to request comments for a specific video. You can control the order of results and the maximum number of items returned. The server will return a JSON string containing the requested data, which you can then feed into your downstream workflows (summaries, classifications, translations, reports, etc.). The typical usage pattern is to request a batch of comments, then perform your analysis on the returned data within the MCP client or your own tooling.

Example usage from your MCP client (conceptual): call fetch_comments with a video URL, an order (relevance or time), and a maximum count. The server responds with a structured JSON payload that includes video_id, order, requested, total_returned, and an items list with comment details.

How to install

Prerequisites you need before installation: Python 3.10 or newer and a YouTube Data API v3 key.

Install the MVP server locally using the following steps.

uv venv
source .venv/bin/activate
uv pip install "mcp[cli]" httpx python-dotenv

Additional setup and configuration

Set your YouTube API key. You can provide it via a .env file at the project root or inline in the client configuration.

YOUTUBE_API_KEY=YOUR_API_KEY_HERE

Notes on running locally with Claude Desktop (STDIO)

To run the local MCP server for Claude Desktop, configure the Local MCP servers with the absolute paths to your Python virtual environment and the server script. Then start the yt_comments service from the Local MCP servers interface and call the fetch_comments method from Claude.

{
  "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" }  // if you used a .env, you can omit this line
    }
  }
}

Troubleshooting

Missing YOUTUBE_API_KEY: add the key to a .env file or the client environment and ensure the key has YouTube Data API v3 access.

Module or dependency issues: ensure you installed the required packages in the active virtual environment.

HTTP/403 errors: check API key quotas and permissions, and verify that the video is allowed to have comments.

Security

Environment variables containing API keys should not be committed. Use a .env file or secure client configuration and avoid sharing keys in public repos.

Notes

This server focuses on retrieving YouTube comments and returning them in a structured JSON format for downstream processing in your MCP workflows.

Available tools

fetch_comments

Fetches comments for a given YouTube video URL, with options to order by relevance or time and limit the maximum number of items. Returns the data as a JSON string.