iflow-mcp_orion4d-comfyui_mcp 1.0.0__py3-none-any.whl
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.
- iflow_mcp_orion4d_comfyui_mcp/__init__.py +9 -0
- iflow_mcp_orion4d_comfyui_mcp/__main__.py +8 -0
- iflow_mcp_orion4d_comfyui_mcp/browser_controller.py +123 -0
- iflow_mcp_orion4d_comfyui_mcp/comfyui_client.py +301 -0
- iflow_mcp_orion4d_comfyui_mcp/generate_key.py +158 -0
- iflow_mcp_orion4d_comfyui_mcp/server.py +1027 -0
- iflow_mcp_orion4d_comfyui_mcp-1.0.0.dist-info/METADATA +239 -0
- iflow_mcp_orion4d_comfyui_mcp-1.0.0.dist-info/RECORD +11 -0
- iflow_mcp_orion4d_comfyui_mcp-1.0.0.dist-info/WHEEL +4 -0
- iflow_mcp_orion4d_comfyui_mcp-1.0.0.dist-info/entry_points.txt +2 -0
- iflow_mcp_orion4d_comfyui_mcp-1.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: iflow-mcp_orion4d-comfyui_mcp
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: MCP server for ComfyUI - enables ChatGPT to control ComfyUI workflows
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Requires-Dist: fastapi>=0.104.0
|
|
8
|
+
Requires-Dist: fastmcp>=0.1.0
|
|
9
|
+
Requires-Dist: google-genai>=0.3.0
|
|
10
|
+
Requires-Dist: gradio>=4.0.0
|
|
11
|
+
Requires-Dist: httpx>=0.24.0
|
|
12
|
+
Requires-Dist: openai>=1.0.0
|
|
13
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
14
|
+
Requires-Dist: requests>=2.31.0
|
|
15
|
+
Requires-Dist: uvicorn[standard]>=0.24.0
|
|
16
|
+
Requires-Dist: websocket-client>=1.0.0
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# 🧠 Serveur MCP pour ComfyUI (Version Alpha-1)
|
|
20
|
+
|
|
21
|
+
<img width="2208" height="1235" alt="image" src="https://github.com/user-attachments/assets/11c256ce-f054-49b0-a8c8-52a1675968b7" />
|
|
22
|
+
|
|
23
|
+
Ce projet expose **ComfyUI** via un serveur compatible **MCP (Model Context Protocol)**.
|
|
24
|
+
|
|
25
|
+
Il permet :
|
|
26
|
+
- de piloter **ComfyUI** depuis ChatGPT via un connecteur (mode dev) ;
|
|
27
|
+
- de piloter l’interface **ComfyUI** dans Chrome via une extension WebSocket.
|
|
28
|
+
|
|
29
|
+
<img width="517" height="645" alt="image" src="https://github.com/user-attachments/assets/c3dbd461-626f-4ece-b336-b3367e386454" />
|
|
30
|
+
|
|
31
|
+
### Pour bientôt : en local, interfaces Gradio pour Ollama et Google CLI
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## ⚙️ Installation
|
|
36
|
+
|
|
37
|
+
### 1️⃣ Cloner le dépôt
|
|
38
|
+
```bash
|
|
39
|
+
git clone https://github.com/orion4d/ComfyUI_mcp.git
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 2️⃣ Créer l’environnement virtuel
|
|
43
|
+
```bash
|
|
44
|
+
python -m venv venv
|
|
45
|
+
# Linux / Mac
|
|
46
|
+
source venv/bin/activate
|
|
47
|
+
# Windows
|
|
48
|
+
venv\Scripts\activate
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 3️⃣ Installer les dépendances
|
|
52
|
+
```bash
|
|
53
|
+
pip install -r requirements.txt
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 🔐 Génération des clés et configuration
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
python generate_key.py
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Ce script :
|
|
65
|
+
- génère **MCP_API_KEY** (pour ChatGPT)
|
|
66
|
+
- génère **WEBSOCKET_TOKEN** (pour l’extension Chrome)
|
|
67
|
+
- crée automatiquement `.env` et `.env.example`
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 🚀 Démarrage du serveur
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
python server.py
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Le serveur démarre par défaut sur :
|
|
78
|
+
`http://127.0.0.1:8000`
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 🌐 Points d’accès
|
|
83
|
+
|
|
84
|
+
### 🔧 MCP Tools exposés
|
|
85
|
+
- `list_workflows`, `save_workflow`, `load_workflow`
|
|
86
|
+
- `read_custom_node`, `write_custom_node`
|
|
87
|
+
- `queue_prompt`, `get_history`
|
|
88
|
+
- `create_custom_node_template`, `list_custom_subdir`
|
|
89
|
+
- `ui_click_element`, `ui_fill_input`, `ui_get_current_workflow`
|
|
90
|
+
|
|
91
|
+
### 🧩 Routes Debug
|
|
92
|
+
- `/debug/health` → infos système, versions, outils
|
|
93
|
+
- `/ws` → WebSocket pour l’extension Chrome
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 🧱 Exemple d’usage
|
|
98
|
+
|
|
99
|
+
### Depuis ChatGPT (Custom GPT)
|
|
100
|
+
- Authentification : `X-API-Key` → ta clé **MCP_API_KEY**
|
|
101
|
+
- Appels possibles : `list_workflows`, `queue_prompt`, `read_custom_node`, etc.
|
|
102
|
+
|
|
103
|
+
### Depuis Chrome (Extension MCP)
|
|
104
|
+
- URL WebSocket : `ws://127.0.0.1:8000/ws`
|
|
105
|
+
- Token : **WEBSOCKET_TOKEN**
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 🧠 Intégration ComfyUI
|
|
110
|
+
|
|
111
|
+
Le client (`ComfyUIClient`) communique via HTTP avec ton ComfyUI local :
|
|
112
|
+
- URL : `http://127.0.0.1:8188`
|
|
113
|
+
- Support des workflows UI et API
|
|
114
|
+
- Conversion automatique via `_convert_ui_to_api()`
|
|
115
|
+
|
|
116
|
+
### Tester la connexion
|
|
117
|
+
```bash
|
|
118
|
+
curl http://127.0.0.1:8000/debug/health
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
# 📘 Commandes MCP–ComfyUI
|
|
124
|
+
|
|
125
|
+
## 🗂️ Arborescence des commandes
|
|
126
|
+
```text
|
|
127
|
+
ComfyUI
|
|
128
|
+
│
|
|
129
|
+
├── 🧠 Exécution (moteur)
|
|
130
|
+
│ ├─ /queue_prompt
|
|
131
|
+
│ ├─ /get_queue_status
|
|
132
|
+
│ ├─ /cancel_prompt
|
|
133
|
+
│ ├─ /get_history
|
|
134
|
+
│ └─ /interrupt_execution
|
|
135
|
+
│
|
|
136
|
+
├── ⚙️ Système & Modèles
|
|
137
|
+
│ ├─ /get_system_stats
|
|
138
|
+
│ ├─ /list_models
|
|
139
|
+
│ └─ /model_info
|
|
140
|
+
│
|
|
141
|
+
├── 🧩 Workflows
|
|
142
|
+
│ ├─ /save_workflow
|
|
143
|
+
│ ├─ /load_workflow
|
|
144
|
+
│ ├─ /list_workflows
|
|
145
|
+
│ └─ /inspect_workflow
|
|
146
|
+
│
|
|
147
|
+
├── 🔧 Custom Nodes (→ ComfyUI/custom_nodes/)
|
|
148
|
+
│ ├─ /create_custom_node_template
|
|
149
|
+
│ ├─ /write_custom_node
|
|
150
|
+
│ ├─ /read_custom_node
|
|
151
|
+
│ ├─ /list_custom_subdir
|
|
152
|
+
│ └─ /autodoc_nodes
|
|
153
|
+
│
|
|
154
|
+
├── 🖼️ Images
|
|
155
|
+
│ ├─ /upload_image
|
|
156
|
+
│ ├─ /get_image
|
|
157
|
+
│ └─ /list_output_images
|
|
158
|
+
│
|
|
159
|
+
└── 📂 MCP_exchange (→ output/MCP_exchange/)
|
|
160
|
+
├─ /list_exchange
|
|
161
|
+
├─ /read_exchange
|
|
162
|
+
├─ /write_exchange
|
|
163
|
+
└─ /delete_exchange
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 🧠 Exécution & File
|
|
169
|
+
- **/queue_prompt** → exécuter un workflow
|
|
170
|
+
- **/get_queue_status** → état de la file
|
|
171
|
+
- **/get_history** → historique d’un prompt
|
|
172
|
+
- **/cancel_prompt** → annuler un prompt
|
|
173
|
+
- **/interrupt_execution** → stopper tout en cours
|
|
174
|
+
|
|
175
|
+
## ⚙️ Système & Modèles
|
|
176
|
+
- **/get_system_stats** → infos GPU, RAM, versions
|
|
177
|
+
- **/list_models** → lister les modèles disponibles
|
|
178
|
+
- **/model_info** → détails d’un modèle
|
|
179
|
+
|
|
180
|
+
## 🧩 Workflows
|
|
181
|
+
- **/save_workflow** → enregistrer un workflow
|
|
182
|
+
- **/load_workflow** → charger un workflow
|
|
183
|
+
- **/list_workflows** → lister tous les workflows
|
|
184
|
+
- **/inspect_workflow** → analyser la structure
|
|
185
|
+
|
|
186
|
+
## 🖼️ Images & Fichiers
|
|
187
|
+
- **/list_output_images** → voir les images produites
|
|
188
|
+
- **/get_image** → récupérer une image
|
|
189
|
+
- **/upload_image** → envoyer une image d’entrée
|
|
190
|
+
|
|
191
|
+
## 🔧 Custom Nodes
|
|
192
|
+
- **/create_custom_node_template** → créer un squelette de node
|
|
193
|
+
- **/write_custom_node** → écrire un fichier node
|
|
194
|
+
- **/read_custom_node** → lire le code d’un node
|
|
195
|
+
- **/list_custom_subdir** → explorer un dossier custom
|
|
196
|
+
- **/autodoc_nodes** → générer la doc de tous les custom nodes
|
|
197
|
+
|
|
198
|
+
## 🖥️ Interface (Chrome UI)
|
|
199
|
+
- **/ui_click_element** → simuler un clic
|
|
200
|
+
- **/ui_fill_input** → remplir un champ texte
|
|
201
|
+
- **/ui_get_current_workflow** → récupérer le workflow affiché
|
|
202
|
+
|
|
203
|
+
##
|
|
204
|
+
|
|
205
|
+
## 📂 Structure MCP_exchange
|
|
206
|
+
|
|
207
|
+
Ce répertoire sert d’espace d’échange entre **MCP–ComfyUI** et ton environnement local.
|
|
208
|
+
Toutes les commandes ci-dessous interagissent uniquement avec le dossier :
|
|
209
|
+
`output/MCP_exchange/`
|
|
210
|
+
|
|
211
|
+
## 🔍 Lister les fichiers
|
|
212
|
+
```bash
|
|
213
|
+
call_tool /MCP-ComfyUI/.../list_exchange {"limit": 200, "exts": "png,jpg,jpeg,webp,bmp,tif,tiff,txt,md,html,htm,json,js,py,css"}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## 📖 Lire un fichier
|
|
217
|
+
```bash
|
|
218
|
+
call_tool /MCP-ComfyUI/.../read_exchange {"name": "nom_du_fichier.txt", "as_data_url": true}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## ✏️ Écrire un fichier
|
|
222
|
+
```bash
|
|
223
|
+
call_tool /MCP-ComfyUI/.../write_exchange {"name": "nouveau_fichier.md", "content": "contenu du fichier", "mode": "text", "overwrite": true}
|
|
224
|
+
```
|
|
225
|
+
Modes disponibles : `text`, `base64`, `data_url`.
|
|
226
|
+
|
|
227
|
+
## ❌ Supprimer un fichier
|
|
228
|
+
```bash
|
|
229
|
+
call_tool /MCP-ComfyUI/.../delete_exchange {"name": "fichier_a_supprimer.json"}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## 🧭 Usages typiques
|
|
233
|
+
- Exporter un résultat ou une image générée pour inspection.
|
|
234
|
+
- Importer un script, un JSON de workflow ou un dataset.
|
|
235
|
+
- Automatiser des échanges entre MCP et ComfyUI.
|
|
236
|
+
|
|
237
|
+
**Chemin complet :** `ComfyUI/output/MCP_exchange/`
|
|
238
|
+
> Les autres commandes (workflows, modèles, nœuds) agissent ailleurs ; ce groupe-ci se limite à la gestion des fichiers d’échange.
|
|
239
|
+
---
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
iflow_mcp_orion4d_comfyui_mcp/__init__.py,sha256=oCltOiAiDeJ1pQiCllq_Xot2YIOKRnR1diAj1YzXijY,131
|
|
2
|
+
iflow_mcp_orion4d_comfyui_mcp/__main__.py,sha256=TW0-jucOzO63Wbz5sjXtIyqPMkKF7aJ6Iwa38pVshPY,131
|
|
3
|
+
iflow_mcp_orion4d_comfyui_mcp/browser_controller.py,sha256=n96kefaf_pQhyNp7hSa256VDBH2KMN6vbNy2MkHPKqk,3710
|
|
4
|
+
iflow_mcp_orion4d_comfyui_mcp/comfyui_client.py,sha256=HTpf-Eg3Dn2zLCet136hLlZVBwOuL2EK68ZU-qDpV4c,12314
|
|
5
|
+
iflow_mcp_orion4d_comfyui_mcp/generate_key.py,sha256=lqhQR46zxqDIHJaKTDvGCZwd2c6e6HjAelY4KjeLFbg,5202
|
|
6
|
+
iflow_mcp_orion4d_comfyui_mcp/server.py,sha256=0tRyDrQ6Ak3sqnND3YYjkfpbTN_SUPoKKr-uXhxiCv4,39141
|
|
7
|
+
iflow_mcp_orion4d_comfyui_mcp-1.0.0.dist-info/METADATA,sha256=QGX6mHc2EdW90EVvKP4e8oJyo8M2MXdJ5QW8tex6Oe8,6787
|
|
8
|
+
iflow_mcp_orion4d_comfyui_mcp-1.0.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
9
|
+
iflow_mcp_orion4d_comfyui_mcp-1.0.0.dist-info/entry_points.txt,sha256=TZ3ZzMb4dTMFvjD11ISsBNSviGn1KbaX7-l_LyP8Jy4,62
|
|
10
|
+
iflow_mcp_orion4d_comfyui_mcp-1.0.0.dist-info/licenses/LICENSE,sha256=7NvwLXt0dLt9sF2LUCFLmWl7WAIgivQYbUW38JCEmwE,1080
|
|
11
|
+
iflow_mcp_orion4d_comfyui_mcp-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Philippe Joye (Orion4D)
|
|
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.
|