About YouTube MCP Server
YouTube MCP Server coordinates YouTube playback across connected devices. It is intended for users who want to search for videos and control playback from multiple clients, with playback state updates shared in real time.
Key features
- 01Search YouTube videos
- 02Play, pause, stop, and seek
- 03Adjust volume and mute audio
- 04Synchronize playback across clients
- 05Share real-time player state
Use cases
- 01Control playback from multiple devices
- 02Find videos and start them in the interface
- 03Keep connected clients aligned during playback
MCP support
It provides YouTube playback and search capabilities to MCP clients, with commands and player-state updates shared across connected clients.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEYouTube MCP Server
A Media Control Protocol (MCP) server for YouTube integration that allows you to control YouTube playback across multiple devices.
Features
- Play, pause, and control YouTube videos from any device
- Synchronize playback across multiple clients
- Search YouTube videos directly from the interface
- Control volume and playback position
- Real-time updates using WebSockets
- Simple and intuitive user interface
Installation
-
Clone this repository:
git clone https://github.com/Tisik79/youtube-mcp-server.git cd youtube-mcp-server -
Install dependencies:
npm install -
Create a
.envfile based on the.env.exampletemplate:cp .env.example .env -
Edit the
.envfile and add your YouTube API key:YOUTUBE_API_KEY=your_youtube_api_key_hereYou can obtain a YouTube API key from the Google Cloud Console:
- Create a new project
- Enable the YouTube Data API v3
- Create API credentials (API Key)
Usage
-
Start the server:
npm start -
For development with automatic restart:
npm run dev -
Open your browser and navigate to:
http://localhost:3000
How it Works
The YouTube MCP Server provides a central control point for YouTube playback across multiple devices. It uses:
- Express.js for the HTTP server and API endpoints
- Socket.io for real-time communication between clients
- YouTube Data API for searching videos and fetching video information
- YouTube IFrame API for controlling video playback
When a client connects to the server:
- They can search for videos using the search function
- Play videos on their device
- Control playback (play, pause, seek, volume)
- All commands are broadcasted to other connected clients
- Clients can sync with the current playback state
API Endpoints
GET /api/video/:videoId- Get video informationGET /api/search?q=query- Search for YouTube videosGET /api/clients- Get a list of connected clients
WebSocket Events
Client to Server
play- Play a videopause- Pause the current videostop- Stop playbackseek- Seek to a specific positionvolume- Change volumemute- Mute/unmute audioupdateTimestamp- Update the current playback position
Server to Client
playerStateUpdate- Broadcast player state updates to all clients
Project Structure
youtube-mcp-server/
├── public/ # Client-side files
│ ├── index.html # Main HTML file
│ ├── app.js # Client-side JavaScript
│ └── styles.css # CSS styles
├── server.js # Main server file
├── package.json # Dependencies and scripts
└── .env # Environment variables (create from .env.example)
Requirements
- Node.js (v14 or higher)
- npm (v6 or higher)
- A YouTube Data API key
Customization
You can customize the server by:
- Modifying the UI in the
publicdirectory - Adding additional API endpoints in
server.js - Extending the Socket.io event handlers for more functionality
Troubleshooting
Common issues:
- API Key Error: Ensure your YouTube API key is correctly set in the
.envfile - Connection Issues: Make sure your firewall allows connections on the specified port
- Video Playback Issues: Some videos may have embedding disabled by the owner
License
This project is licensed under the MIT License - see the LICENSE file for details.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.