MCP Image Generation Server

A multi-provider MCP server that generates images from text prompts using Tencent Hunyuan, OpenAI DALL-E 3, and Doubao APIs.
  • python

1

GitHub Stars

python

Language

5 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "christophezhao-image-gen-mcp-server": {
      "command": "D:\\your_path\\image-gen-mcp-server\\.venv\\Scripts\\python.exe",
      "args": [
        "D:\\your_path\\image-gen-mcp-server\\mcp_image_server.py"
      ],
      "env": {
        "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY",
        "DOUBAO_ENDPOINT": "OPTIONAL_DOUBAO_ENDPOINT",
        "OPENAI_BASE_URL": "OPTIONAL_OPENAI_BASE_URL",
        "DOUBAO_ACCESS_KEY": "YOUR_DOUBAO_ACCESS_KEY",
        "DOUBAO_SECRET_KEY": "YOUR_DOUBAO_SECRET_KEY",
        "TENCENT_SECRET_ID": "YOUR_TENCENT_SECRET_ID",
        "MCP_IMAGE_SAVE_DIR": "YOUR_SAVE_DIR",
        "TENCENT_SECRET_KEY": "YOUR_TENCENT_SECRET_KEY"
      }
    }
  }
}

You run an MCP server that enables image generation across multiple AI providers from a single, unified interface. You can create images from text prompts, choose provider and style, set resolution, and rely on automatic provider management to select the best available option.

How to use

You interact with the MCP server through a client that understands MCP endpoints. Use the multi-provider server to generate images from natural language prompts, selecting a specific provider if you prefer, or letting the system pick the best available option automatically. You can request different styles and resolutions and apply negative prompts to exclude unwanted elements. Use provider-specific prompts or a unified prompt format to control style and output.

How to install

Prerequisites: Python is installed in your environment. A Python virtual environment is recommended. You will also need credentials for the image providers you plan to use.

# Prerequisites check
python --version
python -m venv venv

# Activate the virtual environment
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate

# Install dependencies (preferred)
pip install -e .
# Or use the exact locked versions if you have a lock file
pip install -r requirements.lock.txt

Additional setup and configuration

Create a .env file in the project root to configure provider keys and output directory. You only need to configure the providers you intend to use.

TENCENT_SECRET_ID=your_tencent_secret_id
TENCENT_SECRET_KEY=your_tencent_secret_key
MCP_IMAGE_SAVE_DIR=your_saved_img_dir

# If you plan to use additional providers, add their keys here as well
OPENAI_API_KEY=your_openai_api_key
DOUBAO_ACCESS_KEY=your_doubao_access_key
DOUBAO_SECRET_KEY=your_doubao_secret_key
OPENAI_BASE_URL=optional_openai_endpoint
DOUBAO_ENDPOINT=optional_doubao_endpoint

Running the MCP server

Choose the multi-api server to access all providers and enhanced features. Run the server using the Python executable in your virtual environment.

# Multi-API server (recommended)
D:\your_path\image-gen-mcp-server\.venv\Scripts\python.exe \
  D:\your_path\image-gen-mcp-server\mcp_image_server_multi.py

Connecting and using from a client

Connect with an MCP-compatible client to access the following resources and tools. You can query available styles and resolutions and generate images.

# Client usage outline (pseudocode):
client.connect('mcp://localhost:port')
client.styles.list()          # list all styles
client.resolutions.list()       # list all resolutions
client.tools.generate_image(prompt='A futuristic city at dusk', style='hunyuan:saibopengke', resolution='1024x768')

Multi-API Usage examples

Use a single prompt to auto-select the best available provider, or specify a provider explicitly. You can combine prompts with provider-specific styles and resolutions.

# Auto-select best available provider
generate_image(prompt="A cute cat in a garden")

# Specify a provider
generate_image(prompt="A cute cat", provider="openai")
generate_image(prompt="一只可爱的小猫", provider="hunyuan")
generate_image(prompt="Cute kitten", provider="doubao")

Advanced parameter usage

You can use provider-specific styles and resolutions, mix provider selection with standard parameters, and request high-resolution outputs.

# Use provider-specific styles and resolutions
generate_image(
  prompt="Cyberpunk city skyline",
  style="hunyuan:saibopengke",
  resolution="hunyuan:1024:768"
)

# Mix provider selection with standard parameters
generate_image(
  prompt="Fantasy magical forest",
  provider="doubao",
  style="fantasy",
  resolution="1024x768",
  negative_prompt="low quality, blurry"
)

# OpenAI with high-resolution output
generate_image(
  prompt="Artistic portrait of a musician",
  provider="openai",
  style="artistic",
  resolution="1792x1024"
)

Providers and parameters at a glance

Tencent Hunyuan offers 18 styles and 8 resolutions with Chinese-optimized artistic output. OpenAI DALL-E 3 provides high-quality images with English optimization and high-resolution options. Doubao balances quality and speed with 12 styles and 9 resolutions.

Cursor integration notes

To add this MCP server in Cursor, configure it as a stdio MCP server with the appropriate command path to Python and the script, and supply the necessary environment variables.

Troubleshooting

If you encounter issues, verify environment variables, ensure the virtual environment is active, and confirm the startup command is correct. Check that the server script is reachable and executable.

API Reference and tools

The MCP provides a unified interface to multiple image generation APIs with endpoints to list providers, styles, and resolutions, and a core tool to generate images across providers.

Available tools

generate_image

Core function to generate images across providers using a unified parameter interface

image_generation_prompt

Template tool to craft prompts for image generation across providers

providers/list

List available image providers in MCP

styles/list

List styles available per provider in MCP

resolutions/list

List resolutions available per provider in MCP

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational