DALL-E MCP Server
by ichbinmartin
README.md
# DALL-E MCP Server
A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that exposes OpenAI DALL-E image generation capabilities as MCP tools.
## Features
- **`generate_image`** — Generate images from text prompts using DALL-E 3 or DALL-E 2
- **`edit_image`** — Edit existing images with a text prompt and optional mask (DALL-E 2)
- **`create_image_variation`** — Create variations of an existing image (DALL-E 2)
## Prerequisites
- Node.js >= 18
- An [OpenAI API key](https://platform.openai.com/api-keys) with access to DALL-E
## Installation
```bash
npm install
npm run build
```
## Configuration
Copy `.env.example` to `.env` and set your OpenAI API key:
```bash
cp .env.example .env
# Edit .env and set OPENAI_API_KEY
```
## Usage
### Run directly
```bash
OPENAI_API_KEY=sk-... npm start
```
### Configure with Claude Desktop
Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
```json
{
"mcpServers": {
"dall-e": {
"command": "node",
"args": ["/path/to/dall-e-mcp/dist/index.js"],
"env": {
"OPENAI_API_KEY": "sk-..."
}
}
}
}
```
### Configure with Claude Code
```json
{
"mcpServers": {
"dall-e": {
"command": "node",
"args": ["/path/to/dall-e-mcp/dist/index.js"],
"env": {
"OPENAI_API_KEY": "sk-..."
}
}
}
}
```
## Tools
### `generate_image`
Generate an image from a text prompt.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `prompt` | string | Yes | Text description of the desired image |
| `model` | `dall-e-3` \| `dall-e-2` | No | Model to use (default: `dall-e-3`) |
| `size` | string | No | Image dimensions (default: `1024x1024`) |
| `quality` | `standard` \| `hd` | No | Quality — DALL-E 3 only (default: `standard`) |
| `style` | `vivid` \| `natural` | No | Style — DALL-E 3 only (default: `vivid`) |
| `n` | number | No | Number of images, DALL-E 2 only (default: `1`) |
**DALL-E 3 sizes:** `1024x1024`, `1792x1024`, `1024x1792`
**DALL-E 2 sizes:** `256x256`, `512x512`, `1024x1024`
### `edit_image`
Edit an existing image using a text prompt (DALL-E 2 only).
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `image_url` | string | Yes | URL of the PNG to edit (max 4MB, must be square) |
| `mask_url` | string | No | URL of the mask PNG (transparent = edit area) |
| `prompt` | string | Yes | Description of the desired edit |
| `size` | string | No | Output size (default: `1024x1024`) |
| `n` | number | No | Number of edited images (default: `1`) |
### `create_image_variation`
Create variations of an image (DALL-E 2 only).
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `image_url` | string | Yes | URL of the PNG to vary (max 4MB, must be square) |
| `size` | string | No | Output size (default: `1024x1024`) |
| `n` | number | No | Number of variations (default: `1`) |
## Project Structure
```
dall-e-mcp/
├── src/
│ ├── index.ts # MCP server entry point
│ └── tools/
│ ├── generate-image.ts # generate_image tool
│ ├── edit-image.ts # edit_image tool
│ └── create-variation.ts # create_image_variation tool
├── docs/
│ └── issues/ # Issue & ticket documentation
├── dist/ # Compiled output (after build)
├── package.json
├── tsconfig.json
└── .env.example
```
## Issues & Tickets
See [`docs/issues/`](./docs/issues/) for tracked issues and feature requests.
## License
MIT
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo issues