MCP Image Generator

Generate and edit images through Gemini, OpenAI or BytePlus Seedream, with prompts rewritten first

By shinpr (individual) TypeScript Local · stdio MediaAI and ML

61 popularity score ★ 187 ↓ 2.6k/wk

Connect your client

Local (npm)

Add in one click

Opens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.

Or add it by command or config

It needs GEMINI_API_KEY. Replace each <NAME> with your value.

Claude CodeTerminal
claude mcp add image-generator -e GEMINI_API_KEY=<GEMINI_API_KEY> -- npx -y mcp-image
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "image-generator": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-image"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "image-generator": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-image"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "image-generator": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "mcp-image"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.image-generator]
command = "npx"
args = ["-y", "mcp-image"]

[mcp_servers.image-generator.env]
GEMINI_API_KEY = "<GEMINI_API_KEY>"
Gemini CLITerminal
gemini mcp add --scope user -e GEMINI_API_KEY=<GEMINI_API_KEY> image-generator npx -- -y mcp-image
Local (from source)

Add in one click

Opens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.

Or add it by command or config

It needs GEMINI_API_KEY. Replace each <NAME> with your value.

FirstTerminal
git clone https://github.com/shinpr/mcp-image.git
cd mcp-image
pnpm install
pnpm run build
Claude CodeTerminal
claude mcp add image-generator -e GEMINI_API_KEY=<GEMINI_API_KEY> -- node '<ABSOLUTE_PATH_TO_CLONE>/dist/index.js'
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "image-generator": {
      "command": "node",
      "args": [
        "<ABSOLUTE_PATH_TO_CLONE>/dist/index.js"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "image-generator": {
      "command": "node",
      "args": [
        "<ABSOLUTE_PATH_TO_CLONE>/dist/index.js"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "image-generator": {
      "type": "stdio",
      "command": "node",
      "args": [
        "<ABSOLUTE_PATH_TO_CLONE>/dist/index.js"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.image-generator]
command = "node"
args = ["<ABSOLUTE_PATH_TO_CLONE>/dist/index.js"]

[mcp_servers.image-generator.env]
GEMINI_API_KEY = "<GEMINI_API_KEY>"
Gemini CLITerminal
gemini mcp add --scope user -e GEMINI_API_KEY=<GEMINI_API_KEY> image-generator node -- '<ABSOLUTE_PATH_TO_CLONE>/dist/index.js'

Settings 7

GEMINI_API_KEY Required: Gemini API key for the default provider. Use OPENAI_API_KEY or ARK_API_KEY instead with the matching IMAGE_PROVIDER; generate_image returns an error without the selected provider's key.
IMAGE_OUTPUT_DIR Optional: Folder where images are saved; ./output relative to the client's working directory by default, so give an absolute path.
IMAGE_PROVIDER Optional: Default provider: gemini (default), openai or seedream; a request's provider option overrides it.
OPENAI_API_KEY Optional: API key for the OpenAI provider.
ARK_API_KEY Optional: BytePlus ModelArk AP-region API key for the Seedream provider.
IMAGE_QUALITY Optional: Default quality preset: fast (default), balanced or quality.
SKIP_PROMPT_ENHANCEMENT Optional: Set to true to send prompts to the image model without rewriting them; false by default.

What it does

mcp-image is a local stdio server with a single tool, generate_image. You give it a description of a new image, or an instruction plus absolute paths to existing images, and it sends the job to one of three image providers: Google Gemini (the default), OpenAI, or BytePlus Seedream. The finished file is written to an output folder on disk and handed back to the assistant as an MCP resource.

Before the image request goes out, the server asks the same provider's text model to expand a short request into a more detailed prompt covering composition, lighting and camera angle. A request that already carries a lot of detail is changed less. Setting SKIP_PROMPT_ENHANCEMENT=true turns this step off. In the code at v0.18.0, if the rewriting call fails, the server quietly falls back to your original prompt rather than failing the request (src/server/mcpServer.ts).

Each call can choose a quality preset (fast, balanced or quality; fast by default), an aspect ratio (1:1 by default, up to 21:9 and 8:1), an image size of 1K, 2K or 4K, and a provider, which overrides IMAGE_PROVIDER. Optional flags ask for character consistency across images, blending of several references, world knowledge for real places and people, and Google Search grounding, which works with Gemini only.

The API key is checked when a request is made, not at startup: the server starts without one, and generate_image then returns an error naming the missing variable for the chosen provider (src/utils/config.ts). You can therefore configure keys for several providers and switch between them per request. The npm package also includes a separate prompt-writing Agent Skill, installed with `npx mcp-image skills install`, which is not part of the server.

What it needs

RuntimeNode.js 22+

Node.js 22 or later (the package's engines field) to run it with npx. An API key for at least one provider: GEMINI_API_KEY for Gemini, OPENAI_API_KEY with IMAGE_PROVIDER=openai, or a BytePlus ModelArk AP-region ARK_API_KEY with IMAGE_PROVIDER=seedream. Each provider bills for its own use, and OpenAI may require organisation verification before it will generate images.

Limits

It has one tool, generate_image; it cannot list, browse or delete images. Input images per call are capped in the code: 14 for Gemini, 16 for OpenAI, 10 for Seedream. Input images must be PNG, JPEG or WebP and no larger than 10 MiB each; Seedream edits accept PNG and JPEG only. Seedream does not do 4K, and useGoogleSearch works with Gemini only. Output can be saved only under the working directory, IMAGE_OUTPUT_DIR, ./temp, ./tmp or /tmp, and paths containing '..' are refused (src/utils/security.ts). Without an absolute IMAGE_OUTPUT_DIR, images go to ./output relative to whatever working directory the client starts it in.

Who it suits

Suits developers who want to generate or edit images from Claude Code, Cursor, Codex or another stdio client and keep the files on their own disk, and who already pay for, or are willing to pay for, Gemini, OpenAI or Seedream API access. Being able to switch providers per request helps when comparing results. It is a poor fit if you want image generation without a paid third-party API, a hosted endpoint, or a tool for managing an image library: it only creates files. If you want your own wording sent to the model unchanged, set SKIP_PROMPT_ENHANCEMENT=true, since by default every prompt is rewritten.

Tools 1

generate_image
Creates a new image from a text prompt, or edits and combines reference images given as absolute paths, then saves it to disk and returns it as a file resource

Similar servers