@reaatech/media-pipeline-mcp-comfyui 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Media Pipeline MCP Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,240 @@
1
+ # @reaatech/media-pipeline-mcp-comfyui
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@reaatech/media-pipeline-mcp-comfyui.svg)](https://www.npmjs.com/package/@reaatech/media-pipeline-mcp-comfyui)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/reaatech/media-pipeline-mcp/blob/main/LICENSE)
5
+ [![CI](https://img.shields.io/github/actions/workflow/status/reaatech/media-pipeline-mcp/ci.yml?branch=main&label=CI)](https://github.com/reaatech/media-pipeline-mcp/actions/workflows/ci.yml)
6
+
7
+ > **Status:** Pre-1.0 — APIs may change in minor versions. Pin to a specific version in production.
8
+
9
+ Local ComfyUI provider for the media pipeline framework. Supports image generation, image editing, and video generation via custom ComfyUI workflows at zero API cost. Ships with built-in SDXL and Flux workflows and supports loading custom workflows from a directory.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install @reaatech/media-pipeline-mcp-comfyui
15
+ # or
16
+ pnpm add @reaatech/media-pipeline-mcp-comfyui
17
+ ```
18
+
19
+ ## Feature Overview
20
+
21
+ - **Zero API cost** — all generation runs on your own GPU
22
+ - **Built-in workflows** — SDXL text-to-image, SDXL image-to-image, Flux text-to-image, and Stable Video Diffusion image-to-video
23
+ - **Custom workflows** — load your own ComfyUI JSON workflows from a directory
24
+ - **Workflow registry** — register, list, and retrieve workflows at runtime
25
+ - **Poll-based completion** — automatic polling with configurable interval and retention
26
+ - **Progress streaming** — per-node progress surfaced during workflow execution
27
+ - **Parameters per workflow** — each workflow exposes its own typed input parameter spec
28
+
29
+ ## Quick Start
30
+
31
+ ```typescript
32
+ import { ComfyUIProvider } from "@reaatech/media-pipeline-mcp-comfyui";
33
+
34
+ const provider = new ComfyUIProvider({
35
+ baseUrl: "http://localhost:8188",
36
+ downloadOutputs: true,
37
+ });
38
+
39
+ const result = await provider.execute({
40
+ operation: "image.generate",
41
+ params: {
42
+ prompt: "A majestic dragon flying over a castle at sunset",
43
+ negative_prompt: "blurry, low quality, distorted",
44
+ seed: 42,
45
+ steps: 30,
46
+ cfg: 7,
47
+ width: 1024,
48
+ height: 1024,
49
+ },
50
+ config: {},
51
+ });
52
+
53
+ console.log(result.metadata.workflow); // "sdxl-text2img"
54
+ console.log(result.metadata.prompt_id); // "abc123..."
55
+ console.log(result.costUsd); // 0
56
+ ```
57
+
58
+ Using a specific workflow:
59
+
60
+ ```typescript
61
+ const result = await provider.execute({
62
+ operation: "image.generate",
63
+ params: {
64
+ prompt: "A futuristic city skyline, neon lights, cyberpunk",
65
+ seed: 100,
66
+ steps: 20,
67
+ model: "workflow:flux-text2img",
68
+ },
69
+ config: {},
70
+ });
71
+ ```
72
+
73
+ Loading custom workflows from a directory:
74
+
75
+ ```typescript
76
+ const provider = new ComfyUIProvider({
77
+ baseUrl: "http://localhost:8188",
78
+ workflowsDir: "./my-workflows",
79
+ });
80
+
81
+ // Workflows are loaded lazily on first execution
82
+ const result = await provider.execute({
83
+ operation: "image.generate",
84
+ params: {
85
+ model: "workflow:custom/my-ip-adapter",
86
+ prompt: "A portrait in the style of Van Gogh",
87
+ image: "https://example.com/reference.png",
88
+ },
89
+ config: {},
90
+ });
91
+ ```
92
+
93
+ ## Supported Operations
94
+
95
+ | Operation | Built-in Workflow | Description |
96
+ |-----------|------------------|-------------|
97
+ | `image.generate` | `sdxl-text2img` (default), `flux-text2img` | Text-to-image generation |
98
+ | `image.edit` | `sdxl-img2img` | Image-to-image transformation |
99
+ | `video.generate` | `svd-img2vid` | Image-to-video (Stable Video Diffusion) |
100
+
101
+ ## Built-in Workflows
102
+
103
+ | Name | Type | Description |
104
+ |------|------|-------------|
105
+ | `sdxl-text2img` | Text-to-Image | SDXL generation with full parameter control |
106
+ | `sdxl-img2img` | Image-to-Image | SDXL image-to-image with denoise control |
107
+ | `flux-text2img` | Text-to-Image | Flux.1-dev text-to-image generation |
108
+ | `svd-img2vid` | Image-to-Video | Stable Video Diffusion with motion control |
109
+
110
+ ## Configuration
111
+
112
+ ```typescript
113
+ interface ComfyUIConfig {
114
+ baseUrl?: string; // Default: "http://localhost:8188"
115
+ workflowsDir?: string; // Directory of custom JSON workflow files
116
+ downloadOutputs?: boolean; // Default: true
117
+ pollIntervalMs?: number; // Default: 1000
118
+ retentionMs?: number; // Default: 600000 (10 min)
119
+ }
120
+ ```
121
+
122
+ ## API Reference
123
+
124
+ ### `ComfyUIProvider`
125
+
126
+ Main provider class extending `MediaProvider`.
127
+
128
+ | Member | Type | Description |
129
+ |--------|------|-------------|
130
+ | `supportedOperations` | `string[]` | `['image.generate', 'image.edit', 'video.generate']` |
131
+ | `supportsStreaming` | `Set<string>` | Operations that surface per-node progress |
132
+ | `supportsWebhooks` | `boolean` | `false` — ComfyUI has no outbound webhook callbacks |
133
+ | `healthCheck()` | `Promise<ProviderHealth>` | Checks `/system_stats` endpoint |
134
+ | `estimateCost()` | `Promise<CostEstimate>` | Always returns `{ costUsd: 0 }` |
135
+ | `execute(input)` | `Promise<ProviderOutput>` | Runs a workflow and returns the output data buffer |
136
+ | `registerWorkflow(name, workflow)` | `void` | Register a custom workflow at runtime |
137
+ | `getWorkflow(name)` | `ComfyUIWorkflow \| undefined` | Retrieve a workflow by name |
138
+ | `listWorkflows()` | `string[]` | List all registered workflow names |
139
+ | `loadWorkflowsFromDir()` | `Promise<void>` | Load JSON workflows from `workflowsDir` |
140
+
141
+ ### `createComfyUIProvider(config?)`
142
+
143
+ Factory function that returns a new `ComfyUIProvider` instance.
144
+
145
+ ### `ComfyUIConfig`
146
+
147
+ Configuration interface (see Configuration section above).
148
+
149
+ ### `ComfyUIWorkflow`
150
+
151
+ ```typescript
152
+ interface ComfyUIWorkflow {
153
+ name: string;
154
+ apiFormat: object; // Raw ComfyUI API JSON
155
+ inputs: Record<string, ComfyParamSpec>; // Typed input parameters
156
+ outputs: Record<string, "image" | "video" | "mask" | "latent">;
157
+ }
158
+ ```
159
+
160
+ ### `ComfyParamSpec`
161
+
162
+ ```typescript
163
+ interface ComfyParamSpec {
164
+ path: string; // Dot-separated JSON path (e.g. "6.inputs.text")
165
+ type: "string" | "number" | "boolean" | "enum";
166
+ enum?: string[];
167
+ default?: unknown;
168
+ required?: boolean;
169
+ }
170
+ ```
171
+
172
+ ## Built-in Workflow Parameters
173
+
174
+ ### SDXL Text-to-Image (`sdxl-text2img`)
175
+
176
+ | Parameter | Type | Default | Required | Description |
177
+ |-----------|------|---------|----------|-------------|
178
+ | `prompt` | `string` | — | Yes | Positive text prompt |
179
+ | `negative_prompt` | `string` | `""` | No | Negative prompt |
180
+ | `seed` | `number` | `-1` | No | Random seed (-1 = random) |
181
+ | `steps` | `number` | `20` | No | Sampling steps |
182
+ | `cfg` | `number` | `7` | No | CFG scale |
183
+ | `width` | `number` | `1024` | No | Image width |
184
+ | `height` | `number` | `1024` | No | Image height |
185
+
186
+ ### SDXL Image-to-Image (`sdxl-img2img`)
187
+
188
+ | Parameter | Type | Default | Required | Description |
189
+ |-----------|------|---------|----------|-------------|
190
+ | `prompt` | `string` | — | Yes | Positive text prompt |
191
+ | `negative_prompt` | `string` | `""` | No | Negative prompt |
192
+ | `seed` | `number` | `-1` | No | Random seed |
193
+ | `steps` | `number` | `20` | No | Sampling steps |
194
+ | `cfg` | `number` | `7` | No | CFG scale |
195
+ | `denoise` | `number` | `0.75` | No | Denoising strength |
196
+ | `image` | `string` | — | Yes | Input image URL or artifact ID |
197
+
198
+ ### Flux Text-to-Image (`flux-text2img`)
199
+
200
+ | Parameter | Type | Default | Required | Description |
201
+ |-----------|------|---------|----------|-------------|
202
+ | `prompt` | `string` | — | Yes | Positive text prompt |
203
+ | `negative_prompt` | `string` | `""` | No | Negative prompt |
204
+ | `seed` | `number` | `-1` | No | Random seed |
205
+ | `steps` | `number` | `20` | No | Sampling steps |
206
+ | `cfg` | `number` | `1` | No | CFG scale |
207
+ | `width` | `number` | `1024` | No | Image width |
208
+ | `height` | `number` | `1024` | No | Image height |
209
+
210
+ ### Stable Video Diffusion (`svd-img2vid`)
211
+
212
+ | Parameter | Type | Default | Required | Description |
213
+ |-----------|------|---------|----------|-------------|
214
+ | `image` | `string` | — | Yes | Input image URL or artifact ID |
215
+ | `seed` | `number` | `-1` | No | Random seed |
216
+ | `steps` | `number` | `20` | No | Sampling steps |
217
+ | `cfg` | `number` | `2.5` | No | CFG scale |
218
+ | `width` | `number` | `1024` | No | Output width |
219
+ | `height` | `number` | `576` | No | Output height |
220
+ | `video_frames` | `number` | `14` | No | Number of video frames |
221
+ | `motion_bucket_id` | `number` | `127` | No | Motion intensity |
222
+ | `fps` | `number` | `6` | No | Frames per second |
223
+
224
+ ## Cost Estimation
225
+
226
+ | Operation | Estimated Cost |
227
+ |-----------|---------------|
228
+ | `image.generate` | $0.00 (local) |
229
+ | `image.edit` | $0.00 (local) |
230
+ | `video.generate` | $0.00 (local) |
231
+
232
+ ## Related Packages
233
+
234
+ - [`@reaatech/media-pipeline-mcp-provider-core`](https://www.npmjs.com/package/@reaatech/media-pipeline-mcp-provider-core) — Base provider class
235
+ - [`@reaatech/media-pipeline-mcp-core`](https://www.npmjs.com/package/@reaatech/media-pipeline-mcp-core) — Shared types and errors
236
+ - [`@reaatech/media-pipeline-mcp-server`](https://www.npmjs.com/package/@reaatech/media-pipeline-mcp-server) — MCP server
237
+
238
+ ## License
239
+
240
+ [MIT](https://github.com/reaatech/media-pipeline-mcp/blob/main/LICENSE)