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.
npx -y @jacwu/mcp-server-aoai-dalle3Overview
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
- Clone repository and install dependencies:
- Build the project:
- Environment variables
Set the following environment variables before running the server. Default values are noted where applicable.
| Variable | Required | Description |
|---|---|---|
| AZURE_OPENAI_ENDPOINT | Yes | Azure OpenAI resource endpoint (from Azure portal) |
| AZURE_OPENAI_API_KEY | Yes | API key for the Azure OpenAI resource |
| AZURE_OPENAI_DEPLOYMENT_NAME | No | DALL·E 3 deployment name (default: “dalle3”) |
| OPENAI_API_VERSION | No | API version to use (default: “2024-02-15-preview”) |
Example (bash):
# Run the built server
- Add to an MCP client configuration
Example mcp client config (JSON):
Available Tools
The server exposes two primary tools to MCP clients.
- 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:
| Option | Values |
|---|---|
| size | 1024x1024, 1792x1024, 1024x1792 |
| quality | standard, hd |
| style | natural, vivid |
Example MCP tool call (JSON payload):
Typical response includes one or more image URLs (hosted by Azure or returned by the API).
- 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:
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)
- Call generate_image with desired prompt and options.
- Receive image URL(s) in the response.
- 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