Sponsored by Deepsite.site

DALL-E MCP Server running on port

Created By
oybekdevuz7 months ago
Image generator MCP using OpenAI DALL-E models
Content

DALL-E MCP Server running on port

DALL-E MCP Logo

An MCP (Model Context Protocol) server for generating images using OpenAI's DALL-E API.

Features

  • Generate images using DALL-E 2 or DALL-E 3
  • Edit existing images (DALL-E 2 only)
  • Create variations of existing images (DALL-E 2 only)
  • Validate OpenAI API key

Installation

# Clone the repository
git clone https://github.com/oybekdevuz/dalle-mcp.git
cd dalle-mcp

# Install dependencies
npm install

# Build the project
npm run build

Usage

Running the Server

# Run the server
npm start

Important Note for Cline Users

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/where-want-to/save/image"
}

Configuration for Cline

import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
import { McpName } from "src/enum/McpName";

async function setupClient() {
  let client: any = undefined;
  const baseUrl: any = "http://127.0.0.1:3002/mcp";

  try {
    client = new Client({
      name: 'streamable-http-client',
      version: '1.0.0'
    });
    const transport = new StreamableHTTPClientTransport(new URL(baseUrl) as any);
    await client.connect(transport);
    console.log("Connected using Streamable HTTP transport");
  } catch (error) {
    console.log("Streamable HTTP connection failed, falling back to SSE transport");
    client = new Client({
      name: 'dalle-image-generator',
      version: '1.0.0'
    });
    const sseTransport = new SSEClientTransport(baseUrl);
    await client.connect(sseTransport);
    console.log("Connected using SSE transport");
  }
}

setupClient()

Make sure to:

  1. Replace your-api-key-here with your OpenAI API key

Available Tools

generate_image

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

{
  "prompt": "A futuristic city with flying cars and neon lights",
  "saveDir": "/path/to/save/directory",
}

Parameters:

  • prompt (required): Text description of the desired image
  • model (optional): DALL-E model to use ("dall-e-2" or "dall-e-3", default: "dall-e-3")
  • size (optional): Size of the generated image (default: "1024x1024")
    • DALL-E 3: "1024x1024", "1792x1024", or "1024x1792"
    • DALL-E 2: "256x256", or "1024x1024"
  • quality (optional): Quality of the generated image, DALL-E 3 only ("standard" or "hd", default: "standard")
  • style (optional): Style of the generated image, DALL-E 3 only ("vivid" or "natural", default: "vivid")
  • n (optional): Number of images to generate (1-10, default: 1)
  • saveDir (optional): Directory to save the generated images (default: current directory or SAVE_DIR from .env). For Cline users: Setting this to your current workspace directory is recommended for proper image display.
  • fileName (optional): Base filename for the generated images without extension (default: "dalle-{timestamp}")

edit_image

Edit an existing image using DALL-E based on a text prompt.

⚠️ Known Issue (March 18, 2025): The DALL-E 2 image edit API currently has a bug where it sometimes ignores the prompt and returns the original image without any edits, even when using proper RGBA format images and masks. This issue has been reported in the OpenAI community forum. If you experience this issue, try using the create_variation tool instead, which seems to work more reliably.

{
  "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"
}

Parameters:

  • prompt (required): Text description of the desired edits
  • imagePath (required): Path to the image to edit
  • mask (optional): Path to the mask image (white areas will be edited, black areas preserved)
  • model (optional): DALL-E model to use (currently only "dall-e-2" supports editing, default: "dall-e-2")
  • size (optional): Size of the generated image (default: "1024x1024")
  • n (optional): Number of images to generate (1-10, default: 1)
  • saveDir (optional): Directory to save the edited images (default: current directory or SAVE_DIR from .env). For Cline users: Setting this to your current workspace directory is recommended for proper image display.
  • fileName (optional): Base filename for the edited images without extension (default: "dalle-edit-{timestamp}")

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"
}

Parameters:

  • imagePath (required): Path to the image to create variations of
  • model (optional): DALL-E model to use (currently only "dall-e-2" supports variations, default: "dall-e-2")
  • size (optional): Size of the generated image (default: "1024x1024")
  • n (optional): Number of variations to generate (1-10, default: 1)
  • saveDir (optional): Directory to save the variation images (default: current directory or SAVE_DIR from .env). For Cline users: Setting this to your current workspace directory is recommended for proper image display.
  • fileName (optional): Base filename for the variation images without extension (default: "dalle-variation-{timestamp}")

validate_key

Validate the OpenAI API key.

{}

No parameters required.

Development

Testing Configuration

Note: The following .env configuration is ONLY needed for running tests, not for normal operation.

If you're developing or running tests for this project, 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

For normal operation with Cline, configure your API key in the MCP settings JSON as described in the "Adding to MCP Settings" section above.

You can get your API key from OpenAI's API Keys page.

License

Updated to http server mcp.

Original repository is https://github.com/Garoth/dalle-mcp

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Amap Maps高德地图官方 MCP Server
ChatWiseThe second fastest AI chatbot™
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
CursorThe AI Code Editor
WindsurfThe new purpose-built IDE to harness magic
Playwright McpPlaywright MCP server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Serper MCP ServerA Serper MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Tavily Mcp
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
DeepChatYour AI Partner on Desktop