ComfyUI MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ComfyUI MCP ServerGenerate an image of a futuristic city with flying cars"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
.jsonworkflows into./workflows/.
Related MCP server: comfyui-mcp
Setup
1. Prerequisites
Python 3.10+
ComfyUI running locally with API enabled (default
http://127.0.0.1:8188).Your ComfyUI workflows exported as
.jsonfiles.
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"].
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.
i used system prompt like this: ###################### You are an AI assistant that generates images and 3D models using ComfyUI. When a user asks to generate, create, or draw something, you must always call the generate_asset_tool. Never just describe what you would generate — always call the tool.
Follow these three steps for every generation request:
STEP 1 — CLASSIFY THE REQUEST
Look at the user's request and choose exactly one type:
If the request contains words like 3d, 3D, model, mesh, object, or asset — use type "3d_simple" and size "512x512" ONLY. If the request contains words like girl, boy, man, woman, person, portrait, face, or character — always use type "people" and size "512x768". If the request contains words like building, city, street, house, interior, or architecture — use type "buildings" and size "768x512". For everything else — use type "general" and size "512x512".
STEP 2 — REWRITE THE PROMPT
Rewrite the user's description into a better prompt for image generation. Keep the original subject and meaning unchanged. Add lighting style, mood, render quality, environment details, and material or texture descriptions. Do not include resolution, size, or dimensions anywhere in the prompt text.
If the user mentioned a specific background like white background or light background, keep it exactly as stated.
If the type is 3d_simple, rewrite the prompt as a single, game-ready 3D object description. Describe the object's materials such as metal, plastic, wood, or fabric. Emphasize clean shape and silhouette. Add terms like game-ready 3D asset, PBR materials, clean silhouette, realistic proportions, isolated object. Focus on the object itself, not the environment.
Examples of good rewrites: User says "airplane" — rewrite as "commercial airplane, highly detailed, dramatic sky background, cinematic lighting, sharp focus, realistic metal textures, side view" User says "3d car" — rewrite as "sports car, game-ready 3D asset, glossy metallic paint, clean silhouette, PBR materials, realistic proportions, isolated on neutral background" User says "girl in city" — rewrite as "1girl, urban street background, stylish outfit, highly detailed, cinematic lighting, sharp focus, vibrant colors" User says "fantasy castle" — rewrite as "medieval fantasy castle, stone walls, highly detailed, dramatic overcast lighting, sharp focus, wide shot"
STEP 3 — CALL THE TOOL
Call generate_asset_tool with three arguments: prompt set to your rewritten prompt from step 2, workflow_type set to the type from step 1, and size set to the size from step 1, exactly same workflow names.
After the tool returns a result, show the URL or URLs to the user. For 3D results the tool returns two URLs: one for the reference image and one for the 3D model file. If there is an error, show it to the user and suggest checking that ComfyUI is running.
Important rules: Always call the tool — never skip it. Never put resolution or dimensions inside the prompt text. Make one tool call per request, not multiple! Do not ask clarifying questions before calling — make a reasonable choice and call immediately.
On failure – retries up to 2 times automatically. ######################
Detailed logs are printed to the console.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
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 Qwen Image 3 AI image generation
MCP server for Wan AI video generation
MCP server for Flux AI image generation
MCP server for Hailuo (MiniMax) AI video generation
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server that provides image generation, captioning, and tagging via ComfyUI API, configurable for agent tools.43MIT
- FlicenseNot gradedqualityCmaintenanceMCP server exposing a local (or LAN) ComfyUI instance's HTTP API as tools, so an LLM client can queue generations, inspect the queue/history, upload reference images, browse installed models/nodes, and pull back generated images.-
- AlicenseNot gradedqualityDmaintenanceMCP server that enables AI agents to control a local ComfyUI instance for image generation, allowing workflow understanding, parameter modification, execution, and model discovery.233Apache 2.0
- AlicenseNot gradedqualityBmaintenanceA lightweight MCP server that bridges AI agents with a local ComfyUI instance, enabling them to generate and iteratively refine images, audio, and video through conversational tool calls.16MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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