gpt-image-mcp
Provides tools for generating and editing images using OpenAI's image API, including listing available models, generating images from prompts, editing images with masks, composing edited regions onto a base image, and creating elliptical masks.
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., "@gpt-image-mcpGenerate a base image, then create mouth and eye variations for lip-sync and compose them."
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.
gpt-image-mcp
OpenAI の画像生成/編集を MCP ツールとして出すサーバ。 同じキャラクターの差分絵(口の形・目の開閉)を作る用途を主目的にしている。
なぜ単なるAPIラッパーではないか
/v1/images/edits は、マスクを渡しても画像全体を再生成する。
実測(2026-08-12・gpt-image-2・1024x1024):
マスク内で変化 | マスク外で変化 | マスク外の最大差分 | |
口を「あ」に編集 | 7,184px (35.8%) | 9,425px (0.92%) | 220 |
口を「い」に編集 | 1,498px (7.5%) | 7,431px (0.72%) | 216 |
最大差分220は「ほぼ別の色」。編集結果をそのまま動画のコマに使うと、口が変わるたびに髪や輪郭も動く—— 30fps で切り替えると顔が揺れる。
このサーバは対処を同梱している。編集結果は「口の形の参考」として扱い、土台は1枚に固定して、
マスク領域だけをローカルで貼り直す(compose_region)。土台はビット単位で保たれる。
マスク外の最大差分 | |
編集結果をそのまま使う | 220 |
単純にぼかして合成 | 55(ぼけがマスク外へ滲む) |
| 10(知覚不能) |
Related MCP server: Nano-Banana MCP Server
ツール
ツール | 課金 | 何をするか |
| なし | このキーで使える画像モデルを列挙。キーが生きているかの確認にも使う |
| あり | プロンプトから生成し、ファイルに保存してパスを返す |
| あり | マスク指定で編集。そのままコマに使わないこと(上記) |
| なし | 編集結果のマスク領域だけを土台へ貼る。土台の汚れを自動検証する |
| なし | 楕円マスクを作る(比率指定) |
画像は base64 で返さずファイルに書いてパスを返す。会話の文脈を食い潰さないため。
APIキーの扱い
このサーバはキーを保持しない。 呼ぶたびに、次の順で解決する。
環境変数
OPENAI_API_KEYmacOS Keychain(
OPENAI_KEYCHAIN_SERVICEにサービス名を設定した場合)
エラー本文にキーが混ざった場合は [REDACTED] に置換してから返す。
Keychain へ入れる場合(コマンド履歴にキーを残さない形):
printf 'key: '; stty -echo; read -r K; stty echo; echo
security add-generic-password -a "$USER" -s openai-image -U -w "$K"; unset K⚠
securityの対話入力(-wを引数なしで最後に置く形)は128文字で切り捨てる。sk-proj-形式のキーは164文字あるため、上の「値として渡す」形を使うこと。
設定
.mcp.json / Claude Code の MCP 設定に追加する。
{
"mcpServers": {
"gpt-image": {
"command": "node",
"args": ["/path/to/gpt-image-mcp/src/index.mjs"],
"env": { "OPENAI_KEYCHAIN_SERVICE": "openai-image" }
}
}
}必要なもの
Node.js 18+(
fetch/FormDataを使う)Python 3 + Pillow(
compose_region/make_mask)。numpyがあれば土台の汚れを自動検証する
npm install
pip install Pillow numpyアバターの作り方(この構成での標準手順)
generate_imageで土台を1枚作る。背景は単色、影とグラデーションを禁止、正面向き、口は閉じ目は開くmake_maskで口の領域(目安0.40 / 0.455 / 0.60 / 0.575)と目の領域(0.34 / 0.32 / 0.66 / 0.42)のマスクを作るedit_imageで口の形(あいうえお)と閉じた目を作るcompose_regionで全部を土台へ貼り直す ← ここを飛ばすと顔が揺れる口の形は母音ごとに1枚。日本語の口パクは
a i u e o+ 閉じ口の6枚で足りる
⚠ 「い」のように変化が小さい口の形は生成が弱い(実測でマスク内の変化が7.5%しか出ず、 マスク外のほうが動いた)。プロンプトを形で具体的に指示するか、その口だけ手で描くほうが早い。
生成物の権利
生成画像を販売物に使う場合、「動画に使ってよい」と「販売する教材に使ってよい」が 別条項のことがある。使う前に、使うキーのアカウントの利用規約を確認すること。 借りたキーで作った素材を自社商品に使わない。
ライセンス
MIT
Available Tools
5 toolscompose_region編集結果のマスク領域だけを土台へ貼るA
edit_image の結果からマスク領域だけを切り出し、土台画像へ合成する。土台はビット単位で保たれるので、口の形や目の開閉を差し替えても顔が動かない。アバターの差分絵を作るなら必ずこれを通す。境界のぼかしは内側にだけ入る(単純にぼかすとマスクの外へ滲んで土台を汚すため)。numpy があれば土台の汚れを自動検証する。
| Name | Required | Description | Default |
|---|---|---|---|
| feather | No | 境界のぼかし。既定5 | |
| out_path | Yes | 保存先のパス(.png) | |
| src_path | Yes | edit_image の出力 | |
| base_path | Yes | 土台(顔を固定する1枚) | |
| mask_path | Yes | 編集領域マスク(透明=貼る所) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and discloses notable behaviors: base is preserved bit-wise ('土台はビット単位で保たれる'), blur is applied only inside the mask ('境界のぼかしは内側にだけ入る'), and it auto-verifies base contamination if numpy is available ('numpy があれば土台の汚れを自動検証する'). It does not detail failure modes, but the disclosed behaviors go well beyond the name.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Four sentences, no wasted words. The first sentence states the core function, followed by use-case, a caveat about blur, and a note about validation. Every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations and no output schema, the description covers the main aspects: purpose, use case, key behaviors, and edge-case handling (blur direction). It does not mention return values or error behavior, but for a compositing utility the provided context is sufficient for an agent to select and invoke it.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so each parameter already has a description. The description adds relationships between parameters (e.g., src_path is 'edit_image の出力', base_path is the fixed face) and explains the feather behavior (blur only inside), which enhances the meaning of the feather parameter. It scores above baseline 3 due to this cross-referencing.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states a specific verb+resource: 'edit_image の結果からマスク領域だけを切り出し、土台画像へ合成する' (cut out only the masked area from edit_image result and composite onto base). It distinguishes from siblings by explaining the compositing role and even gives a concrete use case: 'アバターの差分絵を作るなら必ずこれを通す' (if making avatar diff images, be sure to use this).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly tells when to use the tool ('アバターの差分絵を作るなら必ずこれを通す'), and implies that it is the step after edit_image. It does not explicitly list alternatives or when-not-to-use, but the context is clear enough that it is the compositing step among the sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
edit_image画像を編集する(マスク指定可)A
既存画像を編集する。mask_path を渡すと、透明の画素だけが編集対象になる。 ⚠ 実測(2026-08-12):マスクを渡しても画像全体が再生成される。マスク外の画素が0.7〜0.9%変化し、最大差分は220(ほぼ別の色)だった。同じキャラクターの差分絵(口の形・目の開閉)を作る用途では、この結果をそのままコマに使わないこと——30fpsで切り替えると顔が揺れる。compose_region で土台へ貼り直すこと。
| Name | Required | Description | Default |
|---|---|---|---|
| size | No | 1024x1024 | |
| model | No | gpt-image-2 | |
| prompt | Yes | どう編集するか | |
| out_path | Yes | 保存先のパス(.png) | |
| mask_path | No | 編集領域のマスク(透明=編集する所・元画像と同サイズのPNG) | |
| image_path | Yes | 編集元の画像 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations are absent, so the description carries full burden. It discloses critical measured behavior: passing a mask still regenerates the entire image, drift in non-mask pixels, and max difference. This goes far beyond the schema and is highly valuable for an agent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two purposeful sentences. The first states purpose and mask behavior; the second provides concrete measured data and actionable advice without padding. Every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 6-parameter tool with no annotations and no output schema, the description covers the core purpose, the critical behavioral caveat, and recommends an alternative workflow. It is sufficiently complete for an agent to invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 67%, and mask_path is already described in the schema. The description adds a crucial semantic correction: despite the mask, the whole image is regenerated. This meaningfully alters how the agent should interpret mask_path, but other parameters like size/model are not further clarified.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states '既存画像を編集する' (edits an existing image), using a specific verb and resource. It also mentions mask_path behavior, which distinguishes it from sibling tools like generate_image (new image generation) and compose_region (compositing).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies use for editing existing images and explicitly warns against using the result directly for character diff frames (30fps switching causes face wobble), instead recommending compose_region. This provides clear when-to-use and when-not-to-use guidance with an alternative tool.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
generate_image画像を生成するA
プロンプトから画像を生成し、ファイルに保存してパスを返す(base64は返さない)。アバターの土台を作る用途では、背景を単色に・影とグラデーションを禁止・正面向きと明示すると後段の合成が楽になる。
| Name | Required | Description | Default |
|---|---|---|---|
| size | No | 1024x1024 / 1024x1536 / 1536x1024 / auto | 1024x1024 |
| model | No | 既定 gpt-image-2 | gpt-image-2 |
| prompt | Yes | 生成の指示。日本語で可 | |
| out_path | Yes | 保存先のパス(.png) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden and does disclose a key behavior: returns path rather than base64, and explicitly saves to file. It does not discuss permissions, error cases, or rate limits, which would be expected for a generation tool without annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is only two sentences: the first states core behavior concisely, the second offers domain-specific advice. No redundant content, and key facts are front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description, combined with a high-coverage schema and no output schema, appropriately covers behavior and a key use case. It doesn't describe errors or environmental dependencies, but for a generation tool this is sufficient.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Although schema coverage is 100%, the description adds meaningful guidance for the prompt parameter, recommending solid background, no shadows/gradients, and face-forward for avatar use. This enriches the schema's minimal parameter description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool generates an image from a prompt, saves it to a file, and returns the path, explicitly noting it does not return base64. This distinguishes it from sibling tools like edit_image and make_mask by emphasizing creation and file output.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It provides a specific use case for avatar base generation with prompt styling tips, which gives context on when this tool is appropriate. However, it does not explicitly name alternatives or state when not to use it, so it falls short of full 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_image_models画像モデルの一覧A
このAPIキーで使える画像生成モデルを列挙する。課金されない。キーが生きているかの確認にも使う(借りたキーはプロジェクト側で機能制限されていることがあるため、モデル名を推測せず必ずこれで確認する)。
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and delivers: it discloses that the operation is not billed ('課金されない') and that it can be used for key validation, adding meaningful behavioral context beyond the basic function.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences, front-loaded with the core purpose and immediately followed by an important usage note. Every word serves a purpose, no redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (no params, no output schema), the description is complete. It clarifies the return intent (list of models), the cost behavior, and a critical usage reminder, fully equipping the agent for correct invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters, so the baseline is 4. The description does not need to add parameter details, and it doesn't; it focuses on usage context, which is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool enumerates image generation models available for the API key, using the specific verb '列挙する' (enumerate) and resource '画像生成モデル'. It distinguishes itself from sibling tools by focusing on listing and validating key access.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly instructs when to use this tool: to check if the API key is active and to always verify model names with this tool rather than guessing, especially for borrowed keys with potential restrictions. This is clear, actionable guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
make_mask楕円マスクを作るA
編集したい領域(口・目など)を楕円で指定したマスクPNGを作る。座標は画像サイズに対する比率(0〜1)で渡す。例: 口 = left 0.40 / top 0.455 / right 0.60 / bottom 0.575、目 = 0.34 / 0.32 / 0.66 / 0.42。
| Name | Required | Description | Default |
|---|---|---|---|
| top | Yes | ||
| left | Yes | ||
| right | Yes | ||
| bottom | Yes | ||
| out_path | Yes | 保存先のパス(.png) | |
| like_path | Yes | このファイルと同じサイズで作る |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses the ratio-based coordinate system (0-1) and gives examples, which is valuable. However, it does not mention potential side effects like file overwriting or the exact mask format characteristics beyond 'PNG'.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences, front-loading the purpose, then adding coordinate semantics and examples. It is concise and every sentence contributes useful information without redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the core behavior, coordinate system, and examples, which is largely sufficient for invoking the tool correctly. Gaps exist regarding expected mask appearance (e.g., fill color) but given no output schema and no annotations, the description does enough to guide an agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema only describes like_path and out_path, leaving the four coordinate parameters undocumented. The description compensates by explaining the ratio coordinate system and providing specific example values for left/top/right/bottom, adding essential meaning beyond the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: creating a mask PNG that specifies an elliptical editing region (e.g., mouth, eyes). It provides concrete coordinate examples, making the purpose unambiguous and distinguishing it from sibling tools like generate_image or compose_region.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for facial region editing through examples, but does not explicitly state when to use this tool versus alternatives or mention any exclusions. The context is clear but lacks explicit guidelines about alternatives or when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Each tool has a distinct role: generation, editing, region compositing, mask creation, and model listing. The only potential ambiguity is between edit_image and compose_region, but the descriptions clarify that compose_region is specifically for splicing edited regions onto a base image, while edit_image performs the actual editing.
The tools mostly follow a verb_noun pattern (generate_image, edit_image, compose_region, make_mask, list_image_models). compose_region and make_mask use slightly different verb forms (compose/make vs generate/edit/list) but the pattern is still clear and predictable overall.
With 5 tools, the server is well-scoped for image generation and editing workflows. Each tool addresses a necessary step in the primary use case of creating avatar variations, and there is no redundancy or excess.
The server covers the core pipeline: model listing, generation, editing, mask creation, and compositing. A minor gap is the lack of an explicit tool for reading image metadata or saving intermediate results, but agents can work around this using file paths returned by the tools.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server for NanoBanana AI image generation and editing
MCP server for Qwen Image 3 AI image generation
MCP server for OpenAI Sora AI video generation
MCP server for Flux AI image generation
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceAn MCP tool server that enables generating and editing images through OpenAI's image models, supporting text-to-image generation and advanced image editing (inpainting, outpainting) across various MCP-compatible clients.110MIT
- AlicenseAqualityDmaintenanceAn MCP server that provides AI image generation and editing capabilities using Google's Gemini 2.5 Flash Image API. It allows users to create new images from text, modify existing files, and perform iterative edits through natural language prompts.6758MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that wraps OpenAI's image generation and editing APIs, enabling text-to-image and image-to-image operations via tools.24938ISC
- AlicenseAqualityDmaintenanceAn MCP server that generates and edits images using OpenAI's GPT Image model, allowing users to create images from text descriptions and edit existing images through natural language.112MIT
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/cometa-kaito/gpt-image-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server