- Explore MCP Servers
- ai-image-gen-mcp
Ai Image Gen Mcp
What is Ai Image Gen Mcp
ai-image-gen-mcp is an MCP server implementation designed for generating images using the Replicate’s black-forest-labs/flux-schnell model. It allows users to create images from text prompts and is compliant with the MCP protocol.
Use cases
Use cases for ai-image-gen-mcp include generating illustrations for articles, creating unique artwork for social media posts, designing game assets based on narrative prompts, and producing visual content for advertising campaigns.
How to use
To use ai-image-gen-mcp, clone the repository, install dependencies using npm, and add your Replicate API token in the code. Then build the project and configure it within the Cursor settings as a new MCP server.
Key features
Key features include generating images from text prompts, configurable image parameters (resolution, aspect ratio, quality), saving generated images to a specified directory, full MCP protocol compliance, and robust error handling.
Where to use
ai-image-gen-mcp can be used in various fields such as digital art creation, content generation for marketing, game design, and any application requiring automated image generation from textual descriptions.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Ai Image Gen Mcp
ai-image-gen-mcp is an MCP server implementation designed for generating images using the Replicate’s black-forest-labs/flux-schnell model. It allows users to create images from text prompts and is compliant with the MCP protocol.
Use cases
Use cases for ai-image-gen-mcp include generating illustrations for articles, creating unique artwork for social media posts, designing game assets based on narrative prompts, and producing visual content for advertising campaigns.
How to use
To use ai-image-gen-mcp, clone the repository, install dependencies using npm, and add your Replicate API token in the code. Then build the project and configure it within the Cursor settings as a new MCP server.
Key features
Key features include generating images from text prompts, configurable image parameters (resolution, aspect ratio, quality), saving generated images to a specified directory, full MCP protocol compliance, and robust error handling.
Where to use
ai-image-gen-mcp can be used in various fields such as digital art creation, content generation for marketing, game design, and any application requiring automated image generation from textual descriptions.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
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
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
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.