# YouTube MCP Server - Setup Guide
This guide will walk you through setting up the YouTube MCP Server step by step.
## Step 1: Install Node.js
1. Go to [nodejs.org](https://nodejs.org/)
2. Download the LTS version (v18 or higher)
3. Run the installer
4. Verify installation:
```bash
node --version
npm --version
```
## Step 2: Get YouTube API Key
### Create Google Cloud Project
1. **Open Google Cloud Console**
- Visit: https://console.cloud.google.com
- Sign in with your Gmail account
2. **Create a New Project**
- Click the project dropdown at the top
- Click "NEW PROJECT"
- Enter project name: `YouTube MCP Server`
- Click "CREATE"
- Wait for project creation (takes a few seconds)
3. **Select Your Project**
- Click the project dropdown again
- Select your newly created project
### Enable YouTube Data API v3
1. **Navigate to APIs Library**
- Click the hamburger menu (☰) → "APIs & Services" → "Library"
- Or use the search bar at the top: "API Library"
2. **Find YouTube Data API v3**
- In the search box, type: `YouTube Data API v3`
- Click on "YouTube Data API v3" in the results
3. **Enable the API**
- Click the blue "ENABLE" button
- Wait for it to enable (takes a few seconds)
### Create API Key
1. **Go to Credentials**
- Click "APIs & Services" → "Credentials"
- Or click "CREATE CREDENTIALS" button after enabling the API
2. **Create API Key**
- Click "+ CREATE CREDENTIALS" at the top
- Select "API key"
- A popup will show your new API key
- Click "COPY" to copy the API key
- **Save this key somewhere safe!**
3. **Restrict API Key (Recommended)**
- Click "EDIT API KEY" or "Restrict Key"
- Under "API restrictions":
- Select "Restrict key"
- Check only "YouTube Data API v3"
- Under "Application restrictions" (optional):
- Select "IP addresses" or "None" for local use
- Click "SAVE"
## Step 3: Install YouTube MCP Server
### Option A: Clone from GitHub
```bash
# Clone the repository
git clone https://github.com/anirudhyadavMS/youtube_mcp.git
# Navigate to the directory
cd youtube-mcp-server
# Install dependencies
npm install
# Build the project
npm run build
```
### Option B: Install from npm (when available)
```bash
npm install -g youtube-mcp-server
```
## Step 4: Find Your Installation Path
### Windows
```bash
cd youtube-mcp-server
pwd
# Copy the full path, e.g., C:\Users\YourName\youtube-mcp-server
```
### macOS/Linux
```bash
cd youtube-mcp-server
pwd
# Copy the full path, e.g., /Users/YourName/youtube-mcp-server
```
## Step 5: Configure Claude Code
### Find Your Config File
**Windows:**
- `C:\Users\YourName\.config\claude-code\mcp_config.json`
- Or: `C:\Users\YourName\.mcp.json`
**macOS:**
- `~/.config/claude-code/mcp_config.json`
- Or: `~/.mcp.json`
**Linux:**
- `~/.config/claude-code/mcp_config.json`
- Or: `~/.mcp.json`
### Create or Edit Config File
1. **Create the file if it doesn't exist**
2. **Add this configuration:**
```json
{
"mcpServers": {
"youtube": {
"type": "stdio",
"command": "node",
"args": ["FULL_PATH_TO_YOUR_INSTALLATION/dist/server.js"],
"env": {
"YOUTUBE_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}
```
3. **Replace the placeholders:**
- Replace `FULL_PATH_TO_YOUR_INSTALLATION` with the path from Step 4
- Replace `YOUR_API_KEY_HERE` with your API key from Step 2
### Example Configurations
**Windows Example:**
```json
{
"mcpServers": {
"youtube": {
"type": "stdio",
"command": "node",
"args": ["C:\\Users\\John\\youtube-mcp-server\\dist\\server.js"],
"env": {
"YOUTUBE_API_KEY": "AIzaSyDXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
}
}
}
```
**macOS/Linux Example:**
```json
{
"mcpServers": {
"youtube": {
"type": "stdio",
"command": "node",
"args": ["/Users/john/youtube-mcp-server/dist/server.js"],
"env": {
"YOUTUBE_API_KEY": "AIzaSyDXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
}
}
}
```
**Note:** Use forward slashes `/` on macOS/Linux and double backslashes `\\` on Windows.
## Step 6: Restart Claude Code
1. Completely quit Claude Code (not just close the window)
2. Reopen Claude Code
3. The YouTube MCP server should now be available
## Step 7: Test It!
Try asking Claude Code:
```
"Search YouTube for 'python tutorial' and show me the top 5 videos"
```
Or:
```
"What are the most popular videos on the Fireship channel?"
```
## Troubleshooting
### "YouTube client not initialized" Error
**Problem:** API key not loaded properly
**Solution:**
- Check that your API key is correctly pasted in the config
- Ensure there are no extra spaces or quotes
- Restart Claude Code completely
### "Quota exceeded" Error
**Problem:** You've used up your daily API quota (10,000 units)
**Solution:**
- Wait until tomorrow (quota resets at midnight Pacific Time)
- Monitor usage: https://console.cloud.google.com
- Use transcripts instead of searches (they don't use quota)
### "Invalid API key" Error
**Problem:** API key is wrong or not enabled
**Solution:**
- Double-check you copied the entire API key
- Verify YouTube Data API v3 is enabled in Google Cloud Console
- Try creating a new API key
### "Command not found" Error
**Problem:** Node.js not installed or path is wrong
**Solution:**
- Verify Node.js is installed: `node --version`
- Check the path to `server.js` is correct
- Use absolute paths, not relative paths
### Server Not Loading
**Problem:** Config file issues
**Solution:**
- Check JSON syntax (use a JSON validator)
- Ensure file is named `mcp_config.json` not `mcp_config.json.txt`
- Check file is in the correct directory
- Look at Claude Code logs for error messages
## Getting Help
If you're still having issues:
1. Check existing issues: https://github.com/anirudhyadavMS/youtube_mcp/issues
2. Open a new issue with:
- Your operating system
- Node.js version (`node --version`)
- Error messages
- Your config (with API key removed)
## Next Steps
Once setup is complete:
1. Read the [README.md](README.md) for all available tools
2. Check out [API Quota Management](README.md#api-quota-management)
3. Review [Security Best Practices](SECURITY.md)
4. Try different queries to explore features
## Useful Links
- **Google Cloud Console:** https://console.cloud.google.com
- **YouTube Data API Docs:** https://developers.google.com/youtube/v3
- **MCP Documentation:** https://modelcontextprotocol.io
- **Claude Code:** https://claude.com/claude-code
---
Need help? Open an issue on GitHub!