English · 中文
You don't need a specialist design AI anymore.
gpt-image-2can draw any UI you can describe — landing pages, dashboards, mobile screens, components — and your coding agent reads the result and ships the code. One MCP, one model, one round-trip.
prompt → gpt-image-2 → your agent reads the image → working code
The era of paying for separate "AI design tools" is over. Hand the picture straight to Claude Code (or Cursor / Cline / any MCP-aware agent) and let it build the real thing.
Works out of the box with a free key from openai-hub.com, or point it at any OpenAI/Gemini-compatible endpoint you control.
- Replaces specialist design tools. Anything you'd ask Figma AI, v0, or Galileo for — just describe it.
gpt-image-2produces a real high-fidelity image, your agent turns it into code. - Two models, auto-routed:
gpt-image-2(OpenAI schema) andgemini-3.1-flash-image-preview(Gemini schema). Routes by model name, no extra config. - Two tools:
generate-image— text → imageedit-image— image + prompt → image (file path, URL, or base64 input)
- Design presets baked in:
web-landing,mobile-app,dashboard,component,wireframe. Saves you from rewriting "modern Tailwind aesthetic, mobile-first…" every time. - Returns the image inline so the agent can read it and write code in the same turn.
- Configurable: bring your own
BASE_URLandAPI_KEY, or use the defaults.
# In your MCP client config — no global install needed
npx -y gpt-image-2-mcp-serverclaude mcp add gpt-image-2 \
--env API_KEY=sk-xxxxx \
-- npx -y gpt-image-2-mcp-serverAdd to your mcp.json / settings:
{
"mcpServers": {
"gpt-image-2": {
"command": "npx",
"args": ["-y", "gpt-image-2-mcp-server"],
"env": {
"API_KEY": "sk-xxxxx"
}
}
}
}Default BASE_URL is https://api.openai-hub.com — a multi-model hub that proxies both OpenAI and Gemini.
You can also point it at:
- OpenAI directly:
BASE_URL=https://api.openai.com - Google directly:
BASE_URL=https://generativelanguage.googleapis.com - Any other OpenAI/Gemini-compatible proxy
| Env var | Default | Description |
|---|---|---|
API_KEY |
(required) | Your provider key |
BASE_URL |
https://api.openai-hub.com |
Provider endpoint |
DEFAULT_MODEL |
gpt-image-2 |
Used when the tool call omits model |
DEFAULT_OUTPUT_DIR |
./generated_images |
Where images are saved |
| Param | Type | Default | Notes |
|---|---|---|---|
prompt |
string | (required) | Image description |
model |
enum | gpt-image-2 |
gpt-image-2 or gemini-3.1-flash-image-preview |
aspect_ratio |
enum | 1:1 |
1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9 |
quality |
enum | auto |
auto, low, medium, high (gpt-image-2 only) |
resolution |
enum | 2K |
1K, 2K, 4K |
n |
int | 1 |
1–4 |
template |
enum | — | web-landing, mobile-app, dashboard, component, wireframe |
output_dir |
string | env default | Save directory |
filename |
string | timestamp | Custom filename prefix (no extension) |
Same as above plus:
| Param | Type | Notes |
|---|---|---|
source_image |
string | Local path / URL / data:image/...;base64,... |
mask |
string | Optional mask (gpt-image-2 only) |
In Claude Code:
You: Generate a landing page hero for a B2B SaaS analytics tool.
Use the web-landing template, 16:9, then build the React +
Tailwind component matching that design.
Claude: [calls generate-image with template=web-landing, aspect_ratio=16:9]
[reads the returned image]
[writes Hero.tsx that matches]
Iterate by editing:
You: The headline is too small in the mockup. Edit the image to make it
larger, then update the component.
Claude: [calls edit-image with source_image=./generated_images/...png]
api.openai-hub.com lets one key reach gpt-image-2, Gemini, Grok image, and the rest. If you prefer to bring your own keys for each provider, set BASE_URL per-provider and run multiple instances of this MCP under different names — that works too.
git clone https://github.com/openai-hub/gpt-image-2-mcp-server.git
cd gpt-image-2-mcp-server
npm install
npm run build
node dist/index.js # speaks MCP over stdio — wire it into your clientTwo smoke scripts live at the repo root:
# Hits the raw OpenAI + Gemini endpoints directly — confirms the hub
# accepts both schemas at the URLs this MCP routes to.
API_KEY=sk-xxx node smoke.mjs
# End-to-end MCP test: spawns dist/index.js, calls generate-image,
# verifies a PNG lands on disk.
API_KEY=sk-xxx node smoke-mcp.mjsUse these when adding a new model or swapping in a different BASE_URL.
MIT
✨ Powered by openai-hub.com — multi-model image gen for AI agents.