AZ

Azure OpenAI DALL-E 3 MCP Server

Integrate Azure OpenAI DALL-E 3 with MCP clients using this MCP server for seamless image generation and model-context bridging.

Quick Install
npx -y @jacwu/mcp-server-aoai-dalle3

Overview

This MCP (Model Context Protocol) server connects Azure OpenAI’s DALL·E 3 image-generation capability to MCP-aware clients. It runs as a small bridge process that exposes a set of MCP tools (operations) over the MCP protocol so client applications (chatbots, pipelines, or other agents) can request images and retrieve generated assets in a standardized, programmatic way.

The server handles Azure endpoint and key configuration, translates MCP tool calls into Azure OpenAI DALL·E 3 requests, and can optionally download generated images to local storage. It’s useful when you want to unify image generation behind MCP-compatible tooling, integrate DALL·E 3 into multi-model workflows, or let agents request images without embedding provider-specific logic.

Features

  • Exposes DALL·E 3 functionality via MCP-compatible tools
  • Generate images with configurable size, quality, and style
  • Download generated images to local filesystem from provided URLs
  • Simple environment-driven configuration for Azure OpenAI credentials and deployment
  • Easy to add to MCP client configuration (runs as a child process)

Installation / Configuration

  1. Clone repository and install dependencies:
git clone https://github.com/jacwu/mcp-server-aoai-dalle3.git
cd mcp-server-aoai-dalle3
npm install
  1. Build the project:
npm run build
  1. Environment variables

Set the following environment variables before running the server. Default values are noted where applicable.

VariableRequiredDescription
AZURE_OPENAI_ENDPOINTYesAzure OpenAI resource endpoint (from Azure portal)
AZURE_OPENAI_API_KEYYesAPI key for the Azure OpenAI resource
AZURE_OPENAI_DEPLOYMENT_NAMENoDALL·E 3 deployment name (default: “dalle3”)
OPENAI_API_VERSIONNoAPI version to use (default: “2024-02-15-preview”)

Example (bash):

export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com"
export AZURE_OPENAI_API_KEY="your_api_key"
export AZURE_OPENAI_DEPLOYMENT_NAME="dalle3"
export OPENAI_API_VERSION="2024-02-15-preview"

# Run the built server
node build/index.js
  1. Add to an MCP client configuration

Example mcp client config (JSON):

{
  "mcpServers": {
    "dalle3": {
      "command": "node",
      "args": ["path/to/mcp-server-aoai-dalle3/build/index.js"],
      "env": {
        "AZURE_OPENAI_ENDPOINT": "<endpoint>",
        "AZURE_OPENAI_API_KEY": "<key>",
        "AZURE_OPENAI_DEPLOYMENT_NAME": "<deployment>"
      }
    }
  }
}

Available Tools

The server exposes two primary tools to MCP clients.

  1. generate_image
  • Purpose: Create images from a text prompt via Azure DALL·E 3.
  • Parameters:
    • prompt (string, required) — Text description of the desired image.
    • size (string, optional) — Dimensions to generate. Default: 1024x1024.
    • quality (string, optional) — Image quality. Default: hd.
    • style (string, optional) — Visual style. Default: natural.

Supported options:

OptionValues
size1024x1024, 1792x1024, 1024x1792
qualitystandard, hd
stylenatural, vivid

Example MCP tool call (JSON payload):

{
  "tool": "generate_image",
  "args": {
    "prompt": "A cozy cabin in a snow-covered pine forest at dusk, cinematic lighting",
    "size": "1024x1024",
    "quality": "hd",
    "style": "vivid"
  }
}

Typical response includes one or more image URLs (hosted by Azure or returned by the API).

  1. download_image
  • Purpose: Fetch an image from a URL and save it locally.
  • Parameters:
    • imageUrl (string, required) — Public URL of the image to download.
    • localPath (string, required) — Directory path where to save the file.
    • fileName (string, required) — Local filename to use.

Example MCP tool call:

{
  "tool": "download_image",
  "args": {
    "imageUrl": "https://example.azure.com/generated/abcd.png",
    "localPath": "./downloads",
    "fileName": "cabin-snow.png"
  }
}

The tool returns success/failure status and the final local filepath on success.

Use Cases

  • Chatbots that provide image responses: A conversational agent can call generate_image when a user asks for an illustration, then return the image URL or download the asset for further processing.

    • Flow: user prompt → generate_image → (optionally) download_image → serve or attach image.
  • Automated content pipelines: Batch-generate hero images or thumbnails with different sizes/qualities for a content management workflow. Use scripted MCP client tasks to produce variants, tag outputs, and store files in a CDN-ready location.

  • Design/asset prototyping: Quickly iterate on concepts by programmatically generating variations (change style or size via the tool args) and saving selected outputs to disk for review.

Example: generate an image and persist locally (pseudo steps)

  1. Call generate_image with desired prompt and options.
  2. Receive image URL(s) in the response.
  3. Call download_image with one of the URLs and a local path to save the file.

Notes and best practices

  • Make sure the AZURE_OPENAI_ENDPOINT and API key match the region and resource that hosts the DALL·E 3 deployment.
  • Set the deployment name to the exact deployment configured in your Azure OpenAI resource.
  • The server forwards options directly to Azure; validate prompt content and sizes to fit your downstream requirements.
  • Treat generated assets according to licensing and usage policies of Azure OpenAI and your application.

For complete usage examples and code, refer to the repository: https://github.com/jacwu/mcp-server-aoai-dalle3