An MCP (Model Context Protocol) server for generating and editing images using OpenAI's DALL-E API.
# Clone the repository
git clone https://github.com/Garoth/dalle-mcp.git
cd dalle-mcp
# Install dependencies
npm install
# Build the project
npm run build
When using this DALL-E MCP server with Cline, it's recommended to save generated images in your current workspace directory by setting the saveDir
parameter to match your current working directory. This ensures Cline can properly locate and display the generated images in your conversation.
Example usage with Cline:
{
"prompt": "A tropical beach at sunset",
"saveDir": "/path/to/current/workspace"
}
# Run the server
node build/index.js
Add the DALL-E server to your Cline MCP settings file inside VSCode's settings (e.g., ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
):
{
"mcpServers": {
"dalle-mcp": {
"command": "node",
"args": ["/path/to/dalle-mcp-server/build/index.js"],
"env": {
"OPENAI_API_KEY": "your-api-key-here",
"SAVE_DIR": "/path/to/save/directory"
},
"disabled": false,
"autoApprove": []
}
}
}
Make sure to:
/path/to/dalle-mcp-server/build/index.js
with the actual path to the built index.js
file.your-api-key-here
with your OpenAI API key.generate_image
Generate an image using DALL-E based on a text prompt.
{
"prompt": "A futuristic city with flying cars and neon lights",
"model": "dall-e-3",
"size": "1024x1024",
"quality": "standard",
"style": "vivid",
"n": 1,
"saveDir": "/path/to/save/directory",
"fileName": "futuristic-city"
}
edit_image
Edit an existing image using DALL-E based on a text prompt.
{
"prompt": "Add a red hat",
"imagePath": "/path/to/image.png",
"mask": "/path/to/mask.png",
"model": "dall-e-2",
"size": "1024x1024",
"n": 1,
"saveDir": "/path/to/save/directory",
"fileName": "edited-image"
}
create_variation
Create variations of an existing image using DALL-E.
{
"imagePath": "/path/to/image.png",
"model": "dall-e-2",
"size": "1024x1024",
"n": 4,
"saveDir": "/path/to/save/directory",
"fileName": "image-variation"
}
validate_key
Validate the OpenAI API key.
{}
Note: The following .env
configuration is ONLY needed for running tests, not for normal operation.
Create a .env
file in the root directory with your OpenAI API key:
# Required for TESTS ONLY: OpenAI API Key
OPENAI_API_KEY=your-api-key-here
# Optional: Default save directory for test images
# If not specified, images will be saved to the current directory
# SAVE_DIR=/path/to/save/directory
# Run basic tests
npm test
# Run all tests including edit and variation tests
npm run test:all
# Run tests in watch mode
npm run test:watch
# Run specific test by name
npm run test:name "should validate API key"
# Generate a test image in the assets directory
npm run generate-test-image
MIT
Uses DALL-E to generate/edit images, an MCP (Model Context Protocol) server.
No releases published
No packages published