Skip to main content
Glama
Image Gen MCP

Image Gen MCP

by s4shibam

โšก Introduction

Image Gen MCP is a STDIO MCP server for generating images with OpenAI and Google Gemini. It lets AI coding tools create image assets and save them directly inside your project, without a separate image generation workflow or manual downloads.

Related MCP server: mcp-image

โœจ Features

  • ๐Ÿง  Two AI providers - Generate images with OpenAI or Google Gemini

  • ๐Ÿ–ผ๏ธ Batch generation - Create several images in one request, with up to 10 jobs running at once

  • ๐ŸŽจ Image controls - Set size, quality, aspect ratio, format, and background when supported by the model

  • ๐Ÿ’พ Explicit file output - Save generated images to a required absolute directory

  • ๐Ÿท๏ธ Clear filenames - Files include the requested name, provider, model, and timestamp

  • ๐Ÿ“‹ Useful results - Get a summary of saved files and any jobs that failed

โš™๏ธ Tech Stack

  • Language - TypeScript

  • Runtime - Node.js 20 or newer

  • MCP - Model Context Protocol server over STDIO

  • AI SDKs - OpenAI and Google Gen AI

  • Validation - Zod

  • Build tools - tsup and Biome

๐Ÿ“ฆ Installation

Requirements:

  • Node.js 20 or newer

  • An OpenAI API key, a Gemini API key, or both

  • An MCP-compatible client

Add the following server configuration to your MCP client. The exact location of this configuration depends on the client.

{
  "mcpServers": {
    "image-gen-mcp": {
      "command": "npx",
      "args": ["-y", "@s4shibam/image-gen-mcp"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "GEMINI_API_KEY": "your-gemini-api-key"
      }
    }
  }
}

You only need the API key for the provider you want to use. You can also place the keys in a .env file in the workspace where the MCP server runs:

OPENAI_API_KEY=your-openai-api-key
GEMINI_API_KEY=your-gemini-api-key

๐Ÿš€ Quick Start

After connecting the server, ask your MCP client to create an image. For example:

Use Gemini model gemini-3.1-flash-image to create a 16:9 hero image for a coffee shop website. Save it as coffee-shop-hero in /Users/you/projects/coffee-shop/assets/images.
Use OpenAI model gpt-image-2 to create three square product icons and save them in /Users/you/projects/store/assets/images.

Every tool call must include absolute_output_directory. Relative paths are rejected, so the MCP server never depends on its process working directory.

Tools

Tool

Description

Main options

generate_image_openai

Generate one or more images with the OpenAI Image API

model, images, absolute_output_directory, size, quality, output_format, background

generate_image_gemini

Generate one or more images with the Gemini Interactions API

model, images, absolute_output_directory, aspect_ratio, image_size, mime_type

Each item in images needs:

  • prompt - What the image should contain

  • filename - Base filename without an extension

๐Ÿ“š Notes

Output files

absolute_output_directory is required and must be an absolute directory path. The directory is created when it does not exist. For example:

/Users/you/projects/coffee-shop/assets/images

Files use this format:

{filename}-{provider}-{model}-{timestamp}.{ext}

Example:

coffee-shop-hero-gemini-gemini-3.1-flash-image-1784412779099.jpg

Provider options

  • OpenAI supports model-specific settings such as size, quality, output format, and background.

  • Gemini supports aspect ratio, image size, and JPEG output.

  • Not every option works with every model. The provider's API rules still apply.

  • If one image in a batch fails, successful images are still saved and the result lists each failure.

๐Ÿ‘‹๐Ÿป Contact

LinkedIn Twitter

Available Tools

2 tools
generate_image_geminiA

Generate one or more images with Google Gemini (Nano Banana) via the Interactions API and save them to disk.

Use this when the user (or your plan) needs Gemini-generated assets for a website or app. Pass the Gemini image model id (e.g. gemini-3.1-flash-image, gemini-3-pro-image, gemini-2.5-flash-image), a list of prompt + filename pairs, the required absolute_output_directory, and optional response_format settings: aspect_ratio, image_size, mime_type.

Notes:

  • aspect_ratio: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, 1:8, 8:1, 1:4, 4:1.

  • image_size: 512, 1K, 2K, or 4K (uppercase K required).

  • mime_type: currently only image/jpeg is supported.

Images are written only to absolute_output_directory. It must be an absolute path; relative paths are rejected. Each file is named: {filename}-gemini-{model}-{timestamp}.{ext}

Inputs: model (required), images (required), absolute_output_directory (required), mime_type, +2 more.

generate_image_openaiA

Generate one or more images with OpenAI's Image API and save them to disk.

Use this when the user (or your plan) needs OpenAI-generated assets for a website or app. Pass the OpenAI image model id (e.g. gpt-image-2, gpt-image-1.5, gpt-image-1, dall-e-3), a list of prompt + filename pairs, the required absolute_output_directory, and optional settings: size, quality, background, output_format.

Notes:

  • size: standard GPT sizes are 1024x1024, 1536x1024, 1024x1536, or auto; gpt-image-2 also allows arbitrary WIDTHxHEIGHT (divisible by 16).

  • quality: low/medium/high/auto for GPT image models; standard/hd for dall-e-3.

  • background: transparent/opaque/auto; transparent is unsupported on gpt-image-2 and requires png or webp.

  • output_format: png, jpeg, or webp (GPT image models only).

Images are written only to absolute_output_directory. It must be an absolute path; relative paths are rejected. Each file is named: {filename}-openai-{model}-{timestamp}.{ext}

Inputs: model (required), images (required), absolute_output_directory (required), size, +3 more.

Tool Schema Changelog

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

Loading tool schema changelogโ€ฆ

    TDQS

    A4.2/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools are clearly distinct: one generates images via Gemini, the other via OpenAI. Each has unique parameters (model lists, size formats, settings) that make selection unambiguous based on which provider the agent needs.

    Naming Consistency5/5

    Both tools follow a consistent generate_image_{provider} pattern with snake_case naming. The verb 'generate' and noun 'image' are used uniformly, with the provider suffix distinguishing them clearly.

    Tool Count4/5

    Two tools is on the thin side for a server, but for a focused image generation purpose, two tools (one per provider) is a reasonable and intentional scope. The slight deduction is for the low count.

    Completeness3/5

    The server covers image generation for two major providers, which covers the core generation workflow. However, there are no complementary operations like listing generated images, deleting them, or fetching generation historyโ€”the surface is purely one-directional (generate and save).

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants in MCP clients to generate and edit images by automatically expanding short requests into detailed prompts with composition, lighting, and camera direction, then saving results to disk. Supports Gemini, OpenAI, and BytePlus Seedream providers with selectable quality presets, aspect ratios, and image sizes.
      1,225 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables users to generate and edit images from MCP-compatible clients by automatically enhancing prompts with details like composition, lighting, and camera angle before sending them to Gemini, OpenAI, or BytePlus Seedream. Supports quality presets, multiple providers, and saving generated images to disk.
      1,225 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants in any MCP client to generate new images or edit existing ones by turning short requests into detailed prompts with configurable quality presets. Supports Gemini, OpenAI GPT Image, and BytePlus Seedream providers, saving results to disk and returning them as MCP resources.
      1,225 npm
      MIT