cf-image-gen MCP Server
Generates images from text prompts using Stable Diffusion via Cloudflare Workers AI.
Generates images and text using Google Gemini models through Cloudflare AI Gateway.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
cf-image-gen MCP Server
Generate images and video from text prompts using Cloudflare Workers AI (Stable Diffusion) or Google Gemini models via Cloudflare AI Gateway.
Architecture
Text Prompt → cf-image-gen MCP Server → Cloudflare AI Gateway
├── Workers AI (Stable Diffusion XL)
├── Gemini Image Models (generateContent)
└── Gemini Text Models (Interactions API)Related MCP server: pixel-surgeon-mcp
Models
Workers AI (Direct)
Model | ID | Output |
Stable Diffusion XL |
| 1024×1024 PNG |
Google Gemini (via AI Gateway)
Use google-ai-studio/{modelName} format.
Image Models (generateContent)
Model | Format | Notes |
| image/jpeg | No text, 1120 image tokens |
| image/jpeg | +157 reasoning tokens |
| image/png | Returns text + image |
Text Models (Interactions API)
Model | Notes |
| Latest text model |
Prerequisites
Node.js 18+
Cloudflare account with:
Account ID
API Token (Workers AI)
AI Gateway ID
AI Gateway Auth Token (for Gemini models)
Google AI Studio API key (for Gemini models)
Environment Variables
Variable | Required | Description |
| ✅ | Cloudflare Account ID |
| ✅ | Cloudflare API Token |
| For Gemini | AI Gateway ID |
| For Gemini | Google AI Studio API Key |
| For Gemini | AI Gateway Auth Token |
| ❌ | Output directory (default: |
Usage
Via MCP Tool
{
"prompt": "a samurai warrior standing on a mountain at sunset, pixel art style, 8-bit game aesthetic",
"model": "google-ai-studio/gemini-3.1-flash-image"
}Or with Stable Diffusion (default):
{
"prompt": "a red apple on white background"
}Example Output
Gemini 3.1 Flash Image — google-ai-studio/gemini-3.1-flash-image
Prompt: "a samurai warrior standing on a mountain at sunset, pixel art style, 8-bit game aesthetic"

How It Works
Workers AI path: Direct call to
POST /accounts/{id}/ai/run/{model}with Cloudflare API TokenAI Gateway path: Routes through
gateway.ai.cloudflare.com/v1/{account}/{gateway}/Image-capable models →
v1beta/models/{model}:generateContentwithgenerationConfig.responseModalities: ["IMAGE"]Text-only models (gemini-3-flash*) →
v1beta/interactionswith plain string input
Development
# Install dependencies
cd .opencode/mcp/cf-image-gen
npm install
# Run standalone (stdio)
# Configure in opencode.jsonc as MCP serverLicense
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Generate images, videos, voiceovers, and captions from a chat prompt.
Generate AI images, videos and music from your AI client.
Generate and upscale AI images, videos and audio.
Create images and videos from prompts, with options for image mixing, reference images, and start/…
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to generate images using Cloudflare Workers AI models directly through the Model Context Protocol. It supports various models like Flux and Stable Diffusion, providing seamless image generation and storage via Cloudflare R2.7Apache 2.0
- AlicenseAqualityDmaintenanceAI image and video generation, editing, and region repair via Gemini, OpenAI, and Grok1145 npm5MIT
- AlicenseNot gradedqualityDmaintenanceImage generation MCP server running on Cloudflare Workers, supporting multiple models like FLUX and SDXL with OpenAI-compatible endpoints.MIT
- AlicenseNot gradedqualityDmaintenanceProvides image generation tools powered by OpenRouter, running on Cloudflare Workers.39 npmMIT