Content & Image Generation MCP Server

Content & Image Generation MCP Server

AI-powered content and image generation server with Google Imagen 3/4 for images, Veo 2/3 for videos, and Claude/Gemini for marketing copywriting, including batch processing, cost estimation, and campaign planning tools.

Category
访问服务器

README

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!

Deploy to FastMCP Cloud Python 3.10+ FastMCP

Quick Links

Features

Tools

  1. 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
  2. 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
  3. batch_generate_images - Generate multiple images efficiently

    • Batch processing for campaigns
    • Cost tracking across multiple images
    • Consistent quality and style
    • Detailed success/failure reporting
  4. 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
  5. 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
  6. 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

  1. Create a Google Cloud project at https://console.cloud.google.com
  2. Enable the Vertex AI API
  3. Create a service account with Vertex AI permissions
  4. Download the service account key JSON file
  5. 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

  1. Never hardcode API keys - Always use environment variables
  2. Use .env for local development - Never commit .env to git
  3. Rotate credentials regularly - Especially for production use
  4. Set up cost alerts - Monitor Google Cloud and Anthropic usage
  5. Use service accounts with minimal permissions - Follow principle of least privilege

Deployment

FastMCP Cloud (Recommended)

Quick Deployment: Deploy to production in 5 minutes!

  1. Visit: https://cloud.fastmcp.com
  2. Sign in with GitHub
  3. Create new project:
    • Repository: vanman2024/content-image-generation-mcp
    • Entrypoint: server.py:mcp
  4. Set environment variable: GOOGLE_API_KEY=<your-key>
  5. Deploy

Your server will be available at:

https://content-image-generation-mcp.fastmcp.app/mcp

Full Documentation:

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:

  1. Check the FastMCP documentation
  2. Review Google Cloud Vertex AI docs
  3. Verify API credentials and quotas
  4. 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.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选