image-gen MCP Server
A MCP server that integrates with Stable Diffusion WebUI to provide text-to-image generation and image upscaling capabilities through simple API calls.
Ichigo3766
Tools
generate_image
Generate an image using Stable Diffusion
get_sd_models
Get list of available Stable Diffusion models
set_sd_model
Set the active Stable Diffusion model
get_sd_upscalers
Get list of available upscaler models
upscale_images
Upscale one or more images using Stable Diffusion
README
image-gen MCP Server
A MCP server that provides text-to-image generation capabilities using Stable Diffusion WebUI API (ForgeUI/AUTOMATIC-1111).
<a href="https://glama.ai/mcp/servers/@Ichigo3766/image-gen-mcp"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@Ichigo3766/image-gen-mcp/badge" alt="Image Generation Server MCP server" /> </a>
Installation
Prerequisites
- Node.js
- Access to a Stable Diffusion WebUI instance with API enabled
- The WebUI must have
--apiflag enabled when starting
Setup
- Clone the repository:
git clone https://github.com/Ichigo3766/image-gen-mcp.git
cd image-gen-mcp
- Install dependencies:
npm install
- Build the server:
npm run build
- Add the server configuration to your environment:
{
"mcpServers": {
"image-gen": {
"command": "node",
"args": [
"/path/to/image-gen-mcp/build/index.js"
],
"env": {
"SD_WEBUI_URL": "http://your-sd-webui-url:7860",
"SD_AUTH_USER": "your-username", // Optional: if authentication is enabled
"SD_AUTH_PASS": "your-password", // Optional: if authentication is enabled
"SD_OUTPUT_DIR": "/path/to/output/directory",
"SD_RESIZE_MODE": "0", // Optional: upscaling mode (0=multiplier, 1=dimensions)
"SD_UPSCALE_MULTIPLIER": "4", // Optional: default upscale multiplier
"SD_UPSCALE_WIDTH": "512", // Optional: default upscale width
"SD_UPSCALE_HEIGHT": "512", // Optional: default upscale height
"SD_UPSCALER_1": "R-ESRGAN 4x+", // Optional: default primary upscaler
"SD_UPSCALER_2": "None" // Optional: default secondary upscaler
}
}
}
}
Replace the environment variables with your values:
SD_WEBUI_URL: URL of your Stable Diffusion WebUI instanceSD_AUTH_USER: Username for basic auth (if enabled)SD_AUTH_PASS: Password for basic auth (if enabled)SD_OUTPUT_DIR: Directory where generated images will be savedSD_RESIZE_MODE: Default upscaling mode (0 for multiplier, 1 for dimensions)SD_UPSCALE_MULTIPLIER: Default upscale multiplier when resize_mode is 0SD_UPSCALE_WIDTH: Default target width when resize_mode is 1SD_UPSCALE_HEIGHT: Default target height when resize_mode is 1SD_UPSCALER_1: Default primary upscaler modelSD_UPSCALER_2: Default secondary upscaler model
Features
Tools
-
generate_image- Generate images using Stable Diffusion- Parameters:
prompt(required): Text description of the desired imagenegative_prompt: Things to exclude from the imagesteps: Number of sampling steps (default: 4, range: 1-150)width: Image width (default: 1024, range: 512-2048)height: Image height (default: 1024, range: 512-2048)cfg_scale: CFG scale (default: 1, range: 1-30)sampler_name: Sampling algorithm (default: "Euler")scheduler_name: Scheduler algorithm (default: "Simple")seed: Random seed (-1 for random)batch_size: Number of images to generate (default: 1, max: 4)restore_faces: Enable face restorationtiling: Generate tileable imagesoutput_path: Custom output path for the generated image
- Parameters:
-
get_sd_models- Get list of available Stable Diffusion models- No parameters required
- Returns an array of model names
-
set_sd_model- Set the active Stable Diffusion model- Parameters:
model_name(required): Name of the model to set as active
- Parameters:
-
get_sd_upscalers- Get list of available upscaler models- No parameters required
- Returns an array of upscaler names
-
upscale_images- Upscale one or more images using Stable Diffusion- Parameters:
images(required): Array of image file paths to upscaleresize_mode: 0 for multiplier mode, 1 for dimension mode (default: from env)upscaling_resize: Upscale multiplier when resize_mode=0 (default: from env)upscaling_resize_w: Target width in pixels when resize_mode=1 (default: from env)upscaling_resize_h: Target height in pixels when resize_mode=1 (default: from env)upscaler_1: Primary upscaler model (default: from env)upscaler_2: Secondary upscaler model (default: from env)output_path: Custom output directory for upscaled images
- Parameters:
Development
For development with auto-rebuild:
npm run watch
Error Handling
Common issues and solutions:
- Make sure your Stable Diffusion WebUI is running with the
--apiflag - Check if the WebUI URL is accessible from where you're running the MCP server
- If using authentication, ensure credentials are correct
- Verify the output directory exists and has write permissions
- When upscaling, ensure the input image files exist and are readable
License
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
Recommended Servers
dbt Semantic Layer MCP Server
A server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.
mixpanel
Connect to your Mixpanel data. Query events, retention, and funnel data from Mixpanel analytics.
Sequential Thinking MCP Server
This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.
MCP PubMed Search
Server to search PubMed (PubMed is a free, online database that allows users to search for biomedical and life sciences literature). I have created on a day MCP came out but was on vacation, I saw someone post similar server in your DB, but figured to post mine.
Crypto Price & Market Analysis MCP Server
A Model Context Protocol (MCP) server that provides comprehensive cryptocurrency analysis using the CoinCap API. This server offers real-time price data, market analysis, and historical trends through an easy-to-use interface.
Nefino MCP Server
Provides large language models with access to news and information about renewable energy projects in Germany, allowing filtering by location, topic (solar, wind, hydrogen), and date range.
Vectorize
Vectorize MCP server for advanced retrieval, Private Deep Research, Anything-to-Markdown file extraction and text chunking.
mcp-solver
A Model Context Protocol (MCP) server that exposes MiniZinc constraint solving capabilities to Large Language Models.
Excel Reader Server
A Model Context Protocol (MCP) server that provides tools for reading Excel (xlsx) files, enabling extraction of data from entire workbooks or specific sheets with results returned in structured JSON format.
MATLAB MCP Server
Integrates MATLAB with AI to execute code, generate scripts from natural language, and access MATLAB documentation seamlessly.