Azure Image Generation MCP

Azure Image Generation MCP

Enables AI-powered image generation using Azure DALL-E 3 and FLUX models with intelligent automatic model selection. Generates stunning photorealistic or creative images directly within LibreChat through simple text prompts.

Category
访问服务器

README

Azure Image Generation MCP

Model Context Protocol (MCP) server for AI-powered image generation using Azure DALL-E 3 and FLUX models

License: MIT Node.js Version

🎨 Overview

A powerful MCP server that brings professional AI image generation to LibreChat. Generate stunning images using Azure's DALL-E 3 for photorealistic content or FLUX for creative artwork, with intelligent automatic model selection based on your prompts.

Perfect for LibreChat users who want seamless image generation capabilities powered by Azure AI Foundry models.

✨ Features

  • 🤖 Dual Model Support

    • DALL-E 3: Photorealistic images, portraits, and artistic content
    • FLUX (FLUX.1-Kontext-pro): Creative illustrations and flexible generation
  • 🧠 Intelligent Model Selection

    • Automatic model selection based on prompt analysis
    • FLUX as default for optimal results
    • DALL-E 3 when explicitly requested or optimal
  • 📐 Multiple Image Sizes

    • Square (1024x1024) - Perfect for social media
    • Wide (1792x1024) - Great for banners and headers
    • Tall (1024x1792) - Ideal for posters and vertical content
  • ⚙️ Customization Options

    • Quality settings (standard/HD) for DALL-E 3
    • Style options (vivid/natural) for DALL-E 3
    • Fast generation times (typically 30-60 seconds)
  • 🔌 Easy Integration

    • Works seamlessly with LibreChat
    • Compatible with MCP clients
    • Simple configuration via environment variables

📋 Prerequisites

  • Node.js >= 18.0.0
  • Azure OpenAI API access with:
    • DALL-E 3 deployment (optional)
    • FLUX deployment (FLUX.1-Kontext-pro)
  • LibreChat instance (for LibreChat integration)

🚀 Installation

Option 1: NPM Installation (Recommended)

npm install -g azure-image-generation-mcp

Option 2: From Source

git clone https://github.com/malikmalikayesha/azure-image-generation-mcp.git
cd azure-image-generation-mcp
npm install

Option 3: NPX (No Installation)

npx azure-image-generation-mcp

⚙️ Configuration

1. Environment Variables

Create a .env file or set environment variables:

AZURE_IMAGE_API_KEY=your_azure_api_key_here
AZURE_IMAGE_BASE_URL=https://your-endpoint.cognitiveservices.azure.com/openai/deployments

2. LibreChat Integration

Add to your librechat.yaml:

mcpServers:
  "Image Generation":
    type: stdio
    command: node
    args:
      - /path/to/azure-image-generation-server.js

    name: "Image Generation"
    displayName: "Image Generation"

    timeout: 180000      # 3 minutes for generation
    initTimeout: 60000   # 1 minute startup

    chatMenu: true       # Show in chat tools

    serverInstructions: |
      🎨 AI Image Generation Tool

      Create stunning images using DALL-E 3 or FLUX models.
      Simply describe what you want to see!

    env:
      AZURE_IMAGE_API_KEY: "${AZURE_IMAGE_API_KEY}"
      AZURE_IMAGE_BASE_URL: "${AZURE_IMAGE_BASE_URL}"

📖 Usage

In LibreChat

Simply ask the AI to generate an image:

"Generate an image of a serene mountain landscape at sunset"
"Create a modern minimalist logo for a tech startup"
"Draw a realistic portrait of a confident businesswoman"
"Make an abstract pattern with geometric shapes"

Model Selection

  • Automatic (Default): The system intelligently chooses between DALL-E 3 and FLUX
  • FLUX (Default): Used for most requests unless DALL-E is explicitly mentioned
  • DALL-E 3: Explicitly request by mentioning "DALL-E" in your prompt

Advanced Options

Specify additional parameters in your request:

"Generate a wide landscape image in HD quality using DALL-E"
Size: 1792x1024, Quality: HD, Model: DALL-E 3

"Create a tall poster with vivid colors"
Size: 1024x1792, Style: vivid

🔧 Docker Deployment (LibreChat)

If using Docker with LibreChat, add to your Dockerfile:

# Install MCP SDK dependencies
RUN npm install @modelcontextprotocol/sdk@^1.17.2

# Copy Azure image generation files
COPY azure-image-generation-server.js ./

Then ensure your docker-compose.yml includes the environment variables:

services:
  api:
    environment:
      - AZURE_IMAGE_API_KEY=${AZURE_IMAGE_API_KEY}
      - AZURE_IMAGE_BASE_URL=${AZURE_IMAGE_BASE_URL}

🛠️ API Reference

Tool: generate_image

Generates an AI image based on a text prompt.

Parameters

Parameter Type Required Default Description
prompt string Yes - Description of the image to generate
model string No auto Model selection: dall-e-3, flux, or auto
size string No 1024x1024 Image dimensions: 1024x1024, 1792x1024, 1024x1792
style string No vivid DALL-E style: vivid or natural
quality string No standard DALL-E quality: standard or hd

Response

Returns a structured response with:

  • Text description of the generated image
  • Base64-encoded PNG image data
  • Metadata (model used, size, generation time)

🐛 Troubleshooting

Common Issues

Images not displaying in Azure models:

  • Ensure you're using LibreChat with the MCP image rendering fix (included in LibreChat v0.7.9+)
  • Check that your librechat.yaml configuration is correct

MCP server fails to start:

  • Verify environment variables are set correctly
  • Check that Node.js version is >= 18.0.0
  • Ensure @modelcontextprotocol/sdk is installed

API errors:

  • Verify your Azure API key is valid
  • Check that the base URL points to your Azure OpenAI endpoint
  • Ensure your Azure deployment has DALL-E 3 or FLUX enabled

Generation timeout:

  • Increase timeout value in librechat.yaml (default: 180000ms)
  • Check your network connectivity to Azure

Debug Mode

Enable debug logging by checking LibreChat logs:

# Docker
docker logs librechat-api

# Local
DEBUG=* npm start

📝 Example Prompts

Photorealistic Images

"A professional headshot of a software engineer in a modern office"
"Sunset over Tokyo skyline with Mount Fuji in the distance"
"Close-up of fresh vegetables on a wooden cutting board"

Artistic & Creative

"Minimalist logo design for a coffee shop called 'Bean Dreams'"
"Watercolor painting of a cottage in a flower garden"
"Abstract geometric pattern in blues and golds"

Marketing & Design

"Modern tech startup hero banner image, wide format"
"Instagram post background with pastel gradients"
"Professional LinkedIn banner for a data scientist"

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

📬 Support


Made with ❤️ for the LibreChat community

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选