Image Generation MCP Server
image-gen MCP 服务器
使用稳定的 Diffusion WebUI API(ForgeUI/AUTOMATIC-1111)提供文本到图像生成功能的 MCP 服务器。
安装
先决条件
Node.js
访问已启用 API 的稳定 Diffusion WebUI 实例
WebUI 启动时必须启用
--api标志
设置
克隆存储库:
git clone https://github.com/Ichigo3766/image-gen-mcp.git
cd image-gen-mcp安装依赖项:
npm install构建服务器:
npm run build将服务器配置添加到您的环境中:
{
"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
}
}
}
}将环境变量替换为您的值:
SD_WEBUI_URL:您的稳定 Diffusion WebUI 实例的 URLSD_AUTH_USER:基本身份验证的用户名(如果启用)SD_AUTH_PASS:基本身份验证的密码(如果启用)SD_OUTPUT_DIR:生成的图像的保存目录SD_RESIZE_MODE:默认放大模式(0 表示乘数,1 表示尺寸)SD_UPSCALE_MULTIPLIER:当 resize_mode 为 0 时默认的放大倍数SD_UPSCALE_WIDTH:resize_mode 为 1 时的默认目标宽度SD_UPSCALE_HEIGHT:resize_mode 为 1 时的默认目标高度SD_UPSCALER_1:默认主升频器模型SD_UPSCALER_2:默认二级升频器模型
Related MCP server: Image Generator MCP Server
特征
工具
generate_image- 使用稳定扩散生成图像参数:
prompt(必需):所需图像的文本描述negative_prompt:需要从图像中排除的内容steps:采样步数(默认值:4,范围:1-150)width:图像宽度(默认值:1024,范围:512-2048)height:图像高度(默认值:1024,范围:512-2048)cfg_scale:CFG 比例(默认值:1,范围:1-30)sampler_name:采样算法(默认值:“欧拉”)scheduler_name:调度程序算法(默认值:“简单”)seed:随机种子(-1 表示随机)batch_size:要生成的图像数量(默认值:1,最大值:4)restore_faces:启用面部恢复tiling:生成可平铺的图像output_path:生成图像的自定义输出路径
get_sd_models- 获取可用的稳定扩散模型列表无需参数
返回模型名称数组
set_sd_model- 设置活动的稳定扩散模型参数:
model_name(必需):要设置为活动的模型的名称
get_sd_upscalers- 获取可用的升级器模型列表无需参数
返回升频器名称数组
upscale_images- 使用稳定扩散对一个或多个图像进行升级参数:
images(必需):要放大的图像文件路径数组resize_mode:0 为乘数模式,1 为维度模式(默认值:来自环境)upscaling_resize:当 resize_mode=0 时放大倍数(默认值:来自环境)upscaling_resize_w:当 resize_mode=1 时,目标宽度(以像素为单位)(默认值:来自环境)upscaling_resize_h:当 resize_mode=1 时,目标高度(以像素为单位)(默认值:来自环境)upscaler_1:主要升级模型(默认值:来自环境)upscaler_2:二级升频器模型(默认值:来自环境)output_path:放大图像的自定义输出目录
发展
对于使用自动重建的开发:
npm run watch错误处理
常见问题及解决方案:
确保您的稳定扩散 WebUI 使用
--api标志运行检查是否可以从运行 MCP 服务器的位置访问 WebUI URL
如果使用身份验证,请确保凭据正确
验证输出目录是否存在并且具有写入权限
放大时,确保输入图像文件存在且可读
执照
此 MCP 服务器采用 MIT 许可证。这意味着您可以自由使用、修改和分发该软件,但须遵守 MIT 许可证的条款和条件。更多详情,请参阅项目仓库中的 LICENSE 文件。
Available Tools
5 toolsgenerate_imageC
Generate an image using Stable Diffusion
Inputs: prompt (required), batch_size, cfg_scale, distilled_cfg_scale, +10 more.
get_sd_modelsB
Get list of available Stable Diffusion models
Inputs: no named parameters.
get_sd_upscalersB
Get list of available upscaler models
Inputs: no named parameters.
set_sd_modelB
Set the active Stable Diffusion model
Inputs: model_name (required).
upscale_imagesC
Upscale one or more images using Stable Diffusion
Inputs: images (required), output_path, resize_mode, upscaler_1, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose with no overlap: generate_image creates images, get_sd_models and get_sd_upscalers retrieve lists, set_sd_model configures the active model, and upscale_images enhances existing images. The descriptions make it impossible to confuse these tools.
All tools follow a consistent verb_noun pattern with snake_case (e.g., generate_image, get_sd_models, set_sd_model). The naming is predictable and readable throughout the set.
With 5 tools, this is well-scoped for an image generation server, covering core workflows like generation, model management, and upscaling. Each tool earns its place without bloat or thin coverage.
The toolset covers key operations for image generation and enhancement, including model selection and upscaling. A minor gap exists in lacking tools for deleting or managing generated images, but agents can work around this for most use cases.
Maintenance
Related MCP Connectors
MCP server for Qwen Image 3 AI image generation
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
Generate AI images, video, music, and sound effects, and upscale them, from any MCP client.
An MCP server that integrates with Discord to provide AI-powered features.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP Server that integrates with Stability AI's API to provide high-quality image generation, editing, and manipulation capabilities including background removal, outpainting, search-and-replace, and upscaling.84MIT
- AlicenseBqualityDmaintenanceAn MCP server that allows users to generate images using Replicate's Stable Diffusion model and save them to the local filesystem.3MIT
- AlicenseBqualityDmaintenanceA server that integrates ComfyUI with MCP, allowing users to generate images and download them through natural language interactions.422Apache 2.0
- FlicenseAqualityDmaintenanceAn MCP server that provides a standardized interface for accessing WaveSpeed AI's image and video generation capabilities, including text-to-image, image-to-image, inpainting, and dynamic video generation.3-