image-gen-mcp
Provides tools for generating and editing images through OpenAI image models, supporting configurable size, quality, output format, and related options.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@image-gen-mcpgenerate a photorealistic image of a cozy cabin in snowy mountains"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Image Gen MCP
TypeScript MCP server for generating and editing images through OpenAI image models.
The server registers generate_image and edit_image tools, then writes the returned
image bytes to disk. Stdio mode writes to the requested absolute filepath; SSE and
streamable HTTP auto-save files and return image URLs.
Env
Name | Required | Default | Description |
| No | AI SDK OpenAI default | OpenAI API URL prefix, for example |
| Yes | - | OpenAI API key. |
| No |
| OpenAI image model. |
| No |
| Directory for auto-saved files in SSE/HTTP mode. Docker defaults this to |
Related MCP server: OpenAI GPT-Image MCP Server
Tool
generate_image
Arguments:
Name | Required | Default | Description |
| Yes | - | Image prompt. |
| Stdio | - | Stdio only. Absolute output path. Parent directories are created automatically. |
| No |
| Number of images, from |
| No |
|
|
| No |
|
|
| No | - |
|
| No |
|
|
| No | - | Compression level from |
| No | - |
|
| Stdio |
| Stdio only. Allow replacing existing output files. |
Known model size limits are validated before calling the upstream API. For example,
gpt-image-* models support 1024x1024, 1536x1024, and 1024x1536; dall-e-2
supports 256x256, 512x512, and 1024x1024.
For n > 1, a filepath like /tmp/image.png becomes /tmp/image-1.png,
/tmp/image-2.png, and so on.
In SSE and streamable HTTP modes, filepath and overwrite are not exposed. Generated
files are saved as ${FILE_DIR}/YYYY-MM-DD/<uuid>.<ext> and returned with URLs like
http://localhost:3000/file/YYYY-MM-DD/<uuid>.png.
edit_image
Arguments:
Name | Required | Default | Description |
| Yes | - | Edit instruction. |
| Yes | - | Absolute path to the source image to edit. |
| No | - | Optional absolute path to the edit mask image. |
| Stdio | - | Stdio only. Absolute output path. Parent directories are created automatically. |
| No |
| Number of edited images, from |
| No |
|
|
| No |
|
|
| No | - | Edited image background behavior. |
| No |
|
|
| No | - | Compression level from |
| No | - |
|
| Stdio |
| Stdio only. Allow replacing existing output files. |
The tool calls the OpenAI-compatible /images/edits endpoint with multipart form data.
Output files follow the same filepath and auto-save behavior as generate_image.
Development
pnpm install
pnpm devUseful checks:
pnpm check
pnpm buildStdio MCP Config
{
"mcpServers": {
"image-gen-mcp": {
"type": "stdio",
"command": "npx",
"args": ["image-gen-mcp"],
"env": {
"BASE_URL": "https://api.openai.com/v1",
"API_KEY": "sk-...",
"MODEL": "gpt-image-2"
}
}
}
}Streamable HTTP
{
"mcpServers": {
"image-gen-mcp": {
"type": "http",
"url": "http://localhost:3000/mcp",
"headers": {
"openai-base-url": "https://api.openai.com/v1",
"openai-api-key": "sk-...",
"openai-model": "gpt-image-2"
}
}
}
}Headers override the server-side env config; omit them to fall back to the env values. The Docker image runs streamable HTTP on port 3000.
SSE
The SSE transport lives in src/sse.ts and listens on PORT (default 4000)
at /mcp, with messages posted to /message. Run it directly with
pnpm start:sse; it is not started by the Docker image.
{
"mcpServers": {
"image-gen-mcp": {
"type": "sse",
"url": "http://localhost:4000/mcp",
"headers": {
"openai-api-key": "sk-..."
}
}
}
}Docker
docker build -t image-gen-mcp .
docker run --rm -p 3000:3000 \
# 也可忽略apiKey,让使用方 headers 中传递
-e BASE_URL=https://api.openai.com/v1 \
-e API_KEY=sk-... \
-e MODEL=gpt-image-2 \
-v image-gen-data:/data \
image-gen-mcpMaintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables image generation using OpenAI's DALL-E and GPT-Image models directly through the Model Context Protocol. It allows users to create and save images with fine-grained control over parameters like size, quality, and background transparency.46MIT
- AlicenseAqualityCmaintenanceEnables image generation and editing using OpenAI's GPT Image API (gpt-image-1, 1.5, 2) with support for multi-image generation, history management, and batch processing.121,7841MIT
- FlicenseNot gradedqualityDmaintenanceProvides AI agents and coding assistants with image generation and editing capabilities using OpenAI's GPT-image-1 model, with support for local or Supabase storage.3
- FlicenseNot gradedqualityDmaintenanceEnables image generation and editing via OpenAI's gpt-image-1 model, with options for saving, format control, and transparency.
Related MCP Connectors
LLM chat, text summarization and AI image generation
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Generate images with any major model — one API key, one prepaid balance, one MCP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/seepine/image-gen-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server