youtube-gemini-mcp

youtube-gemini-mcp

Enables conversational analysis of YouTube videos using Gemini 2.5 Pro, supporting multi-turn sessions, direct URL processing, and local video uploads.

Category
访问服务器

README

YouTube Gemini MCP Hero

YouTube Gemini MCP Server

PyPI version

A Model Context Protocol (MCP) server that provides conversational YouTube video analysis capabilities using Gemini 2.5 Pro. Analyze videos through multi-turn conversations with advanced visual understanding.

🎯 What Problems Does This Solve?

Traditional Video Analysis Pain Points

❌ Transcript-only limitations - Missing visual context and scene understanding
❌ No conversation memory - Each analysis starts from scratch
❌ Manual workflows - Complex download/upload processes

Our Solution

✅ Full video analysis - Visual, audio, and contextual understanding
✅ Session memory - Builds on previous analysis automatically
✅ Integrated workflows - YouTube URL to analysis in one step

🚀 Key Capabilities

🔄 Session-Based Video Conversations

Create persistent sessions for multi-turn video analysis:

# Create session
create_video_session(
    description="Analyze machine learning lecture",
    video_source="https://youtube.com/watch?v=abc123",
    source_type="youtube_url"
)

# Continue conversation
analyze_video_in_session(session_id="uuid", prompt="What are the key concepts?")
analyze_video_in_session(session_id="uuid", prompt="Explain the neural networks part")

📹 Direct YouTube Processing

No downloads required - process YouTube videos directly:

analyze_youtube_video(
    youtube_url="https://youtube.com/watch?v=abc123",
    prompt="Summarize this video's main points"
)

💾 Local Video Support

Upload and analyze local video files (48-hour retention):

analyze_local_video(
    video_path="/path/to/video.mp4",
    prompt="What happens in this video?"
)

🛠️ Installation

Prerequisites

  • Python 3.10+
  • Google AI API key
  • Poetry (recommended) or pip

Setup

# Clone repository
git clone https://github.com/aigentive/youtube-gemini-mcp
cd youtube-gemini-mcp

# Install with Poetry
poetry install

# Or with pip
pip install -e .

# Set environment variable
export GOOGLE_API_KEY="your_google_api_key_here"

🔧 Claude Desktop Integration

Quick Setup

  1. Get Google AI API Key: Visit Google AI Studio to get your free API key
  2. Add to Claude Desktop: Copy the configuration below to your Claude Desktop settings

Production Configuration

Add to your Claude Desktop MCP configuration (claude_desktop_config.json):

{
  "mcpServers": {
    "youtube-gemini-mcp": {
      "command": "youtube-gemini-mcp",
      "env": {
        "GOOGLE_API_KEY": "your_google_api_key_here"
      }
    }
  }
}

Development Configuration

For development work, use the Poetry configuration:

{
  "mcpServers": {
    "youtube-gemini-mcp-dev": {
      "command": "poetry",
      "args": ["run", "python", "-m", "youtube_gemini_mcp.server"],
      "cwd": "/absolute/path/to/youtube-gemini-mcp",
      "env": {
        "GOOGLE_API_KEY": "your_google_api_key_here",
        "LOG_LEVEL": "DEBUG"
      }
    }
  }
}

Configuration Templates

We provide ready-to-use configuration files:

  • Development: mcp-config.poetry.json - For local development
  • Production: mcp-config.private.json.example - Copy and customize

📚 Available Tools

Tool Description
create_video_session Create new conversational analysis session
analyze_video_in_session Analyze video within session context
analyze_youtube_video Single-shot YouTube video analysis
analyze_local_video Single-shot local video analysis
get_session_status Get session information and history
list_active_sessions List all active sessions
close_session Close session and cleanup resources
validate_youtube_url Validate and normalize YouTube URLs
get_usage_guide Comprehensive documentation
get_server_stats Server health and statistics

🎯 Use Cases

Educational Content Analysis

Analyze lectures, tutorials, and educational videos with follow-up questions.

Content Research

Research documentaries, interviews, and informational content systematically.

Video Summarization

Extract key insights and create summaries from long-form content.

Training Material Development

Analyze existing training videos to extract learning objectives and key points.

⚡ Quick Examples

Analyze a YouTube Video

# Direct analysis - perfect for quick insights
analyze_youtube_video(
    youtube_url="https://youtube.com/watch?v=dQw4w9WgXcQ",
    prompt="What is this video about? Provide a comprehensive summary."
)

Session-Based Analysis

# Create persistent session for multi-turn conversation
session = create_video_session(
    description="Learning about machine learning fundamentals",
    video_source="https://youtube.com/watch?v=abc123",
    session_name="ML Fundamentals Study"
)

# Build understanding through conversation
analyze_video_in_session(
    session_id=session["session_id"], 
    prompt="What are the main topics covered in this lecture?"
)

analyze_video_in_session(
    session_id=session["session_id"], 
    prompt="Focus on the neural networks section - how are they explained?"
)

analyze_video_in_session(
    session_id=session["session_id"], 
    prompt="What practical examples or demonstrations are shown?"
)

analyze_video_in_session(
    session_id=session["session_id"], 
    prompt="Based on our discussion, what are the key takeaways for beginners?"
)

Local Video Analysis

# Upload and analyze private content
analyze_local_video(
    video_path="/path/to/your/presentation.mp4",
    prompt="Extract the key business metrics and recommendations from this quarterly review"
)

Advanced: Timestamp-Specific Analysis

# Focus on specific video segments
analyze_video_in_session(
    session_id="your-session-id",
    prompt="Analyze the demonstration shown in this segment",
    timestamp_range="5:30-8:45"
)

🔐 Configuration

Environment Variables

Required:

Optional Configuration:

MCP_MAX_SESSIONS=50               # Maximum concurrent sessions
MCP_SESSION_TIMEOUT=7200          # Session timeout in seconds (2 hours)
GEMINI_MODEL_DEFAULT="gemini-2.5-pro-preview-05-06"  # Default Gemini model
MAX_VIDEO_DURATION=7200           # Max video length in seconds
AUTO_CLEANUP_FILES=true           # Auto-cleanup uploaded files
LOG_LEVEL=INFO                    # Logging level (DEBUG, INFO, WARNING, ERROR)

System Requirements

  • Python: 3.10+ (3.11+ recommended)
  • Memory: 4GB RAM minimum for video processing
  • Storage: 500MB for session data and temporary files
  • Network: High-speed internet for video processing

Limitations & Constraints

YouTube Videos (Unlimited Sessions)

  • ✅ No file size limits - Direct URL processing
  • ✅ Unlimited session duration - No 48-hour restriction
  • ⚠️ 2-hour video limit - Recommended maximum for optimal performance
  • ⚠️ Public videos only - Private/unlisted may not be accessible

Local Videos (48-Hour Sessions)

  • ⚠️ 2GB file size limit - Google Files API restriction
  • ⚠️ 48-hour auto-deletion - Files automatically deleted after 48 hours
  • ⚠️ 20GB project limit - Total storage quota per Google project
  • ❌ No retention extension - Cannot extend file lifespan beyond 48 hours

Performance Guidelines

  • Concurrent sessions: Default maximum 50 active sessions
  • Session timeout: 2 hours of inactivity before cleanup
  • Memory usage: ~100MB per active session
  • Response time: 10-30 seconds for typical analysis requests

🧪 Testing

# Run tests
poetry run pytest

# With coverage
poetry run pytest --cov=youtube_gemini_mcp

# Type checking
poetry run mypy src/

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 Related Projects

📚 Documentation

🤝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Quick Start for Contributors

  1. Fork the repository
  2. Set up development environment: poetry install
  3. Run tests: poetry run pytest
  4. Make your changes and add tests
  5. Submit a pull request

📞 Support & Community

Getting Help

  1. Check Documentation: Start with LLM.md for usage questions
  2. Search Issues: Look for existing solutions in GitHub Issues
  3. Create Issue: Provide clear details and reproduction steps
  4. Community: Join discussions for general questions and ideas

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选