loading…
Search for a command to run...
loading…
Transforms DALL-E 3, DALL-E 2, and GPT-Image-1 into MCP-compatible tools for generating images from natural language descriptions, supporting batch creation, st
Transforms DALL-E 3, DALL-E 2, and GPT-Image-1 into MCP-compatible tools for generating images from natural language descriptions, supporting batch creation, style control, and flexible sizing.
Version 0.1.0 – MVP public release
Conforms to the Model Context Protocol spec (2025‑06‑18).
Python 3.11+ License: MIT Code style: black MCP
A production‑ready MCP server that transforms state‑of‑the‑art image generators into plug‑and‑play tools for any MCP‑aware client. Currently shipping with DALL·E 3, DALL·E 2, and experimental GPT‑Image‑1 – all accessible through a unified interface.
MCP is the USB‑C of AI context: one protocol, endless integrations. Ship one server, hook it into Claude Desktop, Claude Code, VS Code, or your own chatbot – the host handles UI, auth, and conversation flow.
| You ask | The server delivers |
|---|---|
| "Design a cyberpunk logo for my startup" | High‑res PNG via DALL·E 3 with style presets |
| "Generate 5 variations of this product shot" | Batch generation via DALL·E 2 (n=5 support) |
| "Create concept art for a steampunk airship" | Artistic rendering with metadata and prompt history |
If you can describe it, we can render it. 💫
This server implements all three MCP primitives:
generate_image with model selection, size, and style optionsproduct_mockup and concept_art workflowsvivid or natural rendering (DALL·E 3)graph TD
Client["MCP Client (Claude Desktop/Code)"] -- JSON‑RPC 2.0 --> Server["Image‑Gen MCP Server"]
Server --> Router["Model Router"]
Router -->|OpenAI API| DALLE3["DALL·E 3"]
Router -->|OpenAI API| DALLE2["DALL·E 2"]
Router -->|Responses API| GPT["GPT‑Image‑1"]
Server --> Storage["Local Storage + Metadata"]
Storage --> Client
git clone https://github.com/krystian-ai/ai-image-gen-mcp.git
cd ai-image-gen-mcp
python3.11 -m venv .venv && source .venv/bin/activate
pip install -e ".[image,dev]"
cp .env.example .env
# Edit .env and add your OpenAI API key
Key settings:
OPENAI_API_KEY=sk-...
MODEL_DEFAULT=dall-e-3
CACHE_DIR=/tmp/ai-image-gen-cache
# Via MCP CLI
mcp-imageserve stdio
# Direct execution
python -m ai_image_gen_mcp.server --transport=stdio
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"ai-image-gen": {
"command": "/path/to/ai-image-gen-mcp/.venv/bin/python",
"args": ["-m", "ai_image_gen_mcp.server", "stdio"],
"transport": "STDIO",
"env": {
"PYTHONPATH": "/path/to/ai-image-gen-mcp/src",
"OPENAI_API_KEY": "your-api-key-here"
}
}
}
}
.mcp.json (Recommended)Drop this in your project root:
{
"ai-image-gen": {
"command": "python",
"args": ["-m", "ai_image_gen_mcp.server", "stdio"],
"transport": "STDIO",
"env": {
"PYTHONPATH": "src",
"OPENAI_API_KEY": "your-api-key-here"
}
}
}
Claude Code auto‑detects and loads it. ✨
Add to ~/.config/claude-code/settings.json for system‑wide access.
| Model | Sizes | Styles | Batch (n) | Speed | Notes |
|---|---|---|---|---|---|
| DALL·E 3 | 1024×1024, 1792×1024, 1024×1792 | vivid, natural | 1 | Fast | Best quality, default model |
| DALL·E 2 | 256×256, 512×512, 1024×1024 | N/A | 1-10 | Fast | Good for variations |
| GPT‑Image‑1 | Fixed (model‑determined) | N/A | 1 | Slow (20s+) | Experimental, may timeout |
Generate a minimalist logo for a productivity app
Create a vivid 1792x1024 banner of a futuristic cityscape using dall-e-3
Generate 5 variations of a coffee cup product photo using dall-e-2
Explore the server's capabilities through our interactive web interface:
cd examples/html
open index.html # macOS
# or
xdg-open index.html # Linux
# or just open in your browser
The demo showcases:
Perfect for visualizing what's possible before diving into the API!
pytest # Full suite
pytest --cov=ai_image_gen_mcp # Coverage report
python test_dalle.py # Live API test
black src/ # Format
ruff check src/ # Lint
mypy src/ # Type check
ai-image-gen-mcp/
├── src/ai_image_gen_mcp/
│ ├── server.py # FastMCP server entry
│ ├── models/ # Model implementations
│ └── config.py # Environment config
├── tests/ # Comprehensive test suite
├── examples/
│ └── html/ # Interactive web demo
├── assets/ # Logo images
└── .mcp.json # Claude Code config
| Issue | Solution |
|---|---|
| MCP not detected | Ensure .mcp.json exists in project root |
| API key errors | Check OPENAI_API_KEY in .env or environment |
| Import errors | Verify PYTHONPATH includes src/ directory |
| GPT‑Image‑1 timeouts | Known issue – use DALL·E models for reliability |
| Claude Desktop issues | Use full paths to venv Python executable |
| Version | Focus | Status |
|---|---|---|
| 0.1 | MVP with 3 models, local storage | ✅ Shipped |
| 0.2 | S3/GCS storage, signed URLs | 🚧 Planning |
| 0.3 | Stable Diffusion, ComfyUI integration | 📋 Backlog |
| 0.4 | Inpainting, upscaling, style transfer | 💭 Ideas |
Fork → feature branch → PR. Run pre-commit hooks. Keep the vibe technical but approachable.
MIT – see LICENSE.
Выполни в терминале:
claude mcp add ai-image-gen-mcp-server -- npx Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.