Image-Generation
This MCP server provides image generation capabilities using the Replicate Flux model.
claude mcp add --transport stdio gongrzhe-image-generation-mcp-server npx -y @gongrzhe/image-gen-server \ --env MODEL="alternative-model-name" \ --env REPLICATE_API_TOKEN="your-replicate-api-token"
How to use
This MCP server provides image generation capabilities powered by the Replicate Flux model. The server exposes a tool named generate_image under the image-gen MCP server. To use it, you send a request via the MCP interface specifying the server_name image-gen, tool_name generate_image, and a set of arguments such as prompt, aspect_ratio, output_format, seed, and num_outputs. The tool will return URLs to the generated images. Typical usage involves providing a descriptive prompt and optional parameters to control size, style, and variety. If you don’t specify a model, the configured default Flux model (black-forest-labs/flux-schnell) will be used unless you override it with the MODEL environment variable.
Example usage in code: const result = await use_mcp_tool({ server_name: "image-gen", tool_name: "generate_image", arguments: { prompt: "A futuristic city at dusk", aspect_ratio: "16:9", output_format: "png", num_outputs: 2 } });
The tool returns an array of URLs pointing to the generated images. You can adjust the prompt and optional parameters to explore different visuals and aspect ratios until you reach a desirable result.
How to install
Prerequisites:
- Node.js (recommended latest LTS) and npm installed on your system.
- Access token for Replicate (see Get Your Replicate API Token in the README).
Installation steps:
-
Install via NPX (no local setup required):
- No local installation beyond running the MCP configuration with npx as shown in mcp_config.
-
Optional local installation (preferred if you want to host locally):
# Global installation
npm install -g @gongrzhe/image-gen-server
# Or local installation inside a project
npm install @gongrzhe/image-gen-server
- Configure Claude Desktop (or your MCP runner) to use the NPX method (recommended) or the local node-based path as shown in the README configuration.
- NPX configuration example is already provided in the mcp_config section above.
- If you install locally, point the server to the built entry file (for example, /path/to/image-gen-server/build/index.js) in your Claude Desktop MCP config.
- Obtain and set your Replicate API token in the MCP config environment variables:
REPLICATE_API_TOKEN=your-replicate-api-token
MODEL=your-chosen-model (optional; defaults to black-forest-labs/flux-schnell)
- Ensure the MCP configuration JSON is saved to Claude Desktop (or your MCP runner) under the appropriate profile.
Additional notes
Notes and tips:
- The default Flux model is black-forest-labs/flux-schnell. Override with the MODEL environment variable if you need a different model.
- Required environment variable: REPLICATE_API_TOKEN. Without it, image generation requests will fail.
- The generate_image tool supports prompt, seed, aspect_ratio, output_format (webp, jpg, png), and num_outputs (1-4). Adjust these to balance quality, speed, and variety.
- If you encounter rate limits or API errors, verify your Replicate API token and the model name, and ensure your token has the necessary permissions.
- When using NPX, you don’t need a local install; the server runs directly from npm’s registry. If you install locally, ensure your node path in the MCP config points to the built entry file.
- For troubleshooting, check the MCP server’s logs for environment variable reads and the actual API calls to Replicate.
Related MCP Servers
zen
Selfhosted notes app. Single golang binary, notes stored as markdown within SQLite, full-text search, very low resource usage
MCP -Deepseek_R1
A Model Context Protocol (MCP) server implementation connecting Claude Desktop with DeepSeek's language models (R1/V3)
mcp-fhir
A Model Context Protocol implementation for FHIR
mcp
Inkdrop Model Context Protocol Server
mcp-appium-gestures
This is a Model Context Protocol (MCP) server providing resources and tools for Appium mobile gestures using Actions API..
dubco -npm
The (Unofficial) dubco-mcp-server enables AI assistants to manage Dub.co short links via the Model Context Protocol. It provides three MCP tools: create_link for generating new short URLs, update_link for modifying existing links, and delete_link for removing short links.