Get the FREE Ultimate OpenClaw Setup Guide →

youtube

Youtube mcp server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio coyasong-youtube-mcp-server node server.js \
  --env PORT="Port to expose the MCP HTTP transport (default 3000)" \
  --env YOUTUBE_API_KEY="Your YouTube Data API key"

How to use

This MCP server provides a comprehensive interface to interact with YouTube data via the Model Context Protocol (MCP). It exposes resources to fetch detailed information about videos and channels, retrieve transcripts and captions, and access comments, along with a suite of tools for statistics, discovery, and analysis. You can query resources using the youtube:// URI schema, and invoke a variety of built-in tools such as search-videos, get-video-stats, get-channel-stats, compare-videos, get-trending-videos, and analyze-channel-videos. The system is designed around an HTTP/Streamable transport and serves MCP requests at the /mcp endpoint, making it compatible with Smithery hosting and other MCP tooling.

To use the server, start it with the provided npm scripts or run the Node server directly if you have a built JavaScript entry point. The server requires a YouTube Data API key (configured via YOUTUBE_API_KEY) and will listen on the port specified by PORT (default 3000). You can build, run, and test with MCP Inspector or your preferred MCP client to issue tool and resource requests. The API supports querying videos, channels, and transcripts, as well as performing cross-video comparisons and advanced transcript analysis through the dedicated tooling prompts.

For typical workflows, you might search for videos with advanced filters, fetch video statistics, extract transcripts in a specific language, or generate transcript summaries. You can also pull trending videos by region and category, and use analysis prompts to glean insights from a channel’s video set or a video’s transcript.

How to install

Prerequisites:

  • Node.js v16+ installed on your system
  • YouTube Data API key obtained from the Google Cloud Console
  • Git (optional but recommended for cloning the repository)

Manual installation steps:

  1. Clone the repository: git clone https://github.com/coyaSONG/youtube-mcp-server.git cd youtube-mcp-server

  2. Install dependencies: npm install

  3. Create a .env file in the project root with your API key and port (optional): YOUTUBE_API_KEY=your_youtube_api_key_here PORT=3000

  4. Build (if applicable) and run: npm run build # if a build step is defined npm start # starts the HTTP MCP server on port 3000 by default

  5. Optional development run: npm run dev # runs in development mode with hot reloading if configured

  6. Docker (optional): docker build -t youtube-mcp-server . docker run -p 3000:3000 --env-file .env youtube-mcp-server

Additional notes

Environment variables and configuration:

  • YOUTUBE_API_KEY is required for all YouTube data requests.
  • PORT controls the HTTP transport port; default is 3000.
  • The MCP endpoint is /mcp; use an MCP client or MCP Inspector to interact.

Common issues:

  • Invalid or missing YOUTUBE_API_KEY will result in authentication errors from the YouTube Data API.
  • If the server cannot connect to YouTube, verify network access and API quota.
  • When migrating from STDIO to HTTP, ensure clients point to http://host:PORT/mcp and that the transport protocol remains compatible with your MCP tooling.

Tips:

  • Use the MCP Inspector to quickly test resources and tools against http://localhost:3000/mcp.
  • Keep your API key secure and rotate it periodically according to security best practices.

Related MCP Servers

Sponsor this space

Reach thousands of developers