satomic/Azure-AI-Image-Editor-MCP
If you are the rightful owner of Azure-AI-Image-Editor-MCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This is an MCP server that supports Azure AI Foundry image generation and editing capabilities.
Azure Image Editor MCP Server
| English
This is an MCP (Model Context Protocol) server that supports Azure AI Foundry image generation and editing capabilities.
Features
- Text-to-Image Generation - Generate high-quality images from text descriptions using Azure AI Foundry models
- Image Editing - Edit and modify existing images
- Configurable Models - Support for multiple Azure AI models via environment variables
Demo
Click š to go to the demo on YouTube
Project Structure
azure-image-editor/
āāā .venv/ # Python virtual environment
āāā src/
ā āāā azure_image_client.py # Azure API client
ā āāā mcp_server.py # STDIO MCP server
āāā tests/ # Test files
āāā logs/ # Server logs
āāā tmp/ # Temporary files
āāā requirements.txt # Python dependencies
āāā .env # Environment configuration
āāā .env.example # Environment configuration template
āāā README.md # Project documentation
Prerequisites
ā ļø Important: Before using this MCP server, you must deploy the required model in your Azure AI Foundry environment.
Azure AI Foundry Model Deployment
- Access Azure AI Foundry: Go to Azure AI Foundry
- Deploy the model: Deploy
flux.1-kontext-pro
(or your preferred model) in your Azure AI Foundry workspace - Get deployment details: Note down your:
- Base URL (endpoint)
- API key
- Deployment name
- Model name
Without proper model deployment, the MCP server will not function correctly.
Installation and Setup
- Clone and setup environment:
git clone https://github.com/satomic/Azure-AI-Image-Editor-MCP.git
cd azure-image-editor
python -m venv .venv
source .venv/bin/activate # Linux/Mac
# or .venv\Scripts\activate # Windows
pip install -r requirements.txt
Configure VSCode MCP
Add the following to your VSCode MCP configuration:
{
"servers": {
"azure-image-editor": {
"command": "/full/path/to/.venv/bin/python",
"args": ["/full/path/to/azure-image-editor/src/mcp_server.py"],
"env": {
"AZURE_BASE_URL": "https://your-endpoint.services.ai.azure.com", // deployment endpoint
"AZURE_API_KEY": "${input:azure-api-key}",
"AZURE_DEPLOYMENT_NAME": "FLUX.1-Kontext-pro", // The name you gave your deployment
"AZURE_MODEL": "flux.1-kontext-pro", // Default model
"AZURE_API_VERSION": "2025-04-01-preview" // Default API version
}
}
},
"inputs": [
{
"id": "azure-api-key",
"type": "promptString",
"description": "Enter your Azure API Key",
"password": "true"
}
]
}
Important: Replace /full/path/to/
with the actual absolute path to this project directory.
Available MCP Tools
1. generate_image
Generate images from text prompts
Parameters:
prompt
(required): English text description for image generationsize
(optional): Image size - "1024x1024", "1792x1024", "1024x1792", default: "1024x1024"output_path
(optional): Output file path, returns base64 encoded image if not provided
Example:
{
"name": "generate_image",
"arguments": {
"prompt": "A beautiful sunset over mountains",
"size": "1024x1024",
"output_path": "/path/to/output/image.png"
}
}
2. edit_image
Edit existing images with intelligent dimension preservation
Parameters:
image_path
(required): Path to the image file to editprompt
(required): English text description of how to edit the imagesize
(optional): Output image size, uses original dimensions if not specifiedoutput_path
(optional): Output file path, returns base64 encoded image if not provided
Example:
{
"name": "edit_image",
"arguments": {
"image_path": "/path/to/input/image.png",
"prompt": "Make this black and white",
"output_path": "/path/to/output/edited_image.png"
}
}
Technical Specifications
-
Python version: 3.8+
-
Main dependencies:
mcp
: MCP protocol supporthttpx
: HTTP client with timeout handlingpillow
: Image processing and dimension detectionaiofiles
: Async file operationspydantic
: Data validationpython-dotenv
: Environment variable management
-
Azure AI Foundry:
- Default model: flux.1-kontext-pro (configurable)
- Default API version: 2025-04-01-preview (configurable)
- Supported image sizes: 1024x1024, 1792x1024, 1024x1792
- Timeout: 5 minutes per request
Troubleshooting
- Timeout Errors: Image processing has 5-minute timeout, check network connectivity
- API Errors: Verify Azure credentials and endpoint URL
- Dependency Issues: Ensure virtual environment is activated and dependencies installed
- Server Connection Issues: Verify VSCode MCP configuration path is correct
License
MIT License