loading…
Search for a command to run...
loading…
An MCP server for image generation, editing, and analysis using OpenAI's gpt-image-1 model, with specialized templates for YouTube thumbnails, blog headers, soc
An MCP server for image generation, editing, and analysis using OpenAI's gpt-image-1 model, with specialized templates for YouTube thumbnails, blog headers, social media, and more.
PyPI version Python versions License: MIT CI MCP

A Model Context Protocol (MCP) server for image generation, editing, and analysis powered by OpenAI's gpt-image-1 model. Built with FastMCP — generate YouTube thumbnails, blog headers, social media images, or any custom image, with optional reference-image support and platform-aware optimization.
pip install gpt-image-mcp
# or
uv add gpt-image-mcp
Set OPENAI_API_KEY in your environment, then run:
gpt-image-mcp
🎯 Perfect for Content Creators: Generate professional thumbnails with your photo automatically positioned and branded consistently, or get creative when you want variety.
# Clone the repository
git clone https://github.com/labeveryday/gpt-image-mcp.git
cd gpt-image-mcp
# Install dependencies
uv sync
# Configure your API key
cp .env.example .env
# Edit .env and add: OPENAI_API_KEY=your_key_here
# Test the installation
uv run python demo.py
This server is designed to work with MCP clients like Claude Code. Add it to your MCP configuration:
{
"name": "gpt-image-mcp",
"command": "uv",
"args": ["run", "gpt-image-mcp"],
"cwd": "/path/to/gpt-image-mcp"
}
Once connected, you can simply ask Claude:
🎯 "Generate a YouTube thumbnail for my Python tutorial"
→ Creates professional thumbnail (default strict mode)
🎨 "Generate a creative YouTube thumbnail with me centered"
→ Uses creative mode with centered composition
📸 "Generate a thumbnail using my photo with 'LEARN CODING' text"
→ Uses reference image with professional layout
🚀 "Be experimental with the layout and try something artistic"
→ Uses experimental creative mode for unique designs
# Start with UV (recommended)
uv run gpt-image-mcp
# Or run the server directly
uv run python src/gpt_image_mcp/server.py
# Run the demo to test functionality
uv run python demo.py
# Test individual features
uv run python -c "from demo import demo_youtube_thumbnail; import asyncio; asyncio.run(demo_youtube_thumbnail())"
generate_image - Primary Image GenerationGenerate optimized images for any platform or purpose.
{
"prompt": "Excited tech reviewer with the latest gadget, studio lighting",
"content_type": "youtube_thumbnail",
"style": "professional",
"emotional_tone": "excited",
"size": "1536x1024",
"include_text_overlay": true,
"text_overlay": "Amazing New Tech!",
"brand_colors": ["#FF6B6B", "#4ECDC4"],
"reference_image": "/path/to/your/photo.jpg", // File path or base64 data
"creative_mode": false,
"composition_style": "right",
"layout_freedom": "standard"
}
generate_reference_thumbnail - Personal BrandingCreate thumbnails using your photo in your established style.
{
"reference_image": "/Users/me/photos/headshot.png", // File path or base64 data
"main_text": "5 TECH SIDE HUSTLES",
"secondary_text": "THAT MAKE $10K/MONTH",
"topic": "entrepreneurship",
"style_override": "professional",
"creative_mode": false,
"composition_style": "right",
"layout_freedom": "standard"
}
analyze_thumbnail - AI-Powered AnalysisGet effectiveness scores and improvement suggestions.
{
"image_data": "base64_encoded_image_data",
"platform": "youtube",
"content_category": "education"
}
optimize_for_platform - Platform ConversionAdapt existing images for different platforms.
{
"image_data": "base64_encoded_image_data",
"target_platform": "instagram",
"optimization_focus": ["engagement", "readability"]
}
generate_batch - Bulk GenerationGenerate multiple images efficiently.
{
"requests": [
{"prompt": "Tutorial thumbnail 1", "content_type": "youtube_thumbnail"},
{"prompt": "Tutorial thumbnail 2", "content_type": "youtube_thumbnail"}
],
"max_concurrent": 3
}
get_prompt_suggestions - Prompt EnhancementGet AI suggestions for better prompts.
{
"content_type": "youtube_thumbnail",
"current_prompt": "Python tutorial video"
}
| Platform | Optimal Size | Aspect Ratio | Notes |
|---|---|---|---|
| YouTube | 1792×1024 | ~16:9 | OpenAI supported landscape |
| 1024×1024 | 1:1 | Square format | |
| 1792×1024 | ~16:9 | Wide landscape format | |
| 1792×1024 | ~16:9 | Cover images | |
| Blog Header | 1792×1024 | ~16:9 | Professional headers |
| Blog Featured | 1024×1792 | ~9:16 | Portrait format |
All sizes use OpenAI's currently supported dimensions: 1024×1024, 1024×1792, and 1792×1024.
Reference images can be provided as either file paths or base64 encoded data:
// Using file paths (recommended - automatic resizing)
"reference_image": "/Users/you/photos/headshot.jpg"
"reference_image": "./images/profile.png"
"reference_image": "/home/user/pictures/photo.jpg"
// Using base64 data (backward compatibility)
"reference_image": "iVBORw0KGgoAAAANSUhEUgAA..."
youtube_thumbnail - High-impact video thumbnails (auto-optimized under 2MB)blog_header - Professional article headersblog_featured - Featured/hero images social_media - General social contentgeneral - Flexible general-purpose imagesprofessional - Clean, business-appropriatecasual - Relaxed, approachabledramatic - High-contrast, boldminimalist - Simple, eleganteducational - Clear, instructionalentertainment - Fun, engagingexcited - High energy, enthusiasticconfident - Strong, authoritative friendly - Warm, approachablecurious - Intriguing, mysteriousserious - Professional, formalsurprised - Attention-grabbingdramatic - Intense, compelling🔒 DEFAULT: Strict Professional Mode
creative_mode=False (default) - Consistent, reliable professional layouts🎨 CREATIVE MODE: When You Want Variety
creative_mode=True - Unlocks flexible and experimental optionsstandard - Consistent branding (same as strict mode)flexible - Some creative freedom while maintaining best practices experimental - Complete creative freedom with unconventional designsleft - Position person on the left sideright - Position person on the right side centered - Center the person prominentlydynamic - Use energetic, dynamic positioningcreative - Experiment with artistic composition techniques# Professional consistency (RECOMMENDED DEFAULT)
# Just use the tool without creative parameters
# Creative with structure
creative_mode=True, layout_freedom="flexible", composition_style="centered"
# Full creative freedom
creative_mode=True, layout_freedom="experimental", composition_style="creative"
Generated images are automatically saved to cross-platform temporary directories:
/var/folders/.../gpt-image-mcp/C:\Users\{user}\AppData\Local\Temp\gpt-image-mcp\ /tmp/gpt-image-mcp/Automatic Cleanup:
cleanup_temp_files toolimage_20250825_142324_3566695c.pngManual Management:
# Check temp directory status
uv run python -c "from src.gpt_image_mcp.file_manager import temp_image_manager; print(temp_image_manager.get_temp_dir_info())"
# Clean up old files manually
uv run python -c "from src.gpt_image_mcp.file_manager import temp_image_manager; print(f'Cleaned {temp_image_manager.cleanup_old_files()} files')"
# Required
OPENAI_API_KEY=your_openai_api_key
# Optional - Model Configuration
DEFAULT_MODEL=gpt-image-1 # Primary model (OpenAI's best)
IMAGE_MODEL=gpt-image-1 # Direct image model
FALLBACK_MODEL=dall-e-3 # Fallback option
# Optional - Performance
MAX_CONCURRENT_GENERATIONS=5 # Batch processing limit
TIMEOUT_SECONDS=120 # Request timeout
RATE_LIMIT_PER_MINUTE=30 # API rate limiting
# Optional - Quality
DEFAULT_QUALITY=auto # Image quality
ENABLE_COMPRESSION=true # File size optimization
MAX_IMAGE_SIZE_MB=10.0 # Size limits
# Optional - Logging
LOG_LEVEL=INFO # DEBUG for verbose logging
ENABLE_DETAILED_LOGGING=false # Request/response logging
Simply ask Claude naturally - the MCP server will handle the technical details:
👤 "Generate a YouTube thumbnail for my Python tutorial with 'MASTER PYTHON FAST' text"
🤖 Claude creates professional thumbnail with:
- Your photo positioned on the right
- Bold white text on the left
- Red banner for emphasis
- Professional dark background
👤 "Be creative with the layout and center me in the composition"
🤖 Claude uses creative_mode=True, composition_style="centered" for artistic variety
👤 "Generate 5 different thumbnail variations for my coding series"
🤖 Claude uses batch generation with different styles and compositions
Professional Consistent Thumbnail (Default)
{
"prompt": "Professional YouTube thumbnail about Python programming",
"content_type": "youtube_thumbnail",
"text_overlay": "MASTER PYTHON FAST!",
"reference_image": "base64_encoded_headshot"
}
Creative Experimental Thumbnail
{
"prompt": "Creative coding tutorial thumbnail",
"content_type": "youtube_thumbnail",
"text_overlay": "CODE CREATIVELY",
"reference_image": "base64_encoded_headshot",
"creative_mode": true,
"layout_freedom": "experimental",
"composition_style": "dynamic"
}
request = {
"prompt": "Enthusiastic developer coding Python, modern setup, vibrant colors",
"content_type": "youtube_thumbnail",
"style": "professional",
"emotional_tone": "excited",
"text_overlay": "Master Python Fast!",
"brand_colors": ["#3776ab", "#ffd343"] # Python colors
}
request = {
"prompt": "Modern digital workspace with analytics and growth charts",
"content_type": "blog_header",
"topic": "business growth",
"target_audience": "entrepreneurs",
"style": "professional"
}
request = {
"prompt": "Cozy coffee shop workspace with laptop and notebook",
"content_type": "social_media",
"style": "casual",
"emotional_tone": "friendly",
"size": "1024x1024" # Instagram square
}
# Test with sample superhero image
uv run examples/superhero_thumbnail_test.py
# Test with your own photo
uv run examples/test_reference_thumbnail.py /path/to/your/photo.jpg
# Demo creative mode options (no API calls)
uv run examples/demo_creative_modes.py
# Test all creative modes (requires API key)
uv run examples/test_creative_modes.py
# Run demo for general testing
uv run python demo.py
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=src/gpt_image_mcp
# Test specific functionality
uv run python demo.py
# Format code
uv run black src/ tests/
# Lint code
uv run ruff check src/ tests/
# Type checking
uv run mypy src/
# Start in development mode with detailed logging
LOG_LEVEL=DEBUG ENABLE_DETAILED_LOGGING=true uv run python src/gpt_image_mcp/server.py
import asyncio
from mcp import ClientSession, stdio_client, StdioServerParameters
async def generate_thumbnail():
async with stdio_client(StdioServerParameters(
command="uv", args=["run", "gpt-image-mcp"]
)) as (read, write):
async with ClientSession(read, write) as client:
result = await client.call_tool("generate_image", {
"prompt": "Amazing tech review thumbnail",
"content_type": "youtube_thumbnail"
})
return result
# Run it
result = asyncio.run(generate_thumbnail())
The server integrates seamlessly with Claude Code for AI-powered content creation workflows.
API Key Errors
# Verify your API key is set
echo $OPENAI_API_KEY
# Check API key validity
uv run python -c "import openai; print(openai.api_key)"
Image Generation Fails
Large File Sizes
ENABLE_COMPRESSION=trueDEFAULT_QUALITY=mediumMAX_IMAGE_SIZE_MB=10Rate Limiting
MAX_CONCURRENT_GENERATIONS=3TIMEOUT_SECONDS=180RATE_LIMIT_PER_MINUTE=20# Enable verbose logging
LOG_LEVEL=DEBUG ENABLE_DETAILED_LOGGING=true uv run gpt-image-mcp
# Check server health
uv run python -c "from src.gpt_image_mcp.config import settings; print(settings)"
generate_batch for multiple imagesgit checkout -b feature/amazing-featureuv run black src/ && uv run ruff check src/This project is licensed under the MIT License - see the LICENSE file for details.
docs/ directory for detailed guidesHappy image generating! 🎨✨
Выполни в терминале:
claude mcp add gpt-image-mcp-server -- npx Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.