generate-image-mcp
v1.3.1
Published
MCP server for AI image generation and repaint with vision analysis
Downloads
695
Maintainers
Readme
Generate Image MCP
Let AI generate and edit images directly in Claude Desktop, OpenCode, Cursor, and other MCP-compatible clients.
Features
- Multi-turn Dialogue - Collect user requirements step by step
- Smart Inference - Automatically infer missing parameters from context
- Session Management - Maintain conversation state across multiple calls
- No Auto-fill - Never fill in parameters without user confirmation
Quick Start
1. Install
npm install -g generate-image-mcp2. Get an API key
Register at agnes-ai.com to get your API key (free quota available).
3. Configure
Add to your MCP config file:
OpenCode (~/.config/opencode/opencode.json):
{
"mcp": {
"generate-image": {
"type": "local",
"command": ["npx", "generate-image-mcp"],
"enabled": true,
"environment": {
"AGNES_API_KEY": "your-api-key-here",
"AGNES_API_URL": "https://apihub.agnes-ai.com/v1/images/generations"
}
}
}
}Claude Desktop (%APPDATA%\Claude\claude_desktop_config.json):
{
"mcpServers": {
"generate-image": {
"command": "npx",
"args": ["-y", "generate-image-mcp"],
"env": {
"AGNES_API_KEY": "your-api-key-here"
}
}
}
}Other clients:
| Client | Config file |
|--------|-------------|
| Claude Desktop | %APPDATA%\Claude\claude_desktop_config.json |
| OpenCode | ~/.config/opencode/opencode.json |
| Cursor | ~/.cursor/mcp.json |
| Windsurf | ~/.windsurf/mcp.json |
| Cline (VS Code) | Cline MCP settings UI |
4. Restart your client
Done! Ask your AI: "Generate an image of a sunset over mountains".
How It Works
Multi-turn Dialogue
When you ask to generate an image, the tool will:
- Analyze your request - Extract what it can understand
- Ask for missing info - Generate 4 options for you to choose
- Collect your choices - Remember across multiple calls
- Generate image - Only when all info is complete
Example:
User: Generate a garlic zombie image
AI: What type of scene? A) Character *recommended B) Abstract C) Animal D) Product
User: A
AI: What style? A) Realistic *recommended B) Anime C) Oil painting D) 3D
User: Realistic
AI: What background? A) Natural *recommended B) Indoor C) Urban D) Auto
User: A
→ Image generated!Smart Inference
The tool can infer missing parameters from context:
- User selects "Anime style" →
style = "anime" - User selects "City night" →
scene_type = "city"ANDbackground = "urban" - User selects "Neon lights" →
lighting = "special effects"
Tools
generate_image
Generate an image from a text description.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| raw_input | string | Yes | User's original input, passed directly without modification |
| session_id | string | No | Session ID for multi-turn dialogue |
| size | string | No | Image size (default: 1024x1024) |
| model | string | No | Model name (default: agnes-image-2.1-flash) |
| n | number | No | Number of images (default: 1) |
repaint_image
Edit an existing image by describing what to change.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| image_url | string | Yes | URL of the original image |
| edit_prompt | string | Yes | Description of changes |
| size | string | No | Image size (default: 1024x768) |
| model | string | No | Model name (default: agnes-image-2.1-flash) |
| strength | number | No | Edit strength 0-1 (default: 0.7) |
Configuration
Environment Variables
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| AGNES_API_KEY | Yes | — | Your Agnes AI API key |
| AGNES_API_URL | No | https://apihub.agnes-ai.com/v1/images/generations | API endpoint |
Alternative Providers
OpenAI DALL-E:
"environment": {
"IMAGE_PROVIDER": "openai",
"IMAGE_API_KEY": "sk-your-openai-key",
"IMAGE_MODEL": "dall-e-3"
}Stability AI:
"environment": {
"IMAGE_PROVIDER": "stability",
"IMAGE_API_KEY": "sk-your-stability-key"
}API Key Sources
| Provider | Get a key at | |----------|-------------| | Agnes AI | agnes-ai.com | | OpenAI | platform.openai.com | | Stability AI | platform.stability.ai |
From Source (Developers)
git clone https://github.com/m1908293028-boop/generate-image-mcp.git
cd generate-image-mcp
npm install
npm run buildThen configure with the local path:
{
"mcp": {
"generate-image": {
"type": "local",
"command": ["node", "path/to/generate-image-mcp/dist/server.js"],
"enabled": true,
"environment": {
"AGNES_API_KEY": "your-api-key-here"
}
}
}
}Changelog
v1.2.0
- Added multi-turn dialogue with session management
- Added smart inference for missing parameters
- Removed auto-fill behavior
- Added option letter parsing (A/B/C/D)
- Added deduplication logic in prompt building
v1.1.x
- Initial release with basic image generation
License
MIT
