Content & Image Generation MCP Server
AI-powered content and image generation FastMCP server with Google Imagen 3/4 image generation, Veo 2/3 video generation, and Claude/Gemini content generation.
Production Ready: Deploy to FastMCP Cloud in 5 minutes!
Quick Links
- 5-Minute Deployment Guide - Get started fast
- Complete Deployment Guide - Detailed instructions
- Deployment Checklist - Ensure nothing is missed
Features
Tools
-
health_check - Server health and monitoring
- Verify server health and API connectivity
- Check service availability (Google AI, Anthropic)
- Output directory validation
- Perfect for monitoring deployments
-
generate_image_imagen3 - Generate high-quality marketing images
- Google Imagen 3/4 integration
- Multiple aspect ratios (1:1, 16:9, 9:16, 4:3, 3:4)
- 1K and 2K resolution options
- Negative prompts for better control
- Production-ready with error handling
-
batch_generate_images - Generate multiple images efficiently
- Batch processing for campaigns
- Cost tracking across multiple images
- Consistent quality and style
- Detailed success/failure reporting
-
generate_video_veo3 - Create marketing videos
- Google Veo 3 integration
- Customizable duration (4, 6, 8 seconds)
- 720p and 1080p resolution
- Native audio generation
- Cost estimation per second
-
generate_marketing_content - AI-powered copywriting
- Multiple content types (social posts, blog intros, ad copy, email subjects, product descriptions)
- Choice of Claude Sonnet 4 or Gemini 2.5 Flash Image
- Tone customization (professional, casual, enthusiastic, formal)
- Length control (short, medium, long)
- Optional hashtag generation
-
calculate_cost_estimate - Campaign budget planning
- Detailed cost breakdown by service
- Support for multiple models
- Per-resource pricing
- Campaign planning assistant
Resources
- config://pricing - Current pricing for all services
- config://models - Available AI models and capabilities
Prompts
- campaign_planner - Interactive campaign planning assistant
- image_prompt_enhancer - Optimize image generation prompts
Prerequisites
- Python 3.10+ (required for FastMCP)
- uv or pip package manager
- Google Cloud Account with Vertex AI API enabled
- Anthropic API Key (for Claude content generation)
- Google AI API Key (for Gemini content generation)
Installation
1. Clone or Navigate to Project
cd marketing-automation
2. Create Virtual Environment
Using uv (recommended):
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
Or using standard Python:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
3. Install Dependencies
Using uv:
uv pip install -e .
Or using pip:
pip install -e .
For development with testing tools:
uv pip install -e ".[dev]"
Configuration
1. Set Up Google Cloud
- Create a Google Cloud project at https://console.cloud.google.com
- Enable the Vertex AI API
- Create a service account with Vertex AI permissions
- Download the service account key JSON file
- Set the path to your credentials file
2. Get API Keys
- Anthropic: Get your API key from https://console.anthropic.com
- Google AI: Get your API key from https://makersuite.google.com/app/apikey
3. Create Environment File
Copy the example environment file:
cp .env.example .env
Edit .env with your configuration:
# Google Cloud Configuration
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_CLOUD_LOCATION=us-central1
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-key.json
# Anthropic API Configuration
ANTHROPIC_API_KEY=sk-ant-api03-your-key-here
# Google Generative AI (Gemini)
GOOGLE_API_KEY=your-google-ai-api-key
# Server Configuration
MCP_SERVER_NAME=Marketing Automation
MCP_SERVER_PORT=8000
Important: Never commit the .env file with real credentials!
Usage
Local Development (STDIO for Claude Desktop)
Run the server in STDIO mode:
python server.py
Or using FastMCP CLI:
fastmcp run server.py
HTTP Server for Deployment
Run the server in HTTP mode:
python server.py --http
The server will start on http://0.0.0.0:8000
Claude Desktop Integration
Add to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"marketing-automation": {
"command": "python",
"args": [
"/absolute/path/to/marketing-automation/server.py"
],
"env": {
"GOOGLE_CLOUD_PROJECT": "your-project-id",
"GOOGLE_CLOUD_LOCATION": "us-central1",
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account-key.json",
"ANTHROPIC_API_KEY": "sk-ant-api03-your-key",
"GOOGLE_API_KEY": "your-google-ai-key"
}
}
}
}
Note: Use absolute paths for both the server script and credentials file.
Example Usage
Generate a Marketing Image
# Via Claude Desktop or MCP client
generate_image_imagen3(
prompt="Professional product photography of a luxury watch, white background, studio lighting, high detail, commercial quality",
aspect_ratio="1:1",
quality="hd"
)
Batch Generate Images for Campaign
batch_generate_images(
prompts=[
"Modern tech startup office, collaborative workspace, natural light",
"Smartphone app interface, clean design, user-friendly",
"Happy customers using product, lifestyle photography"
],
quality="hd",
aspect_ratio="16:9"
)
Generate Marketing Copy
generate_marketing_content(
content_type="social_post",
topic="Launch of new AI-powered analytics platform",
tone="enthusiastic",
length="medium",
model="claude",
include_hashtags=True
)
Estimate Campaign Costs
calculate_cost_estimate(
images_hd=10,
images_sd=20,
video_seconds=30,
content_pieces=15
)
Pricing
Approximate costs (as of October 2025):
| Service | Cost |
|---|---|
| Imagen 3 SD | $0.020 per image |
| Imagen 3 HD | $0.040 per image |
| Imagen 4 SD | $0.025 per image |
| Imagen 4 HD | $0.050 per image |
| Veo 2 | $0.15 per second |
| Veo 3 | $0.20 per second |
| Claude Sonnet | $0.003 per 1K tokens |
| Gemini Pro | $0.0005 per 1K tokens |
Use calculate_cost_estimate tool for detailed budget planning.
Output Directory
Generated content is saved to the output/ directory:
- Images:
output/imagen3_YYYYMMDD_HHMMSS.png - Videos:
output/veo3_YYYYMMDD_HHMMSS.mp4
Security Best Practices
- Never hardcode API keys - Always use environment variables
- Use .env for local development - Never commit
.envto git - Rotate credentials regularly - Especially for production use
- Set up cost alerts - Monitor Google Cloud and Anthropic usage
- Use service accounts with minimal permissions - Follow principle of least privilege
Deployment
FastMCP Cloud (Recommended)
Quick Deployment: Deploy to production in 5 minutes!
- Visit: https://cloud.fastmcp.com
- Sign in with GitHub
- Create new project:
- Repository:
vanman2024/content-image-generation-mcp - Entrypoint:
server.py:mcp
- Repository:
- Set environment variable:
GOOGLE_API_KEY=<your-key> - Deploy
Your server will be available at:
https://content-image-generation-mcp.fastmcp.app/mcp
Full Documentation:
- Quick Start Guide - 5-minute deployment
- Complete Deployment Guide - Detailed instructions
- Deployment Checklist - Step-by-step checklist
Validation (optional but recommended):
./scripts/validate-deployment.sh
Production Features
Your deployment includes:
- ✅ Structured logging with configurable levels
- ✅ Health check endpoint for monitoring
- ✅ Error handling and API validation
- ✅ Automatic redeployment on git push
- ✅ Zero-downtime deployments
- ✅ Cost tracking and estimation
IDE Integration
After deploying, connect from your IDE:
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"content-image-generation": {
"url": "https://content-image-generation-mcp.fastmcp.app/mcp",
"transport": "sse"
}
}
}
Cursor (.cursor/mcp_config.json):
{
"mcpServers": {
"content-image-generation": {
"url": "https://content-image-generation-mcp.fastmcp.app/mcp",
"transport": "sse"
}
}
}
Alternative Deployment Options
Local Development (STDIO):
python server.py
# or
fastmcp run server.py
HTTP Server:
python server.py --http
# Server runs on http://0.0.0.0:8000
Docker:
FROM python:3.10-slim
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
ENV GOOGLE_API_KEY=""
CMD ["python", "server.py", "--http"]
Build and run:
docker build -t content-image-generation-mcp .
docker run -p 8000:8000 -e GOOGLE_API_KEY=your_key content-image-generation-mcp
Troubleshooting
Import Errors
# Reinstall dependencies
uv pip install --force-reinstall -e .
Google Cloud Authentication
# Verify credentials
gcloud auth application-default login
# Check project
gcloud config get-value project
API Key Issues
# Verify environment variables are loaded
python -c "import os; from dotenv import load_dotenv; load_dotenv(); print(os.getenv('ANTHROPIC_API_KEY'))"
Development
Run Tests
pytest tests/
Code Formatting
black server.py
ruff check server.py
Add New Tools
Follow FastMCP patterns:
@mcp.tool()
def my_new_tool(param: str) -> Dict[str, Any]:
"""Tool description for LLM"""
return {"success": True, "result": param}
Resources
- FastMCP Documentation: https://gofastmcp.com
- Google Vertex AI: https://cloud.google.com/vertex-ai/docs
- Anthropic Claude: https://docs.anthropic.com
- Google Gemini: https://ai.google.dev
Support
For issues or questions:
- Check the FastMCP documentation
- Review Google Cloud Vertex AI docs
- Verify API credentials and quotas
- Check the
output/directory for generated files
License
Apache 2.0
Built with FastMCP 2.13.0 - The fast, Pythonic way to build MCP servers.
