Skip to main content
Glama

DALL-E MCP Server

by szabadkai

DALL-E MCP Server

A Model Context Protocol (MCP) server for generating images using OpenAI's DALL-E 3 model. This server enables ChatGPT and other MCP-compatible clients to generate high-quality images from text prompts.

Features

  • DALL-E 3 Integration: Uses OpenAI's latest image generation model
  • Flexible Parameters: Configurable image size, quality, and style
  • Local File Storage: Automatically saves generated images to local filesystem
  • Error Handling: Comprehensive error handling with detailed logging
  • TypeScript: Built with TypeScript for type safety and better development experience

Installation

  1. Clone this repository:
git clone <repository-url> cd dall-e-mcp-server
  1. Install dependencies:
npm install
  1. Set up environment variables:
cp .env.example .env
  1. Edit .env file and add your OpenAI API key:
OPENAI_API_KEY=your_openai_api_key_here DEFAULT_IMAGE_SIZE=1024x1024 DEFAULT_QUALITY=standard OUTPUT_DIRECTORY=./generated_images

Usage

Running the Server

Development Mode
npm run dev
Production Mode
npm run build npm start

Integration with Claude Desktop

Add the server to your Claude Desktop configuration:

macOS/Linux (~/.config/claude/claude_desktop_config.json):

{ "mcpServers": { "dall-e-server": { "command": "node", "args": ["/path/to/dall-e-mcp-server/dist/index.js"], "env": { "OPENAI_API_KEY": "your_openai_api_key_here" } } } }

Windows (%APPDATA%/Claude/claude_desktop_config.json):

{ "mcpServers": { "dall-e-server": { "command": "node", "args": ["C:\\path\\to\\dall-e-mcp-server\\dist\\index.js"], "env": { "OPENAI_API_KEY": "your_openai_api_key_here" } } } }

Available Tools

generate_image

Generates an image using DALL-E 3 based on a text prompt.

Parameters:

  • prompt (required): Text description of the image to generate
  • size (optional): Image dimensions - 1024x1024, 1024x1792, or 1792x1024 (default: 1024x1024)
  • quality (optional): Image quality - standard or hd (default: standard)
  • style (optional): Image style - vivid or natural (default: vivid)
  • filename (optional): Custom filename without extension

Example Usage:

{ "prompt": "A serene mountain landscape at sunset with a lake", "size": "1024x1792", "quality": "hd", "style": "natural", "filename": "mountain_sunset" }

Response:

{ "success": true, "message": "Image generated successfully", "details": { "prompt": "A serene mountain landscape at sunset with a lake", "size": "1024x1792", "quality": "hd", "style": "natural", "file_path": "/absolute/path/to/generated_images/mountain_sunset.png", "file_size": 1048576, "timestamp": "2025-01-15T10:30:00.000Z" } }

Configuration

Environment Variables

  • OPENAI_API_KEY: Your OpenAI API key (required)
  • DEFAULT_IMAGE_SIZE: Default image size (default: 1024x1024)
  • DEFAULT_QUALITY: Default quality setting (default: standard)
  • OUTPUT_DIRECTORY: Directory to save generated images (default: ./generated_images)

Image Formats

All images are saved as PNG files with automatic timestamping if no filename is provided.

Development

Project Structure

dall-e-mcp-server/ ├── src/ │ └── index.ts # Main server implementation ├── generated_images/ # Generated images directory ├── dist/ # Compiled JavaScript ├── package.json ├── tsconfig.json ├── .env.example └── README.md

Building

npm run build

Development with Watch Mode

npm run watch

Error Handling

The server includes comprehensive error handling:

  • Missing API Key: Clear error message when OPENAI_API_KEY is not set
  • API Errors: OpenAI API errors are caught and returned with details
  • File System Errors: Issues with saving images are handled gracefully
  • Invalid Parameters: Input validation with helpful error messages

Pricing

DALL-E 3 API pricing (as of 2025):

  • Standard quality: $0.040 per image (1024×1024), $0.080 per image (1024×1792 or 1792×1024)
  • HD quality: $0.080 per image (1024×1024), $0.120 per image (1024×1792 or 1792×1024)

License

MIT License

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

Support

For issues and questions:

  1. Check the error messages in the console
  2. Verify your OpenAI API key is valid
  3. Ensure you have sufficient API credits
  4. Review the MCP client configuration

Changelog

v1.0.0

  • Initial release with DALL-E 3 integration
  • Support for all DALL-E 3 parameters
  • Local file storage
  • Error handling and logging
  • TypeScript implementation
Deploy Server
-
security - not tested
F
license - not found
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Enables AI assistants to generate high-quality images using OpenAI's DALL-E 3 model with configurable parameters like size, quality, and style. Generated images are automatically saved to the local filesystem with comprehensive error handling.

  1. Features
    1. Installation
      1. Usage
        1. Running the Server
        2. Integration with Claude Desktop
      2. Available Tools
        1. generate_image
      3. Configuration
        1. Environment Variables
        2. Image Formats
      4. Development
        1. Project Structure
        2. Building
        3. Development with Watch Mode
      5. Error Handling
        1. Pricing
          1. License
            1. Contributing
              1. Support
                1. Changelog
                  1. v1.0.0

                Related MCP Servers

                • A
                  security
                  F
                  license
                  A
                  quality
                  A TypeScript-based MCP server that generates images using OpenAI's dall-e-3 model based on text prompts and saves them to a specified directory.
                  Last updated -
                  1
                  10
                  • Apple
                • -
                  security
                  F
                  license
                  -
                  quality
                  An MCP server that allows users to generate, edit, and create variations of images through OpenAI's DALL-E API, supporting both DALL-E 2 and DALL-E 3 models.
                  Last updated -
                  10
                • -
                  security
                  A
                  license
                  -
                  quality
                  A Model Context Protocol server enabling AI assistants to generate images through OpenAI's DALL-E API with full support for all available options and fine-grained control.
                  Last updated -
                  4
                  1
                  MIT License
                • A
                  security
                  F
                  license
                  A
                  quality
                  A TypeScript-based MCP server that lets users generate images using OpenAI's dall-e-3 model by providing a prompt and image name.
                  Last updated -
                  1
                  1

                View all related MCP servers

                MCP directory API

                We provide all the information about MCP servers via our MCP API.

                curl -X GET 'https://glama.ai/api/mcp/v1/servers/szabadkai/imagegen-mcp'

                If you have feedback or need assistance with the MCP directory API, please join our Discord server