1.0.5 • Published 9 months ago

@gongrzhe/server-youtube-autoauth-mcp v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

YouTube AutoAuth MCP Server

A Model Context Protocol (MCP) server for YouTube integration in Claude Desktop with auto authentication support. This server enables AI assistants to manage YouTube through natural language interactions.

Core Features

1. Video Search & Recommendations

  • Search Videos

    {
      "query": "machine learning tutorial",
      "maxResults": 10,
      "orderBy": "relevance",     // Options: relevance, viewCount, rating, date
      "publishedAfter": "2024-01-01T00:00:00Z",  // Optional
      "language": "en"            // Optional
    }
  • Smart Recommendations

    {
      "topic": "artificial intelligence",
      "maxResults": 10,
      "minViewCount": 10000,      // Optional: minimum view count
      "minRating": 4,            // Optional: minimum rating (1-5)
      "language": "en"           // Optional
    }

    Recommendation scoring system:

    • View count weight: 40%
    • Engagement weight (likes & comments): 40%
    • Recency weight: 20%

2. Video Management

  • Upload Video

    {
      "title": "My Video Title",
      "description": "Video description here",
      "privacy": "private",      // Options: private, unlisted, public
      "filePath": "/path/to/video.mp4",
      "tags": ["tag1", "tag2"]   // Optional
    }
  • Update Video

    {
      "videoId": "video123",
      "title": "Updated Title",
      "description": "Updated description",
      "privacy": "public",
      "tags": ["new", "tags"]
    }

3. Playlist Management

  • Create Playlist
    {
      "title": "My Playlist",
      "description": "Playlist description",
      "privacy": "public"        // Options: private, unlisted, public
    }

4. Interaction Features

  • Add Comment
    {
      "videoId": "video123",
      "text": "Great video!",
      "parentId": "comment123"   // Optional, for replies
    }

Response Data Structure

All API calls return rich information including:

{
    videoId: string,
    title: string,
    description: string,
    channelTitle: string,
    publishedAt: string,
    statistics: {
        viewCount: string,
        likeCount: string,
        commentCount: string
    },
    duration: string,
    url: string,           // Direct video URL
    score?: number         // Only for recommendations
}

Installation & Setup

  1. Install via npm:
npm install @gongrzhe/server-youtube-autoauth-mcp
  1. Create Google Cloud Project:
  • Go to Google Cloud Console
  • Create new project or select existing one
  • Enable YouTube Data API v3
  • Create OAuth 2.0 credentials
  • Download credentials as gcp-oauth.keys.json
  1. Configure Authentication:
# Global config (recommended)
mkdir -p ~/.youtube-mcp
mv gcp-oauth.keys.json ~/.youtube-mcp/
npx @gongrzhe/server-youtube-autoauth-mcp auth

# Or local config
npx @gongrzhe/server-youtube-autoauth-mcp auth
  1. Configure in Claude Desktop:
{
  "mcpServers": {
    "youtube": {
      "command": "npx",
      "args": [
        "@gongrzhe/server-youtube-autoauth-mcp"
      ]
    }
  }
}

Environment Variables

  • YOUTUBE_OAUTH_PATH: Custom path to OAuth keys file
  • YOUTUBE_CREDENTIALS_PATH: Custom path to stored credentials

Security Notes

  • OAuth credentials stored securely in ~/.youtube-mcp/
  • Offline access for persistent authentication
  • Never commit credentials to version control
  • Regular access review recommended
  • Rate limiting and quota management included

Error Handling

The server handles various error scenarios:

  • Authentication failures
  • API quota limits
  • Network issues
  • Invalid parameters
  • File access errors

Best Practices

  1. Video Upload:
  • Use appropriate privacy settings
  • Include descriptive titles and tags
  • Consider file size and format
  1. Search & Recommendations:
  • Use specific queries for better results
  • Consider language and region settings
  • Utilize view count and rating filters
  1. Authentication:
  • Keep OAuth credentials secure
  • Monitor API quota usage
  • Regularly refresh tokens

Troubleshooting

  1. Authentication Issues:
  • Verify OAuth configuration
  • Check file permissions
  • Ensure port 3000 is available
  1. API Limits:
  • Monitor quota usage
  • Implement rate limiting
  • Use efficient search parameters
  1. Connection Problems:
  • Check network connectivity
  • Verify firewall settings
  • Ensure proper port access

Support

For issues or questions:

  • File GitHub issues
  • Check API quotas
  • Review YouTube API documentation

License

ISC License