by lownamlee
Local MCP server for ChatGPT image generation.
# Add to your Claude Code skills
git clone https://github.com/lownamlee/gpt-image-2-mcpGuides for using mcp servers skills like gpt-image-2-mcp.
Last scanned: 7/26/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-07-26T06:35:34.301Z",
"npmAuditRan": true,
"pipAuditRan": true,
"promptInjectionRan": true
}gpt-image-2-mcp is an open-source mcp servers skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by lownamlee. Local MCP server for ChatGPT image generation. It has 104 GitHub stars.
Yes. gpt-image-2-mcp passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.
Clone the repository with "git clone https://github.com/lownamlee/gpt-image-2-mcp" and add it to your Claude Code skills directory (see the Installation section above).
gpt-image-2-mcp is primarily written in TypeScript. It is open-source under lownamlee on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other MCP Servers skills you can browse and compare side by side. Open the MCP Servers category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh gpt-image-2-mcp against similar tools.
No comments yet. Be the first to share your thoughts!
Top skills in this category by stars
Turn any MCP-compatible AI client into an image generator. Send a normal prompt, choose a backend mode, and get real saved image files back.
PulseMCP: https://www.pulsemcp.com/servers/ramlyburger-gpt-image-2
gpt-image-2-mcp handles the image request.output_dir, image_path, and metadata.chatgpt-web mode. You only need a ChatGPT account and a successful sign-in at chatgpt.com.Add the server to your MCP client:
{
"mcpServers": {
"gpt-image-2": {
"command": "npx",
"args": ["-y", "@ramlyburger/gpt-image-2-mcp"],
"env": {
"GPT_IMAGE_BACKEND": "chatgpt-web"
}
}
}
}
That is enough for the ChatGPT website mode. The first run opens ChatGPT so you can sign in or complete verification. After that, the local profile can be reused across restarts.
For direct API generation, set OPENAI_API_KEY and change GPT_IMAGE_BACKEND to api.
| Mode | What you need | Best when | Notes |
|---|---|---|---|
chatgpt-web |
A ChatGPT account and sign-in at chatgpt.com |
You want a simple setup without a ChatGPT API key | Good beginner default |
api |
OPENAI_API_KEY |
You want the direct API path | Uses gpt-image-2 |
auto |
Preferably an API key; otherwise a usable ChatGPT website session | You want API first with fallback behavior | Tries API first, then falls back only when the API backend is unavailable |
Click the GIF to open the full MP4.
generate_image(prompt, backend?, n?, size?, quality?, output_format?, conversation_mode?, timeout_seconds?)backend_status(backend?)browser_visibility(action?, start_browser?)Backend values are api, chatgpt-web, or auto.
Use conversation_mode="new" or conversation_mode="continue" with the ChatGPT website mode.
The section below is the implementation-oriented view.
flowchart LR
A["MCP client"] --> B["gpt-image-2-mcp<br/>stdio server"]
B --> C["Input validation<br/>Zod schemas"]
C --> D{"Backend selection"}
D --> E["OpenAI API mode"]
D --> F["ChatGPT website mode"]
E --> G["Saved image files<br/>metadata.json"]
F --> G
gpt-image-2-mcp is a small TypeScript MCP server that exposes image generation through a narrow tool contract. The server validates MCP tool input, resolves the requested backend, persists generated artifacts to disk, and returns structured metadata plus image content to the caller.
The implementation follows a five-stage pipeline:
api, chatgpt-web, or autometadata.json to a prompt-derived output directoryoutput_dir, image_path, images, and backend metadataThe auto mode attempts the API backend first and falls back to chatgpt-web only when the API backend is unavailable.
Each generation creates one output directory. Images are written as numbered files such as image-01.png, and metadata is written beside them.
Default output roots:
Windows: %LOCALAPPDATA%\gpt-image-2-mcp\output\chatgpt-images
macOS: ~/Library/Application Support/gpt-image-2-mcp/output/chatgpt-images
Linux: ${XDG_DATA_HOME:-~/.local/share}/gpt-image-2-mcp/output/chatgpt-images
Operational notes:
backend_status returns the effective output_rootgenerate_image returns output_dir, image_path, and the full images arrayimage-01, image-02, and so onRun the server in ChatGPT website mode:
$env:GPT_IMAGE_BACKEND = "chatgpt-web"
node dist/index.js
When the server starts, it opens ChatGPT in Chrome or Edge. Sign in or complete verification there. Once the normal composer is visible, the session is ready for tool calls. No ChatGPT API key is required for this mode.
The local ChatGPT sign-in profile is stored under the same per-user app data directory by default. Override it with:
$env:CHATGPT_WEB_PROFILE_DIR = "C:\path\to\profile"
Optional settings:
$env:CHATGPT_WEB_LOGIN_TIMEOUT_SECONDS = "900"
$env:CHATGPT_HIDE_WINDOW = "0"
CHATGPT_HIDE_WINDOW defaults to enabled. The ChatGPT window stays visible for login or verification, then hides after chatgpt.com is ready. Use 0 if you want the window to remain visible after sign-in.
Run the server in direct API mode:
$env:OPENAI_API_KEY = "sk-..."
$env:GPT_IMAGE_BACKEND = "api"
node dist/index.js
This mode uses the configured OpenAI image model directly. By default the model is gpt-image-2, and the selected output format can be png, jpeg, or webp.
generate_image returns a structured result with these important fields:
statusrequested_backendbackendfallback_frompromptoutput_dirimage_pathimagesmetadatabackend_status returns readiness and configuration information for the selected backend or for both backends when auto is requested.
browser_visibility controls the visibility of the ChatGPT window and can also start the ChatGPT session when requested.
The TypeScript MCP server is the only supported entry point.
Install and build:
npm install
npm run build
Useful local commands:
npm run typecheck
npm run build
npm run start
src/index.ts registers the MCP toolssrc/config.ts resolves environment-driven configurationsrc/backends/ contains backend implementations and selection logicsrc/output.ts is responsible for output-directory naming and file writesThe public MCP surface stays intentionally small while backend-specific behavior remains isolated in the backend layer.