Supports Cloudinary as a file hosting service for temporary video storage required by Instagram API uploads
Uses Facebook Developer platform for Instagram API access and managing Instagram Business account connections
Integrates with Google Cloud Console for YouTube API credentials management and OAuth 2.0 setup
Provides direct upload capabilities to Instagram Reels with caption support and Instagram Graph API integration
Enables automated uploading of videos to YouTube with support for titles, descriptions, tags, and OAuth 2.0 authentication
Automatically detects and uploads short-form videos (under 60 seconds) to YouTube Shorts with optimized formatting
YouTube Shorts & Instagram Reels MCP Server
A Model Context Protocol (MCP) compatible FastAPI server that enables automated posting of videos to YouTube Shorts and Instagram Reels.
Features
🎬 YouTube Shorts Upload: Automatic detection and upload of short-form videos to YouTube
📱 Instagram Reels Upload: Direct upload to Instagram Reels with caption support
🔐 OAuth 2.0 Authentication: Secure authentication for both platforms
🛡️ File Validation: Comprehensive file type and size validation
🔄 Token Refresh: Automatic OAuth token refresh for YouTube
🎯 MCP Compatible: Full MCP tool integration for seamless automation
⚡ Async Operations: High-performance async file handling
📏 Video Processing: Automatic video duration detection using ffprobe
Quick Start
Install dependencies:
Configure credentials:
Start the server:
Test the API:
Visit http://localhost:8000/docs for interactive API documentation
Use the
/upload/youtube
and/upload/instagram
endpointsAccess MCP tools at http://localhost:8000/mcp
API Endpoints
Upload to YouTube Shorts
Response:
Upload to Instagram Reels
Response:
MCP Tool Usage
The server exposes two MCP tools for programmatic access:
post_to_youtube
post_to_instagram
Prerequisites & Setup
YouTube API Setup
Google Cloud Console:
Go to Google Cloud Console
Create a new project or select existing one
Enable YouTube Data API v3 in the API Library
Create OAuth 2.0 credentials (Desktop application)
Get OAuth Tokens:
Configure with your Client ID and Secret
Select
https://www.googleapis.com/auth/youtube.upload
scopeComplete OAuth flow and get access_token + refresh_token
Instagram API Setup
Facebook Developer Account:
Go to Facebook Developers
Create a new app (Business type)
Add Instagram Graph API product
Instagram Business Account:
Connect your Instagram Business/Creator account to a Facebook Page
Generate access token with proper permissions
Get your Instagram User ID
File Hosting (Required):
Instagram requires publicly accessible video URLs
Configure AWS S3, Cloudinary, or custom hosting in .env
Videos are temporarily uploaded to hosting service before Instagram API call
Configuration
Environment Variables
Copy .env.example
to .env
and configure:
File Requirements
Supported Formats
Video: MP4, MOV, AVI, MKV, WebM
Max Size: 100MB (configurable)
Duration: Recommended under 60 seconds for optimal Shorts detection
YouTube Shorts Criteria
Videos under 60 seconds are automatically tagged as Shorts
Vertical or square aspect ratios work best
Resolution: 1080x1920 (9:16) recommended
Instagram Reels Criteria
Duration: 3-90 seconds
Aspect ratio: 9:16 (vertical) recommended
Resolution: 1080x1920 recommended
Testing
Test the Server
Run Test Suite
Error Handling
The server provides detailed error responses:
Common error scenarios:
Invalid file format
File too large
Authentication failures
API rate limits
Network timeouts
Troubleshooting
Common Issues
YouTube Authentication Errors
Verify OAuth credentials are correct
Check if access token has expired (auto-refreshed)
Ensure YouTube Data API v3 is enabled
Instagram Upload Failures
Verify Instagram Business/Creator account is linked
Check access token permissions
Ensure video meets Instagram requirements
Configure file hosting (AWS S3, Cloudinary, etc.)
File Upload Issues
Check file size limits
Verify file format is supported
Ensure sufficient disk space for temporary files
Logs and Debugging
Enable debug mode for detailed logging:
Security Considerations
Store credentials in environment variables, never in code
Use HTTPS in production
Implement rate limiting
Validate all file uploads
Monitor API usage quotas
License
MIT License - see LICENSE file for details.
File Requirements
Supported Formats
Video: MP4, MOV, AVI, MKV, WebM
Max Size: 100MB (configurable)
Duration: Recommended under 60 seconds for optimal Shorts detection
YouTube Shorts Criteria
Videos under 60 seconds are automatically tagged as Shorts
Vertical or square aspect ratios work best
Resolution: 1080x1920 (9:16) recommended
Instagram Reels Criteria
Duration: 15-90 seconds
Aspect ratio: 9:16 (vertical) recommended
Resolution: 1080x1920 recommended
Configuration
Environment variables can be customized:
Error Handling
The server provides detailed error responses:
Common error scenarios:
Invalid file format
File too large
Authentication failures
API rate limits
Network timeouts
Security Considerations
Store credentials in environment variables, never in code
Use HTTPS in production
Implement rate limiting
Validate all file uploads
Monitor API usage quotas
Development
Running in Development Mode
Testing the API
Troubleshooting
Common Issues
YouTube Authentication Errors
Verify OAuth credentials are correct
Check if access token has expired
Ensure YouTube Data API v3 is enabled
Instagram Upload Failures
Verify Instagram Business/Creator account is linked
Check access token permissions
Ensure video meets Instagram requirements
File Upload Issues
Check file size limits
Verify file format is supported
Ensure sufficient disk space for temporary files
Logs and Debugging
Enable debug mode for detailed logging:
License
MIT License - see LICENSE file for details.
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests
Submit a pull request
Support
For issues and questions:
Check the troubleshooting section
Review API documentation
Open an issue on GitHub
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables automated posting of videos to YouTube Shorts and Instagram Reels with OAuth 2.0 authentication, file validation, and comprehensive video processing capabilities. Provides MCP-compatible tools for seamless social media video uploads through a FastAPI server.
Related MCP Servers
- AsecurityFlicenseAqualityAn MCP server that enables users to generate summaries of YouTube videos in multiple languages and formats through integration with DeepSRT's API.Last updated -2544
- AsecurityFlicenseAqualityA lightweight MCP service that enables programmatic downloading of Instagram videos to a specified local path with progress tracking.Last updated -13
- AsecurityFlicenseAqualityAn MCP server that provides AI assistants with powerful tools to interact with YouTube, including video searching, transcript extraction, comment retrieval, and more.Last updated -818
- -securityAlicense-quality- Upload videos to YouTube from MCP - Client(Claude/Cursor/VS Code) - OAuth2 authentication flow - Access token and refresh token management - Multi Channel SupportLast updated -22MIT License