dsh-zimage-mcp
Generates images through the Hugging Face-hosted Z-Image-Turbo Space, with configurable prompt, width, height, steps, and seed, plus tools to check Space status and save generated image URLs locally.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
dsh-zimage-mcp
Zero-dependency MCP (stdio) server that wraps the Hugging Face Space mrfakename/Z-Image-Turbo (Alibaba Tongyi Z-Image turbo text-to-image, running on ZeroGPU A10G) and exposes it as agent-friendly tools. Built for the DeepSeek Harness (DSH) MCP bridge, but works with any MCP client (Claude Desktop, Cursor, …).
prompt ──▶ mcp__zimage__generate_image ──▶ Z-Image-Turbo Space (Gradio REST)
│
├─ downloads the PNG locally (default Documents/DSH/zimage-output)
└─ returns JSON: savedPath + url + seedUsed + elapsedMsWhy a wrapper (and not the Space's own MCP endpoint)?
The Space is Gradio ≥5, so it already exposes https://mrfakename-z-image-turbo.hf.space/gradio_api/mcp.
Pointing a client there works, but:
Space's built-in MCP | this server | |
Tool result | image inline as base64 content (hundreds of KB into the model context) | trimmed JSON: local file path, temporary URL, seed |
Where the image lives | Space | your disk (survives cleanup) |
ZeroGPU errors | raw | relayed with actionable hints (quota / sleeping space) |
Token handling | none |
|
Dependencies | — | zero (plain Node ≥18, newline-delimited JSON-RPC over stdio) |
Related MCP server: Z-Image Studio
Tools
generate_image
arg | type | default | notes |
| string | required | natural language; EN/JA/ZH all work (≤4000 chars) |
| int 512–2048 | 1024 | Space slider bounds |
| int 512–2048 | 1024 | |
| int 1–20 | 9 | turbo model: 6–12 is plenty |
| int | 0 | used when |
| bool |
|
|
| bool |
| download result locally |
| string | auto | absolute path override |
Returns {ok, savedPath, url, seedUsed, width, height, steps, elapsedMs, bytes, note}.
Typical wall time 10–40 s (ZeroGPU queue dependent). Point an image-reading
tool (or a multimodal model) at savedPath to inspect the result.
space_status
{stage, hardware, sdk, likes, note} — RUNNING / SLEEPING / PAUSED diagnosis.
save_image
{url, outPath?} → {savedPath, bytes} — persist a generation URL before the
Space cleans up /tmp/gradio.
DSH registration
In ~/.dsh/profiles/web/cordis.patch.yml (requires host restart, or HMR
hot-swap of the mcp-client entry):
- insert:
- id: mcp-zimage
name: '@deepseek-ai/dsh-mcp-client'
config:
serverName: zimage
transport: stdio
command: 'C:\Program Files\nodejs\node.exe'
args:
- 'C:\Users\motch\Documents\DSH\dsh-zimage-mcp\zimage-mcp.mjs'
env:
HF_TOKEN: !!js process.env.HF_TOKEN || ''
failOnStartupError: false
toolCallTimeoutMs: 600000Tools appear as mcp__zimage__generate_image, mcp__zimage__space_status,
mcp__zimage__save_image. toolCallTimeoutMs must exceed the Space's worst
queue wait; 10 min is a safe ceiling.
ZeroGPU quota
Generation is billed against ZeroGPU quota:
Anonymous (per IP): tiny — a few short generations per window; when exhausted the Space returns
You have exceeded your ZeroGPU quota (Ns requested vs. Ns left). The tool relays this verbatim; wait for the window to reset and retry.With a free HF token (
HF_TOKEN): substantially more GPU-seconds. Create one at https://huggingface.co/settings/tokens (read is enough), then either set theHF_TOKENWindows/host environment variable or putHF_TOKEN: hf_xxxin~/.dsh/.credentials.yaml— the server picks it up (env first, credentials file as fallback; the placeholderunusedis ignored). No restart of this server is needed between calls, but a new server process re-reads both.
Configuration (env)
var | default | meaning |
| (auto) | Bearer token for the Space API; empty → anonymous |
|
| per-generation SSE timeout |
|
| default save directory |
How it talks to the Space
Plain Gradio REST, no gradio_client dependency:
POST /gradio_api/call/generate_image {"data":[prompt,h,w,steps,seed,randomize]} → {"event_id": …}
GET /gradio_api/call/generate_image/<event_id> (text/event-stream)
event: progress|process_starts|heartbeat … until
event: complete data=[[{url,path,orig_name,mime_type}, seedUsed]]
event: error data=[{"error": "You have exceeded your ZeroGPU quota …"}]Slider bounds (verified 2026-09-01): width/height 512–2048, steps 1–20, defaults 1024/1024/9.
Test
node test/server-test.mjs --skip-live # protocol round-trips only
node test/server-test.mjs # + one real 512x512/4-step generationAll assertions passing 2026-09-01 (protocol 5/5; live suite validated end-to-end against the running Space).
License
MIT — see LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Generate AI images and videos from any compatible MCP client.
Generate images and videos with Seedance, Veo, Wan, Grok, GPT-Image and Nano Banana via one MCP.
Generate detailed AI image prompts from image URLs or base64 data using a remote MCP server.
Zaotu MCP: AI image & video generation (GPT-image, Grok, Nano Banana, Seedream) via Zaotu API.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables the generation of images using Together AI's models through an MCP server, supporting customizable parameters such as model selection, image dimensions, and output directory.16MIT
- AlicenseAqualityBmaintenanceA local text-to-image generation server that enables AI agents to generate images, manage models, and browse history using the Z-Image-Turbo model. It supports hardware acceleration across NVIDIA, Apple Silicon, and AMD GPUs via multiple MCP transport protocols.3130Apache 2.0
- AlicenseAqualityBmaintenanceEnables MCP clients to generate and edit images through any OpenAI-compatible image API, saving results as local files and returning absolute paths for immediate use.3MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI agents to generate images from text prompts via Z-Image-Turbo, list available models, and view generation history over stdio, SSE, or Streamable HTTP transports.-