Stable Diffusion WebUI
About
Integrates with Stable Diffusion WebUI to provide text-to-image generation with extensive parameter control and metadata embedding
Details
- Author
- ichigo3766
- Repository
- Ichigo3766/image-gen-mcp
- GitHub stars
- 8
- Downloads
- 491
- License
- MIT License
- Categories
- Developer Tools, AI, Other, Design, Media, Security, Infrastructure
- Tags
- #web
Jump to
- Generate images from text prompts using Stable Diffusion.
- List and switch between available Stable Diffusion models.
- Retrieve available upscaler models.
- Upscale existing images with configurable settings.
- Supports negative prompts, seeds, batch generation, face restoration, and tiling.
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Stable Diffusion WebUICommand (node, npx, python, etc.)nodeArguments-
Argument 1
/path/to/image-gen-mcp/build/index.js
Environment-
SD_AUTH_PASS
your-password -
SD_AUTH_USER
your-username -
SD_WEBUI_URL
http://your-sd-webui-url:7860 -
SD_OUTPUT_DIR
/path/to/output/directory -
SD_UPSCALER_1
R-ESRGAN 4x+ -
SD_UPSCALER_2
None -
SD_RESIZE_MODE
0 -
SD_UPSCALE_WIDTH
512 -
SD_UPSCALE_HEIGHT
512 -
SD_UPSCALE_MULTIPLIER
4
Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
-
Argument 1
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
1. Clone the repository:
git clone https://github.com/Ichigo3766/image-gen-mcp.git
cd image-gen-mcp
2. Install dependencies:
npm install
3. Build the server:
npm run build
4. 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 instance
- SD_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 saved
- SD_RESIZE_MODE: Default upscaling mode (0 for multiplier, 1 for dimensions)
- SD_UPSCALE_MULTIPLIER: Default upscale multiplier when resize_mode is 0
- SD_UPSCALE_WIDTH: Default target width when resize_mode is 1
- SD_UPSCALE_HEIGHT: Default target height when resize_mode is 1
- SD_UPSCALER_1: Default primary upscaler model
- SD_UPSCALER_2: Default secondary upscaler model
generate_image
Generate images using Stable Diffusion. Parameters: prompt (required), negative_prompt, steps, width, height, cfg_scale, sampler_name, scheduler_name, seed, batch_size, restore_faces, tiling, output_path.
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).
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), resize_mode, upscaling_resize, upscaling_resize_w, upscaling_resize_h, upscaler_1, upscaler_2, output_path.
- generate_image - Generate images using Stable Diffusion
- Parameters:
- prompt (required): Text description of the desired image
- negative_prompt: Things to exclude from the image
- steps: 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 restoration
- tiling: Generate tileable images
- output_path: Custom output path for the generated image
- 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
- 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 upscale
- resize_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
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"stable diffusion webui": {
"env": {
"SD_AUTH_PASS": "your-password",
"SD_AUTH_USER": "your-username",
"SD_WEBUI_URL": "http://your-sd-webui-url:7860",
"SD_OUTPUT_DIR": "/path/to/output/directory",
"SD_UPSCALER_1": "R-ESRGAN 4x+",
"SD_UPSCALER_2": "None",
"SD_RESIZE_MODE": "0",
"SD_UPSCALE_WIDTH": "512",
"SD_UPSCALE_HEIGHT": "512",
"SD_UPSCALE_MULTIPLIER": "4"
},
"args": [
"/path/to/image-gen-mcp/build/index.js"
],
"command": "node"
}
}
}
Linux
{
"env": {
"SD_AUTH_PASS": "your-password",
"SD_AUTH_USER": "your-username",
"SD_WEBUI_URL": "http://your-sd-webui-url:7860",
"SD_OUTPUT_DIR": "/path/to/output/directory",
"SD_UPSCALER_1": "R-ESRGAN 4x+",
"SD_UPSCALER_2": "None",
"SD_RESIZE_MODE": "0",
"SD_UPSCALE_WIDTH": "512",
"SD_UPSCALE_HEIGHT": "512",
"SD_UPSCALE_MULTIPLIER": "4"
},
"args": [
"/path/to/image-gen-mcp/build/index.js"
],
"command": "node"
}
Macos
{
"env": {
"SD_AUTH_PASS": "your-password",
"SD_AUTH_USER": "your-username",
"SD_WEBUI_URL": "http://your-sd-webui-url:7860",
"SD_OUTPUT_DIR": "/path/to/output/directory",
"SD_UPSCALER_1": "R-ESRGAN 4x+",
"SD_UPSCALER_2": "None",
"SD_RESIZE_MODE": "0",
"SD_UPSCALE_WIDTH": "512",
"SD_UPSCALE_HEIGHT": "512",
"SD_UPSCALE_MULTIPLIER": "4"
},
"args": [
"/path/to/image-gen-mcp/build/index.js"
],
"command": "node"
}
Windows
{
"env": {
"SD_AUTH_PASS": "your-password",
"SD_AUTH_USER": "your-username",
"SD_WEBUI_URL": "http://your-sd-webui-url:7860",
"SD_OUTPUT_DIR": "/path/to/output/directory",
"SD_UPSCALER_1": "R-ESRGAN 4x+",
"SD_UPSCALER_2": "None",
"SD_RESIZE_MODE": "0",
"SD_UPSCALE_WIDTH": "512",
"SD_UPSCALE_HEIGHT": "512",
"SD_UPSCALE_MULTIPLIER": "4"
},
"args": [
"/path/to/image-gen-mcp/build/index.js"
],
"command": "node"
}
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">
</a>
Installation
Prerequisites
- Node.js - Access to a Stable Diffusion WebUI instance with API enabled - The WebUI must have--api flag enabled when starting
Setup
1. Clone the repository:
git clone https://github.com/Ichigo3766/image-gen-mcp.git
cd image-gen-mcp
2. Install dependencies:
npm install
3. Build the server:
npm run build
4. 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 instance
- SD_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 saved
- SD_RESIZE_MODE: Default upscaling mode (0 for multiplier, 1 for dimensions)
- SD_UPSCALE_MULTIPLIER: Default upscale multiplier when resize_mode is 0
- SD_UPSCALE_WIDTH: Default target width when resize_mode is 1
- SD_UPSCALE_HEIGHT: Default target height when resize_mode is 1
- SD_UPSCALER_1: Default primary upscaler model
- SD_UPSCALER_2: Default secondary upscaler model
Features
Tools
-generate_image - Generate images using Stable Diffusion
- Parameters:
- prompt (required): Text description of the desired image
- negative_prompt: Things to exclude from the image
- steps: 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 restoration
- tiling: Generate tileable images
- output_path: Custom output path for the generated image
- 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
- 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 upscale
- resize_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
Development
For development with auto-rebuild:
npm run watch
Error Handling
Common issues and solutions:
1. Make sure your Stable Diffusion WebUI is running with the --api flag
2. Check if the WebUI URL is accessible from where you're running the MCP server
3. If using authentication, ensure credentials are correct
4. Verify the output directory exists and has write permissions
5. 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.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





