image-gen MCP 服务器
使用稳定的 Diffusion WebUI API(ForgeUI/AUTOMATIC-1111)提供文本到图像生成功能的 MCP 服务器。
安装
先决条件
- Node.js 
- 访问已启用 API 的稳定 Diffusion WebUI 实例 
- WebUI 启动时必须启用 - --api标志
设置
- 克隆存储库: 
- 安装依赖项: 
- 构建服务器: 
- 将服务器配置添加到您的环境中: 
将环境变量替换为您的值:
- SD_WEBUI_URL:您的稳定 Diffusion WebUI 实例的 URL
- SD_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:默认二级升频器模型
特征
工具
- 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:放大图像的自定义输出目录
 
 
发展
对于使用自动重建的开发:
错误处理
常见问题及解决方案:
- 确保您的稳定扩散 WebUI 使用 - --api标志运行
- 检查是否可以从运行 MCP 服务器的位置访问 WebUI URL 
- 如果使用身份验证,请确保凭据正确 
- 验证输出目录是否存在并且具有写入权限 
- 放大时,确保输入图像文件存在且可读 
执照
此 MCP 服务器采用 MIT 许可证。这意味着您可以自由使用、修改和分发该软件,但须遵守 MIT 许可证的条款和条件。更多详情,请参阅项目仓库中的 LICENSE 文件。
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
与 Stable Diffusion WebUI 集成的 MCP 服务器可通过简单的 API 调用提供文本到图像生成和图像升级功能。
Related Resources
Related MCP Servers
- -security-license-qualityAn intelligent MCP server with a fully automated batch pipeline for web-ready images. Features include noise reduction, auto levels/curves, JPEG artifact removal, 4K resizing, smart sharpening with shadow/highlight enhancement, and advanced WebP conversion.
- Asecurity-licenseAqualityAn 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.Last updated -4278MIT License
- Asecurity-licenseAqualityAn MCP server that allows users to generate images using Replicate's Stable Diffusion model and save them to the local filesystem.Last updated -MIT License
- Asecurity-licenseAqualityA server that integrates ComfyUI with MCP, allowing users to generate images and download them through natural language interactions.Last updated -49Apache 2.0