gpt-image-2-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| OPENAI_ORG_ID | No | Forwarded as the organization header. | |
| OPENAI_API_KEY | Yes | Your OpenAI API key required for authentication. | |
| OPENAI_BASE_URL | No | Override base URL for proxies or enterprise routes. | |
| OPENAI_PROJECT_ID | No | Forwarded as the project header. | |
| GPT_IMAGE_2_JOB_MAX | No | LRU cap on finished image jobs kept for polling (0 = no cap). | 20 |
| GPT_IMAGE_2_MCP_DEBUG | No | Set to '1' to emit verbose debug logs on stderr. | 0 |
| GPT_IMAGE_2_JOB_TTL_MS | No | Age before a finished job becomes un-pollable (0 = never expire). Running jobs are never expired. | 1800000 |
| GPT_IMAGE_2_OUTPUT_DIR | No | Global default directory where images are saved. Absolute paths used as-is, relative resolved from CWD. | |
| GPT_IMAGE_2_SESSION_MAX | No | Max concurrent in-memory edit sessions, LRU-evicted beyond this (0 = no cap). | 20 |
| GPT_IMAGE_2_ASYNC_AFTER_MS | No | Sync window before generate_image / edit_image background themselves (<=0 disables backgrounding entirely). | 20000 |
| GPT_IMAGE_2_SESSION_TTL_MS | No | Idle TTL before an edit session is swept (0 = never expire). | 3600000 |
| OPENAI_RESPONSES_EDIT_MODEL | No | Host model used by the Responses-API fallback edit route. | gpt-4.1-mini |
| OPENAI_FORCE_RESPONSES_EDITS | No | Set to '1' to pin edits to the Responses-API fallback route instead of /v1/images/edits. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| generate_imageA | Generate an image from a text prompt using OpenAI's gpt-image-2 model family (models: "gpt-image-2" (default), "gpt-image-2.5-flare", "gpt-image-2.5-sunburst"). The image is written to disk and also returned inline so you can see it. These models handle photoreal, illustrations, infographics, multilingual text (incl. CJK), and complex structured visuals. They do NOT support transparent backgrounds. Sizes accept presets or any custom "WxH" where edges are multiples of 16, max edge ≤ 3840px, aspect ratio within 1:3–3:1, and total pixels 655,360–8,294,400. Outputs above 2K are beta. Calls that exceed ~20s (slow proxy routes, large sizes, high quality) automatically move to a background job: the first response then carries a job_id — poll get_image_job until it reports state "completed". |
| edit_imageA | Edit or compose images with OpenAI's gpt-image-2 model family (models: "gpt-image-2" (default), "gpt-image-2.5-flare", "gpt-image-2.5-sunburst"). Give 1–8 input images plus a text prompt; optionally include a PNG mask whose transparent regions mark what to change (mask applies to the first image). Great for: swap backgrounds, retouch products, combine multiple reference images into one composition, maintain a character across scenes. These models always process inputs at high fidelity (no input_fidelity knob needed). The edited image is saved to disk and returned inline. Calls that exceed ~20s (slow proxy routes, large inputs) automatically move to a background job: the first response then carries a job_id — poll get_image_job until it reports state "completed". |
| get_image_jobA | Poll a backgrounded gpt-image-2 job. generate_image and edit_image automatically move work that runs longer than ~20s (slow proxy / large sizes / high quality) into a background job and return a job_id instead of blocking past MCP client timeouts. Call this with that job_id until state becomes "completed" (files are already written to disk and returned inline) or "failed". While still "running", wait a few seconds between polls. |
| start_edit_sessionA | Begin a stateful multi-turn edit session. Returns a session_id you then pass to continue_edit_session to iteratively refine the image (each turn uses the previous turn's output as the input). Use end_edit_session when done. |
| continue_edit_sessionA | Apply another edit turn to an existing session. The previous turn's output image is used as the input. Use short, focused prompts like "make the sky more orange" or "add a small boat on the horizon"; include "keep everything else the same" to limit drift. Returns the new image and the updated session. |
| end_edit_sessionA | Free an iterative-edit session. Safe to skip — sessions are in-memory only and are discarded on server restart — but calling this frees memory sooner and keeps list_edit_sessions tidy. |
| list_edit_sessionsA | List active iterative-edit sessions (in-memory only, discarded on server restart). Useful to recover a session_id after a client reconnect. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 7 tools
Each tool has a unique role: text-to-image generation, one-shot image editing, async job polling, and the session lifecycle (start/continue/end/list). The only adjacent pair is edit_image vs continue_edit_session, but the stateful vs one-shot distinction is clearly explained.
All tools follow a consistent verb_noun snake_case pattern such as generate_image, edit_image, get_image_job, start_edit_session, and list_edit_sessions. There are no mixed conventions or vague verbs.
Seven tools is well-scoped for an image generation and editing server. Each tool addresses a distinct need—generation, editing, async polling, and session management—without redundancy.
The tool surface covers the full workflow: generate images, edit/compose them, poll background jobs, and manage iterative multi-turn sessions. There are no critical gaps such as missing session termination or job status retrieval.