Skip to main content
Glama
s4shibam

Image Gen MCP

by s4shibam
README.md
<p align="center">
    <a href="https://github.com/s4shibam/image-gen-mcp">
        <img alt="Image Gen MCP" width="100" src="./.readme/logo.svg">
    </a>
</p>

<div align="center">
    <h1>Image Gen MCP</h1>
    <p>Generate images with OpenAI and Gemini from any MCP client</p>
</div>

<p align="center">
    <img src="https://img.shields.io/github/languages/code-size/s4shibam/image-gen-mcp?style=flat-square" alt="Code Size">
    <img src="https://img.shields.io/github/license/s4shibam/image-gen-mcp?style=flat-square" alt="License">
    <img src="https://img.shields.io/github/stars/s4shibam/image-gen-mcp?style=flat-square&logo=github" alt="Stars">
</p>

<br />

## โšก 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.

## โœจ 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.

```json
{
  "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:

```env
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:

```text
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.
```

```text
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:

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

Files use this format:

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

Example:

```text
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](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/s4shibam)
[![Twitter](https://img.shields.io/badge/Twitter-00ACEE?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/s4shibam)

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