Skip to main content
Glama
README.md
# 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:
```bash
npm install
```
3. Build the server:
```bash
npm run build
```

## 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:
```typescript
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:
```json
{
  "promptId": "abc123",
  "imagePath": "temp/ComfyUI_00042.png"
}
```

### check_status

Check the status of a prompt.

Parameters:
- `promptId` (required): The prompt ID to check

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

Returns:
```json
{
  "status": {
    "completed": true,
    "executing": false
  },
  "hasImages": true
}
```

## Development

To run the server in development mode with automatic reloading:

```bash
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

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