YouTube Channel Server
БесплатноНе проверенRetrieves YouTube Channel statistics, metadata, and uploaded videos using the YouTube Data API v3.
Описание
Retrieves YouTube Channel statistics, metadata, and uploaded videos using the YouTube Data API v3.
README
A Model Context Protocol (MCP) server that retrieves YouTube Channel statistics, metadata, and uploaded videos using the YouTube Data API v3.
This version is implemented in Python using FastAPI and the FastMCP SDK. It runs as an HTTP service over Server-Sent Events (SSE), making it ready for local development and cloud hosting on platforms like Vercel.
Features
- Server-Sent Events (SSE) Transport: Host your MCP server as a remote service.
- Auto-generated Docs: Swagger/OpenAPI interactive documentation automatically available at
/docs. - Flexible Queries: Search channel statistics and uploads using either a channel ID or handle (automatically handles
@prefix normalization). - Vercel Ready: Contains a pre-configured
vercel.jsonrouting configuration.
Local Setup
Install dependencies:
pip install -r requirements.txtAdd Environment Variables: Create a
.envfile in the project root:YOUTUBE_API_KEY=your_google_youtube_api_key_hereRun the Server: Start the FastAPI development server using Uvicorn:
uvicorn api.index:app --reloadThe server will start at
http://127.0.0.1:8000.
Interactive API Documentation
Once the server is running, you can access the interactive Swagger UI in your browser:
- Swagger Documentation: http://127.0.0.1:8000/docs
- Redoc Documentation: http://127.0.0.1:8000/redoc
You can test endpoints and check request/response schemas directly from the Swagger UI.
Connecting to Claude Desktop (SSE Mode)
To connect Claude Desktop to your locally running FastAPI server, edit your configuration file:
- Windows Path:
%APPDATA%\Claude\claude_desktop_config.json - macOS Path:
~/Library/Application Support/Claude/claude_desktop_config.json
Add the server to mcpServers using the url property:
{
"mcpServers": {
"youtube-channel-info-sse": {
"url": "http://127.0.0.1:8000/sse"
}
}
}
Ensure your FastAPI server is running (uvicorn api.index:app) before restarting Claude Desktop.
Deploying to Vercel
Because this server uses the SSE transport over standard HTTP endpoints, you can deploy it directly to Vercel:
- Push your repository to GitHub.
- Go to Vercel and import your project.
- In Settings -> Environment Variables, add your:
YOUTUBE_API_KEY=<your_api_key>
- Deploy!
Vercel will build the serverless functions. Your live remote MCP URL will be:
https://your-project.vercel.app/sse
You can then share this URL or use it in any remote-compatible MCP client configuration!
Available Tools
1. get_channel_details
Retrieves YouTube channel metadata and statistics.
- Arguments:
channel_id(string, optional): Unique ID of the channel (e.g.UC_x5XG1OV2P6uZZ5FSM9Ttw).handle(string, optional): Custom handle of the channel (e.g.@GoogleDevelopersorGoogleDevelopers).
2. get_channel_videos
Retrieves recently uploaded videos for a channel.
- Arguments:
channel_id(string, optional)handle(string, optional)limit(number, optional, default: 10, max: 50): Number of videos to retrieve.
3. get_video_analytics
Retrieves public statistics (views, likes, comments) and metadata (duration, definition). When OAuth2 is configured, it also fetches private Analytics API metrics (watch time, retention/average percentage, subscriber gains/losses, shares).
Note: thumbnail impressions and CTR are not available through the public YouTube Analytics API (they are YouTube Studio-only metrics), so they cannot be returned by this tool.
- Arguments:
video_ids(string, required): Comma-separated list of video IDs (e.g.bfvS1UeAkN0,qnl8-PBJNu4).
4. get_channel_video_analytics
Retrieves recent uploads for a channel fully enriched with public statistics and private Analytics API metrics (if OAuth2 is configured).
- Arguments:
channel_id(string, optional)handle(string, optional)limit(number, optional, default: 10, max: 50)
Private YouTube Analytics Setup (OAuth2)
To retrieve private video-level performance metrics (such as watch time, average view duration/percentage, and subscriber changes), you must obtain Google OAuth2 Client credentials and a refresh token.
1. Google Cloud Console Setup
- Go to the Google Cloud Console.
- Create a new project (or select an existing one).
- Enable both the YouTube Analytics API and the YouTube Data API v3.
- Configure the OAuth Consent Screen:
- Choose External user type.
- Enter standard details (AppName, Support Email).
- Add your own email as a Test User (required while in testing status).
- Create Credentials:
- Go to Credentials -> Create Credentials -> OAuth Client ID.
- Select Web application as application type.
- Add
http://localhost:8080/under Authorized redirect URIs. - Copy the generated Client ID and Client Secret.
2. Generate the Refresh Token
You can easily generate your refresh token using the helper script included in the repository:
- Run the helper script:
python get_refresh_token.py - Enter your Client ID and Client Secret when prompted.
- The script will automatically open your web browser to sign in to your Google Account.
- Sign in with the account owning the YouTube channel and grant the permissions.
- Return to your terminal to copy the generated Refresh Token.
3. Environment Variables
Add the generated credentials to your .env (or Vercel Environment Variables):
YOUTUBE_CLIENT_ID=your_client_id
YOUTUBE_CLIENT_SECRET=your_client_secret
YOUTUBE_REFRESH_TOKEN=your_refresh_token
Troubleshooting: analytics missing even though OAuth is set up
If the analytics field is missing from tool responses, the response now includes an
analyticsNote field on each video explaining why. Common causes:
- The MCP client's OAuth token is not a Google token. Some MCP clients (e.g. ChatGPT
connectors) send their own
Authorization: Bearertoken with every request. The server tries that token first, but if the Analytics API rejects it, it automatically falls back to theYOUTUBE_REFRESH_TOKENflow — so make sure the three environment variables above are set in your deployment (e.g. Vercel → Settings → Environment Variables), then redeploy. - The videos don't belong to your channel. The Analytics API only returns private
metrics for videos owned by the channel that authorized the OAuth credentials
(
ids=channel==MINE). Querying other channels' videos returns public statistics only. - Missing scope. The refresh token must be generated with the
yt-analytics.readonlyscope — useget_refresh_token.py, which requests it, and sign in with the Google account that owns the channel.
Установка YouTube Channel Server
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/Rajpopzein/yt-mcpFAQ
YouTube Channel Server MCP бесплатный?
Да, YouTube Channel Server MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для YouTube Channel Server?
Нет, YouTube Channel Server работает без API-ключей и переменных окружения.
YouTube Channel Server — hosted или self-hosted?
Доступен hosted-вариант: Unyly запускает сервер в облаке, локальная установка не обязательна.
Как установить YouTube Channel Server в Claude Desktop, Claude Code или Cursor?
Открой YouTube Channel Server на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Omni Video
An MCP server that transforms LLM-enabled IDEs into professional video editors by pre-processing footage into text proxies, generating motion graphics via HTML/
автор: buildwithtazaARA
Generate images, video and audio from any AI agent — one connector.
автор: ARAYouTube
Transcripts, channel stats, search
автор: YouTubeEverArt
AI image generation using various models.
автор: modelcontextprotocolCompare YouTube Channel Server with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории media
