gpt-image-2-mcp

作者 lownamlee已验证

Local MCP server for ChatGPT image generation.

115
Stars
2
Forks
TypeScript
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/lownamlee/gpt-image-2-mcp

快速入门

使用 gpt-image-2-mcp 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

@ramlyburger/gpt-image-2-mcp

npm version npm downloads Node.js 20 or newer Model Context Protocol server MIT license

GPT Image 2 MCP banner showing prompts flowing through an MCP server into generated images

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.

Popularity

Pulse MCP popularity ranking for GPT Image 2

PulseMCP: https://www.pulsemcp.com/servers/ramlyburger-gpt-image-2

🖼️ What It Does

  • ✍️ Prompt in: ask for an image from your MCP client.
  • ⚙️ MCP server runs: gpt-image-2-mcp handles the image request.
  • 💾 Files out: every result includes output_dir, image_path, and metadata.
  • 🔐 No ChatGPT API key needed in chatgpt-web mode. You only need a ChatGPT account and a successful sign-in at chatgpt.com.

Beginner-friendly flow from prompt to GPT Image 2 MCP to saved images

🚀 Quick Start

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.

🧭 Pick A Mode

ModeWhat you needBest whenNotes
chatgpt-webA ChatGPT account and sign-in at chatgpt.comYou want a simple setup without a ChatGPT API keyGood beginner default
apiOPENAI_API_KEYYou want the direct API pathUses gpt-image-2
autoPreferably an API key; otherwise a usable ChatGPT website sessionYou want API first with fallback behaviorTries API first, then falls back only when the API backend is unavailable

🎬 Demo

Demo

Click the GIF to open the full MP4.

🧰 Tool Surface

  • 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.

📄 Technical Reference

The section below is the implementation-oriented view.

Figure 1. System Model

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

Academic paper-style architecture figure for GPT Image 2 MCP

Abstract

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.

Method

The implementation follows a five-stage pipeline:

  1. parse and validate MCP tool input
  2. resolve the backend from api, chatgpt-web, or auto
  3. execute the selected image-generation path
  4. write generated images and metadata.json to a prompt-derived output directory
  5. return output_dir, image_path, images, and backend metadata

The auto mode attempts the API backend first and falls back to chatgpt-web only when the API backend is unavailable.

Artifact Model

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_root
  • generate_image returns output_dir, image_path, and the full images array
  • image filenames are deterministic within one output directory: image-01, image-02, and so on
  • metadata is written as JSON alongside the image files

ChatGPT Website Mode

Run 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.

API Mode

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.

Tool Contract

generate_image returns a structured result with these important fields:

  • status
  • requested_backend
  • backend
  • fallback_from
  • prompt
  • output_dir
  • image_path
  • images
  • metadata

backend_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.

Local Development

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

Repository Notes

  • src/index.ts registers the MCP tools
  • src/config.ts resolves environment-driven configuration
  • src/backends/ contains backend implementations and selection logic
  • src/output.ts is responsible for output-directory naming and file writes

The public MCP surface stays intentionally small while backend-specific behavior remains isolated in the backend layer.

常见问题

What is gpt-image-2-mcp?

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 115 GitHub stars.

Is gpt-image-2-mcp safe to use?

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.

How do I install gpt-image-2-mcp?

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).

What programming language is gpt-image-2-mcp written in?

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.

Are there alternatives to gpt-image-2-mcp?

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.

评论 (0)

暂无评论,成为第一个分享想法的人!

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

Scrapling

by D4Vinci

🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!

75,9137,581Python
MCP 服务器
查看详情

TrendRadar

by sansan0

⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。

61,65224,883Python
MCP 服务器
查看详情

context7

by upstash

Context7 Platform -- Up-to-date code documentation for LLMs and AI code editors

61,0602,938TypeScript
MCP 服务器
查看详情

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

39,9393,219C
MCP 服务器
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情