Session-based conversational YouTube video analysis MCP server using Gemini 2.5 Pro
Project description
YouTube Gemini MCP Server
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
- Get Google AI API Key: Visit Google AI Studio to get your free API key
- 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:
GOOGLE_API_KEY- Get your free API key from Google AI Studio
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
- LLM.md - Comprehensive usage guide for AI systems
- DEVELOPMENT.md - Development setup and architecture
- CONTRIBUTING.md - How to contribute to the project
- PRD.md - Complete product requirements document
🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Quick Start for Contributors
- Fork the repository
- Set up development environment:
poetry install - Run tests:
poetry run pytest - Make your changes and add tests
- Submit a pull request
📞 Support & Community
- 🐛 Bug Reports: GitHub Issues
- 💡 Feature Requests: GitHub Issues
- 💬 Discussions: GitHub Discussions
- 📖 Documentation: Check our comprehensive docs above
Getting Help
- Check Documentation: Start with LLM.md for usage questions
- Search Issues: Look for existing solutions in GitHub Issues
- Create Issue: Provide clear details and reproduction steps
- Community: Join discussions for general questions and ideas
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file youtube_gemini_mcp-0.1.1.tar.gz.
File metadata
- Download URL: youtube_gemini_mcp-0.1.1.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.11.12 Linux/6.11.0-1014-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53e223dca62b85de4917d321a186b768ec041706cf0e36c7748f6d9e9080f27e
|
|
| MD5 |
4d3a8294a4827b038b2e52c25f3cf878
|
|
| BLAKE2b-256 |
7db0249422a5b409ffe74d9d6e3365e15ca1c323611022ba9aa1c2352acaabd0
|
File details
Details for the file youtube_gemini_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: youtube_gemini_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.11.12 Linux/6.11.0-1014-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1921d7597147a0e90850946e6e4bf2227861b14cc554f3a7f7af4563011b81a5
|
|
| MD5 |
70bcdbb9719cc702a05fdd0b74d69382
|
|
| BLAKE2b-256 |
6b8c1e7c0db84bcb0d8264ea8f1ef07df223c0e35f441ec39f4edaed44e79461
|