image-gen-mcp
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., "@image-gen-mcpGenerate an image of a sunset over the ocean."
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.
image-gen-mcp
English | 中文
A multi-provider AI image generation MCP server that gives image generation capabilities to agents without them (e.g. Claude Code).
Unified abstraction:
ImageProviderinterface — adding a provider = one adapter file + one registry entryMulti-provider failover: priority routing, retries, automatic fallback to the next provider until success or the max failover count
Three-layer config: defaults → environment variables → CLI args (args win)
SDK selection (by priority): official SDK → compatible SDK → fetch. Current state:
google— official @google/genai SDK (Gemini image models / Imagen)openai/openrouter/grok/siliconflow/volcengine— officialopenaiSDKzhipu(CogView) /dashscope(Wan) — no active official Node SDK, but their image APIs are OpenAI-compatible, reusing theopenaiSDK (compatible-SDK path)
Output modes:
url/base64/file(saved locally), configurable globally or per callTransport: stdio, installable via
npx
Quick Start
# After publishing
npx @inferai/image-gen-mcp
# Local development
pnpm install && pnpm build
node dist/index.jsConfigure it as a stdio MCP server in your client. Windows — Claude Desktop: %APPDATA%\Claude\claude_desktop_config.json; Claude Code: ~/.claude.json (C:\Users\<user>\.claude.json). cmd /c is required to resolve npx:
{
"mcpServers": {
"image-gen": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@inferai/image-gen-mcp"],
"env": {
"IMAGE_MCP_OPENAI_API_KEY": "sk-...",
"IMAGE_MCP_ZHIPU_API_KEY": "..."
}
}
}
}Linux / macOS — Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or ~/.config/Claude/claude_desktop_config.json (Linux); Claude Code: ~/.claude.json:
{
"mcpServers": {
"image-gen": {
"command": "npx",
"args": ["-y", "@inferai/image-gen-mcp"],
"env": {
"IMAGE_MCP_OPENAI_API_KEY": "sk-...",
"IMAGE_MCP_ZHIPU_API_KEY": "..."
}
}
}
}Providers are auto-discovered: a provider is enabled iff its API key is configured — no provider list to maintain. Set IMAGE_MCP_<ID>_API_KEY (or --<id>-api-key) for exactly the providers you want.
Related MCP server: imagen-mcp
Configuration
All settings follow a three-layer override: defaults → IMAGE_MCP_* env vars → --key=value args.
Global
Setting | Env var | args | Default |
Enabled providers | — (auto-discovery) | — | Every provider with a configured API key, in registry order |
Max retries (within one provider) |
|
|
|
Max failovers |
|
|
|
Retry backoff base (ms, exponential) |
|
|
|
Request timeout (ms) |
|
|
|
Output mode |
|
|
|
Directory for file mode |
|
|
|
Providers (<ID> per table below)
Env var | args | Notes |
|
| Required (provider is disabled without it) |
|
| Overrides the default endpoint |
|
| Overrides the default model |
|
| Lower number wins; defaults to registry order |
ID | Default endpoint | Default model | Notes |
|
|
| OpenAI |
|
| none ( | Aggregator; model names like |
|
|
| xAI |
|
| none ( | SiliconFlow |
|
| none ( | ByteDance Volcano Ark (Doubao Seedream etc.) |
|
|
| Zhipu CogView |
|
|
| Alibaba Wan |
| —(SDK-managed) |
| Google Gemini / Imagen |
Example (env vars):
export IMAGE_MCP_OPENAI_API_KEY=sk-...
export IMAGE_MCP_ZHIPU_API_KEY=...
export IMAGE_MCP_GOOGLE_API_KEY=...
export IMAGE_MCP_MAX_RETRIES=3
export IMAGE_MCP_MAX_DEGRADATIONS=2Example (args override):
npx @inferai/image-gen-mcp \
--openai-api-key=sk-... \
--zhipu-api-key=... \
--max-retries=0 \
--max-degradations=1 \
--output-mode=file \
--output-dir=./imagesMCP Tools
generate_image
Parameter | Required | Description |
| ✓ | Image content description |
| Explicit provider id (must be enabled); defaults to automatic priority routing | |
| Overrides the provider default model (required for providers without one) | |
| e.g. | |
| 1–4, number of images | |
|
|
Returns JSON with the actual provider/model used and the full failover attempt log:
{
"provider": "openai",
"model": "gpt-image-1",
"images": [{ "format": "url", "data": "https://...", "mimeType": "image/png" }],
"attempts": [
{ "provider": "zhipu", "model": "cogview-4-flash", "status": "failed", "error": "429 rate limited" },
{ "provider": "openai", "model": "gpt-image-1", "status": "success" }
]
}filemode: images are written toIMAGE_MCP_OUTPUT_DIR, the local absolute path is returnedurlmode: base64 results are converted todata:URIs automatically
list_providers
Lists enabled providers (id / default model / endpoint / priority); no API key required.
Retry & Failover Semantics
Try providers in priority ascending order; within a provider: retryable errors
(network/timeout/429/5xx) retry with exponential backoff up to maxRetries,
non-retryable (401/400 etc.) fail it immediately; on provider failure fall back to
the next, up to maxDegradations times; total failure returns an error with the full
attempt summary.max-retries=0: each provider is tried oncemax-degradations=0: only the highest-priority provider is usedAPI keys are sanitized in all error messages and attempt logs
Development
pnpm install
pnpm dev # rslib watch
pnpm test # rstest unit tests
pnpm check # biome format + lint
pnpm build # build dist
node scripts/smoke.mjs # stdio end-to-end smoke test (requires a configured key)Integration tests need real API keys and are not part of the suite; verify manually:
IMAGE_MCP_OPENAI_API_KEY=sk-... node dist/index.js # then call via an MCP clientDebugging with MCP Inspector:
pnpm dlx @modelcontextprotocol/inspector node dist/index.js --xxx-api-key=xxx --xxx2-api-key=xxxPublishing
Publishing is automated (.github/workflows/publish.yml with the changesets/action select-mode flow): push to main creates a version PR, and merging it publishes to npm automatically.
pnpm changeset # record changes (the only manual step), then merge the PR to mainpnpm release exists as a manual fallback. CI runs check + test + build on every PR; local git hooks (simple-git-hooks) run pnpm check pre-commit and pnpm format pre-push.
License
MIT
This server cannot be installed
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 Servers
- FlicenseAqualityNot gradedmaintenanceEnables AI agents to analyze images through vision AI providers (Gemini, OpenAI, Claude), performing tasks like image description, object detection with bounding boxes, region-specific analysis, and precise color extraction without consuming context window with raw pixels.4
- AlicenseAqualityBmaintenanceEnables intelligent multi-provider image generation through OpenAI and Google Gemini APIs with automatic provider selection, support for reference images, real-time data grounding, and conversational refinement.8MIT
- AlicenseNot gradedqualityDmaintenanceProvides multi-provider image generation with automatic fallback across services like Pollinations.ai, Cloudflare, and Hugging Face. It features specialized pixel art generation, cost tracking, and automatic saving of generated visual assets to disk.MIT
- FlicenseNot gradedqualityDmaintenanceProvides AI agents and coding assistants with image generation and editing capabilities using OpenAI's GPT-image-1 model, with support for local or Supabase storage.3
Related MCP Connectors
Generate images, GIFs, and PDFs from HTML, URLs, or templates — from your AI agent.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Generate images with any major model — one API key, one prepaid balance, one MCP.
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/aesoper101/image-gen-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server