SD + TTS MCP Server

SD + TTS MCP Server

Exposes Stable Diffusion for text-to-image generation and GPT-SoVITS for text-to-speech synthesis as MCP tools, enabling image and audio generation via natural language.

Category
Visit Server

README

SD + TTS MCP Server

A Model Context Protocol (MCP) server exposing Stable Diffusion (txt2img) and GPT-SoVITS (TTS) as standard MCP tools, for use with any MCP-compatible client (Codex, Claude Desktop, etc.).


Quick Start

# 1. Install
git clone https://github.com/yyboling-commits/mcp-sd-tts-server.git
cd mcp-sd-tts-server
pip install mcp requests pyyaml

# 2. Configure
cp config.example.yaml config.yaml
# Edit config.yaml with your service URLs

# 3. Run
python src/server.py

Configuration

Copy config.example.yaml to config.yaml and edit:

sd:
  url: "http://127.0.0.1:7860"    # SD WebUI 地址
  default_model: ""                # 默认模型名(可选)

tts:
  url: "http://127.0.0.1:9880"    # GPT-SoVITS 地址
  default_voice: ""                # 默认音色(可选)

server:
  name: "sd-tts-mcp"
  transport: "stdio"               # stdio | sse

前置条件

  • Stable Diffusion WebUI 需启动并开启 --api 参数
  • GPT-SoVITS TTS 需启动 API 服务(默认端口 9880)

Transport 模式

stdio 模式(默认,推荐)

python src/server.py

标准输入输出模式,适用于 MCP 客户端直接启动子进程调用。

SSE 模式(HTTP)

python src/server.py --transport sse

HTTP 服务模式,监听 0.0.0.0:8000。SSE 端点 /sse,消息端点 /messages


注册到客户端

Codex / Claude Desktop

在 MCP 配置中添加:

{
  "mcpServers": {
    "sd-tts": {
      "command": "python",
      "args": ["路径/src/server.py"],
      "env": {}
    }
  }
}

其他 MCP 客户端

任意支持 stdio transport 的 MCP 客户端均可使用,配置方式同上。


可用工具

txt2img — 文生图

调用 SD WebUI API 生成图片。

参数:

参数 类型 默认值 说明
prompt string - 必填。正向提示词
negative_prompt string "" 反向提示词
width int 896 图片宽度
height int 1344 图片高度
steps int 20 采样步数
cfg_scale float 5.0 CFG 引导尺度
sampler_name string "Euler" 采样器
seed int -1 随机种子(-1=随机)
model_name string "" 模型名(留空用默认)

返回:PNG 图片 + 种子信息 JSON。

tts — 文本转语音

调用 GPT-SoVITS API 生成语音。

参数:

参数 类型 默认值 说明
text string - 必填。要合成的文本
speed float 0.85 语速
temperature float 1.0 生成温度

返回:WAV 音频。

sd_health — SD 健康检查

检查 SD WebUI 是否正常运行。无参数。

返回:{"ok": true/false}

tts_health — TTS 健康检查

检查 TTS 服务是否正常运行。无参数。

返回:{"ok": true/false}

list_sd_models — 列出可用模型

查询 SD WebUI 中加载的所有 checkpoint 模型。无参数。

返回:{"models": ["model1", "model2", ...]}


项目结构

mcp-sd-tts-server/
├── src/
│   ├── server.py        # MCP 服务入口
│   ├── sd_client.py     # SD WebUI API 封装
│   └── tts_client.py    # GPT-SoVITS API 封装
├── config.example.yaml  # 配置示例
├── pyproject.toml       # 项目元数据
├── README.md
└── .gitignore

依赖

  • Python >= 3.11
  • mcp — Model Context Protocol SDK
  • requests — HTTP 客户端
  • pyyaml — YAML 配置解析


License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured