
Image Generation MCP Server
An MCP (Model Context Protocol) server implementation for generating images using Replicate's black-forest-labs/flux-schnell
model.
Ideally to be used with Cursor's MCP feature, but can be used with any MCP client.
Features
- Generate images from text prompts
- Configurable image parameters (resolution, aspect ratio, quality)
- Save generated images to specified directory
- Full MCP protocol compliance
- Error handling and validation
Prerequisites
- Node.js 16+
- Replicate API token
- TypeScript SDK for MCP
Setup
-
Clone the repository
-
Install dependencies:
npm install
-
Add your Replicate API token directly in the code at
src/imageService.ts
by updating theapiToken
constant:// No environment variables are used since they can't be easily set in cursor const apiToken = "your-replicate-api-token-here";
Note: If using with Claude, you can create a
.env
file in the root directory and set your API token there:REPLICATE_API_TOKEN=your-replicate-api-token-here
Then build the project:
npm run build
Usage
To use with cursor:
- Go to Settings
- Select Features
- Scroll down to "MCP Servers"
- Click "Add new MCP Server"
- Set Type to "Command"
- Set Command to:
node ./path/to/dist/server.js
API Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
prompt |
string | Yes | - | Text prompt for image generation |
output_dir |
string | Yes | - | Server directory path to save generated images |
go_fast |
boolean | No | false | Enable faster generation mode |
megapixels |
string | No | "1" | Resolution quality ("1", "2", "4") |
num_outputs |
number | No | 1 | Number of images to generate (1-4) |
aspect_ratio |
string | No | "1:1" | Aspect ratio ("1:1", "4:3", "16:9") |
output_format |
string | No | "webp" | Image format ("webp", "png", "jpeg") |
output_quality |
number | No | 80 | Compression quality (1-100) |
num_inference_steps |
number | No | 4 | Number of denoising steps (4-20) |
Example Request
{
"prompt": "black forest gateau cake spelling out 'FLUX SCHNELL'",
"output_dir": "/var/output/images",
"filename": "black_forest_cake",
"output_format": "webp"
"go_fast": true,
"megapixels": "1",
"num_outputs": 2,
"aspect_ratio": "1:1"
}
Example Response
{
"image_paths": [
"/var/output/images/output_0.webp",
"/var/output/images/output_1.webp"
],
"metadata": {
"model": "black-forest-labs/flux-schnell",
"inference_time_ms": 2847
}
}
Error Handling
The server handles the following error types:
- Validation errors (invalid parameters)
- API errors (Replicate API issues)
- Server errors (filesystem, permissions)
- Unknown errors (unexpected issues)
Each error response includes:
- Error code
- Human-readable message
- Detailed error information
License
ISC
相关推荐
I find academic articles and books for research and literature reviews.
Confidential guide on numerology and astrology, based of GG33 Public information
Advanced software engineer GPT that excels through nailing the basics.
Take an adjectivised noun, and create images making it progressively more adjective!
Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.
Découvrez la collection la plus complète et la plus à jour de serveurs MCP sur le marché. Ce référentiel sert de centre centralisé, offrant un vaste catalogue de serveurs MCP open-source et propriétaires, avec des fonctionnalités, des liens de documentation et des contributeurs.
Manipulation basée sur Micropython I2C de l'exposition GPIO de la série MCP, dérivée d'Adafruit_MCP230XX
L'application tout-en-un desktop et Docker AI avec chiffon intégré, agents AI, constructeur d'agent sans code, compatibilité MCP, etc.
Un puissant plugin Neovim pour gérer les serveurs MCP (Protocole de contexte modèle)
MCP Server pour récupérer le contenu de la page Web à l'aide du navigateur sans tête du dramwright.
Pont entre les serveurs Olllama et MCP, permettant aux LLM locaux d'utiliser des outils de protocole de contexte de modèle
La communauté du curseur et de la planche à voile, recherchez des règles et des MCP
🧑🚀 全世界最好的 LLM 资料总结 (数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Résumé des meilleures ressources LLM du monde.
Plateforme d'automatisation de workflow à code équitable avec des capacités d'IA natives. Combinez le bâtiment visuel avec du code personnalisé, de l'auto-hôte ou du cloud, 400+ intégrations.
Reviews

user_tBz5cMX8
I've been using ai-image-gen-mcp for all my AI image generation needs, and it's fantastic! The tool, developed by mikeyny, provides reliable and impressive results every time. The interface is user-friendly, making it easy to create stunning images effortlessly. Highly recommended for anyone looking into AI-driven image creation! Check it out on GitHub: https://github.com/mikeyny/ai-image-gen-mcp