Skip to main content
Glama

ComfyUI MCP Server

An MCP server for interacting with ComfyUI instances running on your local network. This server provides tools for generating images and checking generation status through ComfyUI's API.

Installation

  1. Clone this repository

  2. Install dependencies:

npm install
  1. Build the server:

npm run build

Related MCP server: comfyui-mcp

Configuration

The server requires the following environment variables:

  • COMFYUI_SERVER_URL (optional): The URL of your ComfyUI instance. Defaults to http://127.0.0.1:8188

MCP Tools

generate_image

Generates an image using a ComfyUI workflow.

Parameters:

  • workflow (required): A ComfyUI workflow JSON object

  • wait (optional): Whether to wait for the image generation to complete. Defaults to true

Example:

const result = await mcp.useTool('comfyui-server', 'generate_image', {
  workflow: {
    "3": {
      "inputs": {
        "seed": 5,
        "steps": 20,
        "cfg": 8,
        "sampler_name": "euler",
        "scheduler": "normal",
        "denoise": 1,
        "model": ["4", 0],
        "positive": ["6", 0],
        "negative": ["7", 0],
        "latent_image": ["5", 0]
      },
      "class_type": "KSampler"
    },
    // ... rest of your workflow
  }
});

Returns:

{
  "promptId": "abc123",
  "imagePath": "temp/ComfyUI_00042.png"
}

check_status

Check the status of a prompt.

Parameters:

  • promptId (required): The prompt ID to check

Example:

const status = await mcp.useTool('comfyui-server', 'check_status', {
  promptId: "abc123"
});

Returns:

{
  "status": {
    "completed": true,
    "executing": false
  },
  "hasImages": true
}

Development

To run the server in development mode with automatic reloading:

npm run dev

Notes

  • Generated images are saved in a temp directory in the current working directory

  • The server will automatically clean up old images on startup

  • Requests will timeout after 5 minutes if the image generation doesn't complete

Available Tools

3 tools
check_statusB

Check the status of a prompt. Example: {"promptId": "abc123-def456-ghi789"}

ParametersJSON Schema
NameRequiredDescriptionDefault
promptIdYesPrompt ID to check

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full responsibility for disclosing behavior. It states 'check the status' but does not indicate whether this is a read-only operation, what statuses are possible, whether it is asynchronous, or whether there are any side effects. The example only clarifies the parameter format, not the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is one sentence plus a focused example. Every word earns its place. It is front-loaded with the core action and resource, and the example is directly useful for parameter format.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having only one parameter, the tool likely requires context about what the response will look like. There is no output schema, and the description does not fill that gap by explaining status values or polling implications. The sibling tools suggest an async workflow, but the description does not address this.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already provides a clear description for the single parameter 'promptId', and the example adds concrete format context (a UUID-like structure). This goes beyond the schema and helps the agent understand the expected input.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: checking the status of a prompt. It uses a specific verb ('check') and resource ('status of a prompt'), and the sibling tools (generate_image, copy_image) make the distinction evident. It lacks an explicit contrast with siblings, but the purpose is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given on when to use this tool versus alternatives. The description does not mention that it should be used after submitting a prompt or as a polling mechanism, nor does it explain why it would be preferred over generate_image or copy_image. The usage context is only implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

copy_imageA

Copy an image from ComfyUI output to a project location. Example: {"sourcePath": "\\LAWLRENCE\ComfyUI_windows_portable\ComfyUI\output\ComfyUI_00001_.png", "destinationPath": "c:/your/project/path/images/my_image.png"}

ParametersJSON Schema
NameRequiredDescriptionDefault
sourcePathYesPath to the source image in ComfyUI output
destinationPathYesPath where the image should be copied to

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It clearly states it performs a copy operation, but it does not disclose potential edge cases such as overwriting existing files, creating missing directories, or error handling. For a simple copy operation this is adequate but not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence followed by a concrete example. It is front-loaded with the core purpose and every piece of text earns its place. There is no unnecessary verbosity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity, the description is largely complete: it states the source, destination, and operation. However, it could benefit from noting behavior like overwriting or directory creation, which would make it fully comprehensive for a file operation with no annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the parameters are already well-documented. The description adds an example with concrete paths, which reinforces the expected format but does not introduce new semantic information beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (copy), the resource (image), the source (ComfyUI output), and the destination (a project location). This specific verb+resource+scope distinguishes it from sibling tools like generate_image and check_status, which have different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use the tool: copying generated images from ComfyUI output to a project directory. However, it does not explicitly state when not to use it or mention alternatives, though the sibling tools make the workflow context obvious.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

generate_imageA

Generate an image using ComfyUI with the provided workflow. Example: {"workflow": {"3": {"inputs": {"seed": 1234, "steps": 20, "cfg": 8, "sampler_name": "euler", "scheduler": "normal", "denoise": 1, "model": ["4", 0], "positive": ["6", 0], "negative": ["7", 0], "latent_image": ["5", 0]}, "class_type": "KSampler"}, "4": {"inputs": {"ckpt_name": "v1-5-pruned-emaonly-fp16.safetensors"}, "class_type": "CheckpointLoaderSimple"}, "5": {"inputs": {"width": 512, "height": 512, "batch_size": 1}, "class_type": "EmptyLatentImage"}, "6": {"inputs": {"text": "your prompt here", "clip": ["4", 1]}, "class_type": "CLIPTextEncode"}, "7": {"inputs": {"text": "negative prompt here", "clip": ["4", 1]}, "class_type": "CLIPTextEncode"}, "8": {"inputs": {"samples": ["3", 0], "vae": ["4", 2]}, "class_type": "VAEDecode"}, "9": {"inputs": {"filename_prefix": "ComfyUI", "images": ["8", 0]}, "class_type": "SaveImage"}}}

ParametersJSON Schema
NameRequiredDescriptionDefault
waitNoWhether to wait for the image generation to complete
workflowYesComfyUI workflow JSON object

TDQS

A3.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It fails to mention side effects, output format, or whether the tool blocks until completion. The 'wait' parameter exists in the schema but is not described in the tool description, leaving behavioral expectations vague.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with a clear one-sentence purpose, followed by a necessary but lengthy JSON example. While the example adds length, it is directly relevant and earns its place. The structure is logical, with no wasted prose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description provides a complete workflow example and indicates the primary action, but it does not explain what happens after generation (e.g., where the image is saved, if it is returned) or any conditional behavior like the 'wait' parameter. Given no output schema and no annotations, this leaves gaps in the tool's overall context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds significant value by including a detailed example workflow JSON, which clarifies the structure and expected format for the 'workflow' parameter. This goes beyond the schema's simple 'ComfyUI workflow JSON object' description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: 'Generate an image using ComfyUI with the provided workflow.' This is a specific verb+resource that distinguishes it from siblings like check_status and copy_image, which have entirely different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage (generate an image when you have a workflow) but does not explicitly state when to use this tool versus alternatives, nor does it mention exclusions or prerequisites. With siblings like check_status and copy_image, the intended use is clear by contrast, but no direct guidance is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv0.1.0
    • First observedcheck_status
    • First observedcopy_image
    • First observedgenerate_image

TDQS

A3.8/5.0

Scored across 3 tools

Disambiguation5/5

Each tool targets a distinct step in the image generation workflow: generation, status polling, and file copying. There is no overlap in purpose.

Naming Consistency5/5

All tool names follow a clear verb_noun pattern (generate_image, check_status, copy_image) with consistent snake_case formatting.

Tool Count5/5

With only 3 tools, the server is tightly focused on the essential ComfyUI workflow. Each tool serves a necessary function and the count is appropriate for the narrow scope.

Completeness4/5

The tools cover the core lifecycle of generating an image, checking its status, and copying the output. Minor gaps like cancellation or direct image retrieval exist, but they are not critical for the primary use case.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers