setup_mcp.sh•2.19 kB
#!/bin/bash
# Setup script for yt-fetch MCP server with Claude Desktop
set -e
echo "🚀 Setting up yt-fetch MCP server for Claude Desktop"
# Check if YouTube API key is provided
if [ -z "$YOUTUBE_API_KEY" ]; then
echo "❌ Error: YOUTUBE_API_KEY environment variable is required"
echo " Get your API key from: https://console.developers.google.com/"
echo " Then run: export YOUTUBE_API_KEY='your-api-key'"
exit 1
fi
# Determine Claude Desktop config location based on OS
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
CONFIG_DIR="$HOME/Library/Application Support/Claude"
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux
CONFIG_DIR="$HOME/.config/Claude"
else
echo "❌ Unsupported OS: $OSTYPE"
exit 1
fi
CONFIG_FILE="$CONFIG_DIR/claude_desktop_config.json"
echo "📁 Claude Desktop config location: $CONFIG_FILE"
# Create config directory if it doesn't exist
mkdir -p "$CONFIG_DIR"
# Get absolute path of this project
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Create or update Claude Desktop configuration
cat > "$CONFIG_FILE" << EOF
{
"mcpServers": {
"yt-fetch": {
"command": "uv",
"args": [
"run",
"--project",
"$PROJECT_DIR",
"yt-fetch"
],
"env": {
"YOUTUBE_API_KEY": "$YOUTUBE_API_KEY"
}
}
}
}
EOF
echo "✅ Created Claude Desktop configuration at: $CONFIG_FILE"
echo ""
echo "📋 Configuration includes:"
echo " - Server name: yt-fetch"
echo " - Project path: $PROJECT_DIR"
echo " - YouTube API Key: ****${YOUTUBE_API_KEY: -4}"
echo ""
echo "🔄 Please restart Claude Desktop to load the new MCP server"
echo ""
echo "🎯 Available tools after restart:"
echo " - search_videos: Search YouTube with filters"
echo " - get_video_details: Get detailed video information"
echo " - get_channel_info: Get channel statistics"
echo " - filter_videos: Apply custom filters to video lists"
echo " - get_transcripts: Extract video transcripts for analysis"
echo " - trending_analysis: Analyze trending videos"
echo ""
echo "💡 Usage example:"
echo ' "Search for videos about Claude AI from the last month"'