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.
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., "@cf-image-gen MCP ServerCreate an image of a futuristic city skyline at night."
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.
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: Cloudflare AI Image 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 installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- 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/nolandpham/cf-gen-img-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server