AI Image Generation Pipeline with LangGraph and MCP
@lalanikarim
About AI Image Generation Pipeline with LangGraph and MCP
A demonstration of using LangGraph with MCP for generating prompts and AI-generated images, including Human-in-the-Loop interaction.
Overview
What is AI Image Generation Pipeline with LangGraph and MCP?
This project demonstrates the use of the Model Context Protocol (MCP) with LangGraph to create workflows that generate prompts and AI-generated images based on a given topic. It runs as Python scripts or integrates into Open WebUI Pipelines, and is intended for developers working with LangGraph and MCP.
How to use AI Image Generation Pipeline with LangGraph and MCP?
Install dependencies with pip install aiosqlite langgraph langgraph-checkpoint-sqlite mcp[cli] comfy-mcp-server. Then run app.py or graph.py with command-line arguments like --topic and --thread_id. Optionally use the uv utility (uv run graph.py --thread_id ...). Set environment variables for ComfyUI and Ollama API.
Key features of AI Image Generation Pipeline with LangGraph and MCP
- Uses Model Context Protocol (MCP) for tool execution.
- Integrates Human-in-the-Loop feedback for prompt approval.
- Three implementations: LangGraph Functional API, Graph API, and Open WebUI Pipeline.
- Generates AI image prompts and images via Comfy MCP Server.
- Uses LangGraph checkpointing for state persistence.
Use cases of AI Image Generation Pipeline with LangGraph and MCP
- Generating AI images from a topic with human oversight.
- Building automated workflows for image creation.
- Demonstrating MCP and LangGraph integration in pipelines.
FAQ from AI Image Generation Pipeline with LangGraph and MCP
What is this project?
It uses MCP with LangGraph to create workflows that generate prompts and AI-generated images based on a given topic.
What are the main files?
app.py (LangGraph Functional API with Human-in-the-Loop), graph.py (LangGraph Graph API with Human-in-the-Loop), and ai-image-gen-pipeline.py (Open WebUI Pipeline integration).
What dependencies are needed?
aiosqlite, langgraph, langgraph-checkpoint-sqlite, mcp[cli], and comfy-mcp-server.
How do I run it?
Run python app.py --topic "Your topic" or python graph.py --thread_id "id" --topic "Your topic". Use uv run instead of python to manage dependencies automatically.
What environment variables must be set?
COMFY_URL, COMFY_URL_EXTERNAL, COMFY_WORKFLOW_JSON_FILE, PROMPT_NODE_ID, OUTPUT_NODE_ID, OLLAMA_API_BASE, and PROMPT_LLM.
What is the license?
The project is licensed under the MIT License.
Basic information
More Agent Frameworks MCP clients
Open MCP Client
copilotkitSSE-based Server and Client for
sidharthrajaramA working pattern for SSE-based MCP clients and servers
🌟 MCPM - Model Context Protocol Manager
pathintegral-instituteCLI MCP package manager & registry for all platforms and all clients. Search & configure MCP servers. Advanced Router & Profile features.
chatmcp
daodao97ChatMCP is an AI chat client implementing the Model Context Protocol (MCP).
Unified MCP Client Library
pietrozullomcp-use is the easiest way to interact with mcp servers with custom agents
Comments