Skip to main content
Glama

LM Studio → ComfyUI Image Generator

ComfyUI MCP Server

An MCP (Model Context Protocol) server that exposes ComfyUI image & 3D generation as a single tool.
It auto‑classifies your prompt (people, buildings, general, or 3D) and picks the right workflow automatically.

Perfect for AI assistants – connect it via MCP and let your LLM generate assets directly.


Features

  • 🧠 Smart prompt classification – detects if you want a person, building, or 3D model.

  • 🖼️ 2D generation – uses your own ComfyUI workflows (general, people, buildings).

  • 🤖 3D generation (Hunyuan3D) – generates a reference image first, then runs the 3D workflow.

  • 🔌 MCP Tool – exposes generate_asset_tool(prompt, workflow_type, size) to any MCP client.

  • 📂 Workflow folder – drop your .json workflows into ./workflows/.


Setup

1. Prerequisites

  • Python 3.10+

  • ComfyUI running locally with API enabled (default http://127.0.0.1:8188).

  • Your ComfyUI workflows exported as .json files.

2. Install dependencies

pip install -r requirements.txt

3. Place your workflows

Put your ComfyUI workflow JSON files into the workflows/ folder. The filenames must match exactly:

general.json

people.json

buildings.json

3d_simple.json

⚠️ Important for 3D: your 3d_simple.json MUST contain a LoadImage node with the ID "26". The code injects the uploaded reference image into workflow["26"]["inputs"]["image"].

  1. Configure (optional) Create a .env file to override the ComfyUI URL:

text COMFY_URL=http://127.0.0.1:8188 If not set, it defaults to http://127.0.0.1:8188.

Usage Run the MCP server bash python mcp_server.py The server will start and register the tool generate_asset_tool.

Tool parameters prompt (str, required): description of what to generate.

workflow_type (str, optional): "people", "buildings", "general", or "3d_simple". If omitted – auto‑detected.

size (str, optional): "512x512", "512x768", or "768x512". If omitted – auto‑selected.

Example from MCP client json { "tool": "generate_asset_tool", "arguments": { "prompt": "a futuristic cyberpunk girl with neon hair" } } → Auto‑detects people, uses people.json with size 512x768, returns an image URL.

json { "tool": "generate_asset_tool", "arguments": { "prompt": "turn this into a 3d model: a wooden chair", "workflow_type": "3d_simple" } } → Generates a reference image (via general), then runs 3d_simple.json on it. Returns both URLs.

How it works Classification – scans your prompt for keywords (girl, building, 3d, etc.) to pick the right workflow & resolution.

Prompt injection – finds CLIPTextEncode nodes and fills the positive prompt (the user prompt) and the negative prompt (built‑in presets).

Random seeding – randomises KSampler seeds for unique results every time.

Queue & Poll – sends the workflow to ComfyUI via /prompt and polls /history until the result is ready.

Output – returns the full URL to view/download the generated file.

Error handling If ComfyUI is not running – returns ERROR

On failure – retries up to 2 times automatically.

Detailed logs are printed to the console.

-
license - not tested
-
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 Connectors

  • MCP server for Wan AI video generation

  • MCP server for Flux AI image generation

  • MCP server for Hailuo (MiniMax) AI video generation

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/vovchanskuy2/Comfy-Generation-tool-for-lmstudio'

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