Skip to main content
Glama
s4shibam

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: Gemini Image MCP

✨ 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}

ParametersJSON Schema
NameRequiredDescriptionDefault
modelYesGemini image model id, e.g. gemini-3.1-flash-image, gemini-3-pro-image, gemini-2.5-flash-image, nano-banana-pro-preview.
imagesYesList of images to generate (prompt + filename)
mime_typeNoOutput MIME type. Currently only "image/jpeg" is supported.
image_sizeNoImage resolution. One of "512", "1K", "2K", "4K" (uppercase K required).
aspect_ratioNoAspect ratio of the generated image. One of 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.
absolute_output_directoryYesRequired absolute directory path where generated images will be saved. Relative paths are rejected.

TDQS

A4.3/5.0
Behavior4/5

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

No annotations are provided, so the description carries the behavioral disclosure burden. It effectively discloses key behaviors: images are written only to the specified absolute_output_directory, relative paths are rejected, the file naming convention ({filename}-gemini-{model}-{timestamp}.{ext}) is documented, and the mime_type constraint (only image/jpeg) is surfaced. It does not disclose potential side effects like file overwrites or API cost implications, but the core behavioral contract is well-covered.

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-organized with a clear opening sentence followed by a requirements list and a notes section for format options. It front-loads the purpose and requirements. The notes on aspect_ratio, image_size, and mime_type are useful but partly redundant with the schema enums, though they add the uppercase-K requirement which the schema also mentions. This is a compact, scannable structure, though the inline enumeration is slightly repetitive with the schema.

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?

For a tool with 6 parameters (3 optional with enums), no output schema, and no annotations, the description does substantial work. It documents the file naming convention, the absolute-path requirement, the model variants, and all format constraints. The main gap is that it doesn't describe the return value/behavior after generation (e.g., does it return paths, a count, errors?), which could matter for an agent chaining subsequent steps. Overall this is quite complete for the tool's complexity.

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?

Schema coverage is 100%, so the baseline is 3. The description adds value beyond the schema by enumerating all allowed aspect ratios inline, clarifying the uppercase-K requirement for image_size (which is a common failure point), and explicitly stating that only image/jpeg is supported. It also documents the filename suffix convention which maps to the 'filename' parameter semantics, adding meaning beyond the schema's 'Base filename without extension.'

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 verb+resource ('Generate one or more images with Google Gemini (Nano Banana) via the Interactions API and save them to disk'). It explicitly distinguishes from the sibling tool by naming the provider (Google Gemini vs OpenAI) and the model family (Nano Banana), which separates it from generate_image_openai. The mention of 'Interactions API' and 'Nano Banana' adds specific identifying context.

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

Usage Guidelines4/5

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

The first sentence provides a clear use case: 'when the user (or your plan) needs Gemini-generated assets for a website or app.' This establishes when to use it. It doesn't explicitly exclude OpenAI/alternatives, though the image model id examples and 'Gemini' naming imply the sibling tool handles other providers. It clearly states requirements (model id, prompt+filename pairs, required absolute_output_directory) which helps the agent assemble correct calls.

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

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}

ParametersJSON Schema
NameRequiredDescriptionDefault
sizeNoImage size as WIDTHxHEIGHT or "auto". GPT image models: 1024x1024, 1536x1024, 1024x1536, or auto. gpt-image-2 also supports arbitrary sizes (both sides divisible by 16, aspect ratio 1:3-3:1, max 3840x2160). dall-e-2: 256x256, 512x512, 1024x1024. dall-e-3: 1024x1024, 1792x1024, 1024x1792.
modelYesOpenAI image model id. GPT image models: gpt-image-2, gpt-image-1.5, gpt-image-1, gpt-image-1-mini, chatgpt-image-latest. Also dall-e-2, dall-e-3.
imagesYesList of images to generate (prompt + filename)
qualityNoRendering quality. auto (default) picks the best for the model. GPT image models: low, medium, high. dall-e-3: standard, hd. dall-e-2: standard only.
backgroundNoBackground for GPT image models that support it: transparent, opaque, or auto (default). transparent requires png or webp. gpt-image-2 does not support transparent β€” use opaque or auto.
output_formatNoOutput format for GPT image models only: png (default), jpeg, or webp.
absolute_output_directoryYesRequired absolute directory path where generated images will be saved. Relative paths are rejected.

TDQS

A4.1/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 behavioral disclosure burden. It discloses key behaviors: only absolute output directories are accepted, relative paths rejected, the file naming pattern, and writes confined to the absolute_output_directory. However, it doesn't describe what happens on failure, whether generations are synchronous, API cost implications, or the return value/format. For a generation tool handling disk writes and API calls, some richer operational detail would help.

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-organized with a clear summary paragraph followed by a bulleted parameter guide. The front-loaded purpose sentence is strong. The parameter notes are genuinely useful (size constraints, quality enums per model, background constraints). It's slightly verbose but every sentence earns its place, given the complex cross-parameter constraints.

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?

This is a complex tool: 7 params, model-specific constraints, disk-writing behavior, and nested images array. The description and rich schema (100% coverage) together cover the input side well. No output schema exists, so the description should note return behavior, which it does partially ('written to output directory', file naming). It doesn't state whether it returns success status, generated URLs, or file paths, which is a minor gap for API-integration workflows.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3 even with minimal description-level parameter info. The description does add helpful cross-parameter constraints (e.g., transparent background requires png/webp, gpt-image-2 doesn't support transparent, quality varies by model family) that go beyond individual parameter schemas. These relational constraints add value, though the schema already documents most per-parameter details thoroughly.

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 opens with a specific verb+resource: 'Generate one or more images with OpenAI's Image API and save them to disk.' It clearly states the tool's function and scope (website/app assets), and distinguishes it from the sibling generate_image_gemini by explicitly naming 'OpenAI's Image API'. The model list in the description further differentiates it from the Gemini sibling.

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 gives explicit usage context: 'Use this when the user (or your plan) needs OpenAI-generated assets for a website or app.' This clearly signals the when-to-use scenario and implicitly distinguishes from the Gemini alternative. While it doesn't name generate_image_gemini explicitly as an exclusion, the OpenAI-specific framing makes the selection obvious.

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. 2 tool updatesv0.0.3
    • First observedgenerate_image_gemini
    • First observedgenerate_image_openai

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).

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers