Skip to main content
Glama

sdnext-mcp

面向 SD.Next(Stable Diffusion Next)WebUI 的 Model Context Protocol (MCP) 服务器。

它将 SD.Next 的 REST API(/sdapi/v1/* + /sdapi/v2/civitai/*)封装为 125 个 MCP 工具,使 LLM 宿主(Claude Desktop、DSH 等)能够驱动 SD.Next 的每一个使用场景:文生图、图生图、控制引导生成、放大、detailer、LoRA、脚本、字幕/打标/VQA、模型与选项管理、服务器自省、文件/图库以及 CivitAI。

这是一个轻量 HTTP 客户端。 它不内嵌 Python,也不启动 WebUI。你必须自行以 --api --listen 运行 SD.Next;MCP 服务器只是通过 HTTP 与它通信。

它存在的核心原因:SD.Next 的请求参数与 A1111 不同(模块化引导、1024 默认画布、内置 YOLO detailer、调度器作为独立维度、UNet/DiT 等),因此 A1111 的 MCP 代码无法用于它。这里的每个工具都基于 SD.Next 实际的 pydantic 请求字段建模。

要求

  • Node.js ≥ 18(使用全局 fetchFormDataAbortSignal.timeout

  • 一个以 --api --listen 启动的、正在运行的 SD.Next 实例(添加 --api-auth user:pass 以启用认证)

Related MCP server: sd-neo-mcp

安装

cd sdnext_mcp
npm install          # installs @modelcontextprotocol/sdk + zod

运行

默认使用 stdio 传输(由你的 MCP 宿主启动):

# in your MCP host config
{
  "mcpServers": {
    "sdnext": {
      "command": "node",
      "args": ["/abs/path/to/sdnext_mcp/src/index.js"],
      "env": {
        "SDNEXT_BASE_URL": "http://127.0.0.1:7860",
        "SDNEXT_USERNAME": "user",
        "SDNEXT_PASSWORD": "pass"
      }
    }
  }
}

或者直接运行 Streamable HTTP 传输:

SDNEXT_MCP_TRANSPORT=http SDNEXT_MCP_PORT=8787 node src/index.js
# → http://127.0.0.1:8787/mcp

配置(环境变量)

变量

默认值

含义

SDNEXT_BASE_URL

http://127.0.0.1:7860

WebUI 地址

SDNEXT_API_PATH

/sdapi/v1

v1 前缀

SDNEXT_API_KEY

Bearer 令牌(最高优先级)

SDNEXT_USERNAME / SDNEXT_PASSWORD

HTTP Basic 认证

SDNEXT_TIMEOUT_MS

300000

请求超时(生成较慢)

SDNEXT_MCP_TRANSPORT

stdio

stdiohttp

SDNEXT_MCP_HOST / SDNEXT_MCP_PORT

127.0.0.1 / 8787

HTTP 传输绑定

SDNEXT_MCP_DRY_RUN

false

1 = 打印请求,不发送

SDNEXT_SAVE_DIR

save_dir 磁盘写入的默认目录

工具族(共 125 个)

  • 生成sdnext_txt2imgsdnext_img2imgsdnext_controlsdnext_process_imagesdnext_process_batchsdnext_detailsdnext_prompt_enhance

  • 枚举器sdnext_list_samplerssdnext_list_masking(29 个列表工具)

  • 图像理解sdnext_captionsdnext_caption_dispatchsdnext_taggersdnext_vqasdnext_analyze

  • 模型/选项 — 刷新/选择/加载 checkpoint、VAE、UNet、LoRA;sdnext_get_options/sdnext_set_options

  • 服务器sdnext_statussdnext_progress、中断/跳过、重启/关闭、日志、历史、存储、GPU

  • 文件/图库sdnext_uploadsdnext_file、delete-、browser/sdnext_png_info

  • 控制处理sdnext_preprocesssdnext_masksdnext_detect

  • 审核sdnext_nudenetsdnext_prompt_langsdnext_image_guardsdnext_prompt_banned

  • CivitAI — 搜索、模型/版本、下载队列、设置、书签、封禁、历史(27 个工具)

  • sdnext_list_toolssdnext_call_api(通用透传)、自动补全文件管理

在运行时执行 sdnext_list_tools 可查看完整目录,或运行 node scripts/dump_tools.mjs

典型工作流

sdnext_list_checkpoints   → pick a model
sdnext_list_samplers      → pick a sampler
sdnext_txt2img { prompt, sd_model_checkpoint, sampler_name, width:1024, height:1024, steps:20 }
sdnext_progress           → poll while it runs
sdnext_caption / sdnext_tagger → understand a result

图像输入输出均为原始 base64 PNG(无 data: 前缀);在图像作为输入的位置接受 "upload:<id>" 引用。在任何生成工具上传递 save_dir 也可将结果写入磁盘。

脚本

npm run check          # syntax-check the entry
node scripts/smoke.mjs # DRY_RUN stdio smoke test (no live server needed)
node scripts/dump_tools.mjs  # export the tool catalog

布局

架构文档请参阅 ../framework/(API 事实见 01-sdnext-api/,设计决策见 02-mcp-design/)。源码位于 src/ 下:config.jsclient.jsimage.jsregistry.jsindex.js 以及 tools/(每个领域一个文件)。

Install Server
F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • OCR, transcription, file extraction, and image generation for AI agents via MCP.

  • Free public MCP for AI agents — 193 tools, 44 workflows. No API key.

  • Generate images with any major model — one API key, one prepaid balance, one MCP.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Congenital/sdnext_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server