Integrations
Integrates with Replicate's 'black-forest-labs/flux-schnell' model to generate images from text prompts
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:Copy
- Add your Replicate API token directly in the code at
src/imageService.ts
by updating theapiToken
constant:CopyNote: If using with Claude, you can create a
.env
file in the root directory and set your API token there:Then build the project:CopyCopy
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
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
You must be authenticated.
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Tools
Enables users to generate images from text prompts using Replicate's model, with configurable parameters and full MCP protocol compliance.
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityA MCP server that enables Claude and other MCP-compatible assistants to generate images from text prompts using Together AI's image generation models.Last updated -12TypeScriptMIT License
- -securityAlicense-qualityProvides image generation capabilities using the Flux Schnell model on Replicate, allowing users to create images from text prompts.Last updated -1JavaScriptMIT License
- -securityAlicense-qualityA MCP server that integrates with Cursor IDE to generate images based on text descriptions using JiMeng AI, allowing users to create and save custom images directly within their development environment.Last updated -82PythonMIT License
- -security-license-qualityA TypeScript-based MCP server that lets users generate images using OpenAI's dall-e-3 model by providing a prompt and image name.Last updated -1