Skip to main content
Glama
ECNU3D

Universal Image Generator MCP Server

by ECNU3D

Universal Image Generator MCP Server

PyPI version License Python versions

This project is a fork and rewrite of the original: https://github.com/qhdrl12/mcp-server-gemini-image-generator repo.

Multi-provider AI image generation server for MCP clients. Generate high-quality images using Google (Imagen & Gemini), ZHIPU AI CogView-4, or Alibaba Bailian through any MCP-compatible application.

Features

  • Multi-Provider Support: Choose between Google (Imagen/Gemini), ZhipuAI, or Bailian

  • Image Generation: Text-to-image for all providers

  • Image Transformation: Edit existing images (Google & Bailian only)

  • Smart Language Optimization: Automatic prompt translation and optimization

  • Local Storage: Save generated images to your specified directory

Related MCP server: universal-image-mcp

Quick Setup

1. Install via uvx

No manual installation required! The server will be automatically downloaded and run.

2. Get API Keys

Choose one provider and get an API key:

3. Configure MCP Client

Add to your MCP client configuration (e.g., claude_desktop_config.json):

{
    "mcpServers": {
        "universal-image-generator": {
            "command": "uvx",
            "args": [
                "universal-image-generator-mcp"
            ],
            "env": {
                "IMAGE_PROVIDER": "google",
                "GOOGLE_MODEL": "gemini",
                "ZHIPU_API_KEY": "your-api-key-here",
                "GEMINI_API_KEY": "your-api-key-here",
                "DASHSCOPE_API_KEY": "your-api-key-here",
                "OUTPUT_IMAGE_PATH": "/path/to/save/images"
            }
        }
    }
}

Environment Variables:

  • IMAGE_PROVIDER: "google", "zhipuai", or "bailian"

  • GOOGLE_MODEL: "gemini" or "imagen" (only for Google provider, defaults to "gemini")

  • Set the corresponding API key for your chosen provider

  • OUTPUT_IMAGE_PATH: Directory to save generated images (optional)

Available Tools

generate_image_from_text

Create images from text descriptions.

generate_image_from_text(prompt: str, model_type: Optional[str] = None) -> str

Parameters:

  • prompt: Text description of the image to generate

  • model_type: Optional model selection for Google provider ("gemini" or "imagen")

    • Only applies to Google provider

    • If not specified, uses GOOGLE_MODEL environment variable (defaults to "gemini")

transform_image_from_encoded (Google & Bailian only)

Transform images using base64-encoded image data.

transform_image_from_encoded(encoded_image: str, prompt: str) -> str

transform_image_from_file (Google & Bailian only)

Transform existing image files.

transform_image_from_file(image_file_path: str, prompt: str) -> str

Usage Examples

Once configured, ask your AI assistant:

  • "Generate an image of a sunset over mountains"

  • "Create a 3D rendered flying pig in a sci-fi city"

  • "Transform this image by adding snow to the scene"

Generated images are saved to your configured output directory.

Example Output

Prompt: "Create a 3D rendered image of a pig with wings and a top hat flying over a futuristic sci-fi city with lots of greenery"

Flying pig over sci-fi city

Transform: "Add a cute baby whale flying alongside the pig"

Flying pig with baby whale

Provider Capabilities

Provider

Models

Generation

Transformation

Language Optimization

Google

Imagen, Gemini

✅ (Gemini only)

English prompts

ZhipuAI

CogView-4

Chinese prompts

Bailian

WanX-2.1

Chinese prompts

Note: For Google provider, image transformation is only supported with Gemini models. Imagen is for generation only.

Development

Test the server locally:

git clone https://github.com/ECNU3D/universal-image-generator-mcp.git
cd universal-image-generator-mcp
fastmcp dev src/universal_image_generator_mcp/server.py

Visit http://localhost:5173/ to use the MCP Inspector for testing.

License

MIT License

Available Tools

4 tools
generate_image_from_textA

Generate an image based on the given text prompt using the configured image provider.

Args:
    prompt: User's text prompt describing the desired image to generate
    model_type: Optional model type for Google provider ("gemini" or "imagen"). 
               If not specified, uses the default from GOOGLE_MODEL env var.
    
Returns:
    Path to the generated image file using the configured provider's image generation capabilities
ParametersJSON Schema
NameRequiredDescriptionDefault
promptYes
model_typeNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool 'generates' an image, implying a write/mutation operation, and notes it uses a 'configured image provider' with optional model types. However, it lacks details on permissions, rate limits, error handling, or what 'configured' entails. The description adds some context but leaves significant behavioral aspects unspecified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded, starting with the core purpose, followed by Args and Returns sections. Each sentence adds value: the first states the action, the second explains parameters with useful details, and the third specifies the return value. There is no wasted text, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (image generation with provider configuration), no annotations, and an output schema (implied by the Returns section), the description is reasonably complete. It covers the purpose, parameters, and return value. However, it could benefit from more behavioral context (e.g., provider setup, limitations) to fully address the tool's operational aspects, though the output schema reduces the need for return value details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds substantial meaning beyond the input schema, which has 0% description coverage. It explains that 'prompt' is the 'User's text prompt describing the desired image to generate' and clarifies 'model_type' as an 'Optional model type for Google provider' with values 'gemini' or 'imagen,' including default behavior. This fully compensates for the schema's lack of descriptions, providing clear semantics for both parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Generate an image based on the given text prompt using the configured image provider.' It specifies the verb (generate), resource (image), and input source (text prompt). However, it doesn't explicitly differentiate from sibling tools like transform_image_from_file or transform_image_from_url, which appear to handle different input types rather than text-to-image generation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through phrases like 'based on the given text prompt' and 'using the configured image provider,' suggesting this tool is for text-to-image generation. However, it doesn't explicitly state when to use this tool versus its siblings (e.g., transform_image_from_file for file-based inputs) or provide any exclusion criteria. The guidance is present but not comprehensive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

transform_image_from_encodedA

Transform an existing image based on the given text prompt using the configured image provider.

    Args:
        encoded_image: Base64 encoded image data with header. Must be in format:
                    "data:image/[format];base64,[data]"
                    Where [format] can be: png, jpeg, jpg, gif, webp, etc.
        prompt: Text prompt describing the desired transformation or modifications
        
    Returns:
        Path to the transformed image file saved on the server
    
ParametersJSON Schema
NameRequiredDescriptionDefault
encoded_imageYes
promptYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It explains the transformation process and output format ('Path to the transformed image file saved on the server'), but doesn't mention important behavioral aspects like rate limits, authentication requirements, file size limits, transformation time, error conditions, or what happens to the original image. For a tool with no annotations, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (purpose, Args, Returns) and every sentence adds value. It could be slightly more concise by combining some formatting details, but overall it's efficiently organized and front-loaded with the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (image transformation with specific input requirements), no annotations, and an output schema (implied by 'Returns' statement), the description does a good job covering the essentials. It explains the transformation process, input format requirements, and output format. However, it lacks information about behavioral constraints and error handling that would be important for complete understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description fully compensates by providing detailed semantic information for both parameters. It specifies the exact format required for encoded_image ('Base64 encoded image data with header' with specific format examples) and explains what prompt represents ('Text prompt describing the desired transformation or modifications'). This adds substantial value beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Transform an existing image based on the given text prompt using the configured image provider.' This specifies the verb ('transform'), resource ('existing image'), method ('based on text prompt'), and distinguishes it from sibling tools like generate_image_from_text (creates new images) and transform_image_from_file/url (different input methods).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidance by specifying the input method ('Base64 encoded image data') and distinguishing this tool from its siblings. The context of sibling tools (generate_image_from_text, transform_image_from_file, transform_image_from_url) makes it clear when to use this specific tool versus alternatives based on input format.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

transform_image_from_fileA

Transform an existing image file based on the given text prompt using the configured image provider.

    Args:
        image_file_path: Path to the image file to be transformed
        prompt: Text prompt describing the desired transformation or modifications
        
    Returns:
        Path to the transformed image file saved on the server
    
ParametersJSON Schema
NameRequiredDescriptionDefault
image_file_pathYes
promptYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that the tool transforms an image based on a prompt and returns a file path, but does not cover critical aspects such as required permissions, rate limits, supported file formats, or potential side effects like overwriting files. It adds some context but leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose in the first sentence, followed by structured Args and Returns sections. Every sentence adds value, though the formatting with indentation is slightly verbose but still efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (image transformation with 2 parameters), no annotations, and an output schema present (which covers return values), the description is fairly complete. It explains the purpose, parameters, and return value, but could improve by addressing behavioral traits like error handling or provider-specific details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description explicitly lists and explains both parameters (image_file_path and prompt) in the Args section, adding meaning beyond the input schema which has 0% description coverage. This compensates well for the schema's lack of descriptions, though it could provide more details like format constraints or examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verb ('Transform') and resource ('existing image file'), and distinguishes it from siblings by specifying it works from a file path rather than text, encoded data, or URL inputs like the sibling tools generate_image_from_text, transform_image_from_encoded, and transform_image_from_url.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by mentioning 'based on the given text prompt' and 'using the configured image provider,' but does not explicitly state when to use this tool versus alternatives like the sibling tools. It lacks clear exclusions or direct comparisons to other transformation methods.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

transform_image_from_urlB

Transform an existing image from a URL using the configured image provider.

    Args:
        image_url: Remote or Public URL of the image to be transformed
        prompt: Text prompt describing the desired transformation or modifications
        function: WanX editing function (default: 'description_edit'). Supported functions:
                 'description_edit', 'description_edit_with_mask', 'stylization_all', 
                 'stylization_local', 'remove_watermark', 'expand', 'super_resolution', 
                 'colorization', 'doodle', 'control_cartoon_feature'
        mask_image_url: URL of mask image (required for 'description_edit_with_mask')
        
    Returns:
        Details about the transformed image including local path and remote URL
    
ParametersJSON Schema
NameRequiredDescriptionDefault
image_urlYes
promptYes
functionNodescription_edit
mask_image_urlNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that the tool uses a 'configured image provider' and lists supported functions, but lacks details on permissions, rate limits, error handling, or what 'transform' entails (e.g., whether it modifies the original or creates a new image). The description adds some context but is insufficient for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, starting with the core purpose followed by parameter details in a structured format. Every sentence adds value, such as explaining parameter roles and listing function options. However, the inclusion of 'Args:' and 'Returns:' sections, while helpful, adds some redundancy as this information is partially covered in the schema and output schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (image transformation with multiple parameters), no annotations, and an output schema (which handles return values), the description is moderately complete. It covers the purpose and parameters well but lacks behavioral context like error cases or provider-specific details. The output schema reduces the need to explain returns, but more guidance on usage and transparency would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds significant meaning beyond the input schema, which has 0% description coverage. It explains each parameter's purpose: 'image_url' as the source image URL, 'prompt' for describing transformations, 'function' with default and supported options, and 'mask_image_url' as required for a specific function. This compensates well for the schema's lack of descriptions, though it doesn't detail format constraints (e.g., URL validity).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Transform an existing image from a URL using the configured image provider.' It specifies the verb ('transform'), resource ('image from a URL'), and method ('using the configured image provider'), which distinguishes it from sibling tools like 'generate_image_from_text' (creation from text) and 'transform_image_from_file' (transformation from a file). However, it doesn't explicitly differentiate from 'transform_image_from_encoded' (transformation from encoded data), leaving some ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions sibling tools in the context signals but offers no explicit comparisons, prerequisites, or scenarios for choosing this tool over others like 'transform_image_from_file' or 'transform_image_from_encoded'. Usage is implied through the description of parameters, but no clear when/when-not instructions are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv1.0.0
    • Changedgenerate_image_from_text1 field changed
      • addedInput schema / title
        Added value: +"generate_image_from_textArguments"
    • Changedtransform_image_from_encoded1 field changed
      • addedInput schema / title
        Added value: +"transform_image_from_encodedArguments"
    • Changedtransform_image_from_file1 field changed
      • addedInput schema / title
        Added value: +"transform_image_from_fileArguments"
    • Changedtransform_image_from_url1 field changed
      • addedInput schema / title
        Added value: +"transform_image_from_urlArguments"
  2. 4 tool updates
    • First observedgenerate_image_from_text
    • First observedtransform_image_from_encoded
    • First observedtransform_image_from_file
    • First observedtransform_image_from_url

TDQS

A3.8/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose with no ambiguity. 'generate_image_from_text' creates new images from scratch, while the three 'transform_image_from_*' tools all modify existing images but differ in their input sources (encoded data, local file, URL). The descriptions clearly differentiate these input methods, preventing misselection.

Naming Consistency5/5

All four tools follow a perfect verb_object_from_source pattern: 'generate_image_from_text', 'transform_image_from_encoded', 'transform_image_from_file', and 'transform_image_from_url'. This consistent naming convention makes the tool purposes immediately understandable and predictable.

Tool Count4/5

Four tools is reasonable for an image generation/transformation server, though slightly minimal. The set covers core functionality well, but could potentially benefit from additional utilities like image analysis or format conversion tools. The count is appropriate for the basic scope presented.

Completeness4/5

The tool surface covers the essential workflows for image generation and transformation comprehensively. It provides multiple input methods for transformations (encoded, file, URL) which is thorough. A minor gap exists in not having a dedicated tool for pure image analysis or metadata extraction, but the core functionality is well-covered.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers