An MCP server for generating and editing images with a Microsoft Foundry GPT image deployment. Generated images render inline in clients that support MCP Apps.
- Generate images from text prompts
- Edit or combine PNG, JPEG, and WebP reference images
- Render results inline through MCP Apps
- Optionally save generated images to disk
Requires Node.js 20 or later and a Microsoft Foundry image deployment.
git clone https://github.com/chuwik/foundry-image-mcp.git
cd foundry-image-mcp
npm install
npm run buildSet these environment variables in your MCP client:
FOUNDRY_ENDPOINT=https://YOUR-RESOURCE.openai.azure.com
FOUNDRY_API_KEY=YOUR_API_KEY
FOUNDRY_DEPLOYMENT=gpt-image-2.5-sunburst
FOUNDRY_DEPLOYMENT is optional when your deployment uses the default name above. You can also set FOUNDRY_API_VERSION; it defaults to 2025-04-01-preview.
The server exposes one tool for both generation and editing.
| Parameter | Required | Description |
|---|---|---|
prompt |
Yes | What to generate or how to edit the reference images |
images |
No | Reference image paths, data URLs, or base64 strings |
n |
No | Number of images, from 1 to 10 |
size |
No | auto or a supported size such as 1024x1024 |
quality |
No | low, medium, high, xhigh, max, or auto |
output_format |
No | png, jpeg, or webp |
output_dir |
No | Directory in which to save generated images |
output_name |
No | Saved filename prefix; defaults to generated |
Examples:
- Generate:
"A minimalist app icon for a hiking app, flat design, forest green" - Edit:
"Replace the background with a misty pine forest"withimages: ["./portrait.png"] - Combine:
"Use the layout of the first image and colors of the second"withimages: ["./layout.png", "./palette.jpg"]
Endpoint, key, deployment, and API version can also be overridden per call with the corresponding foundry_* parameters. Prefer environment variables for API keys so credentials do not appear in chat history or tool logs.
Copilot CLI and the GitHub Copilot app use the user-level MCP configuration at ~/.copilot/mcp-config.json (%USERPROFILE%\.copilot\mcp-config.json on Windows). Add:
{
"mcpServers": {
"foundry-image": {
"type": "local",
"command": "node",
"args": ["C:\\absolute\\path\\to\\foundry-image-mcp\\dist\\index.js"],
"env": {
"FOUNDRY_ENDPOINT": "https://YOUR-RESOURCE.openai.azure.com",
"FOUNDRY_API_KEY": "YOUR_API_KEY",
"FOUNDRY_DEPLOYMENT": "gpt-image-2.5-sunburst"
},
"tools": ["generate_image"]
}
}
}Start a new Copilot session after saving the file. In Copilot CLI, run /mcp show foundry-image to verify the server, then ask Copilot to generate or edit an image.
Add the server to ~/.codex/config.toml:
[mcp_servers.foundry-image]
command = "node"
args = ["C:\\absolute\\path\\to\\foundry-image-mcp\\dist\\index.js"]
enabled_tools = ["generate_image"]
[mcp_servers.foundry-image.env]
FOUNDRY_ENDPOINT = "https://YOUR-RESOURCE.openai.azure.com"
FOUNDRY_API_KEY = "YOUR_API_KEY"
FOUNDRY_DEPLOYMENT = "gpt-image-2.5-sunburst"Restart Codex after saving the file, then run codex mcp list to verify the server.
Add the server to claude_desktop_config.json:
{
"mcpServers": {
"foundry-image": {
"command": "node",
"args": ["C:\\absolute\\path\\to\\foundry-image-mcp\\dist\\index.js"],
"env": {
"FOUNDRY_ENDPOINT": "https://YOUR-RESOURCE.openai.azure.com",
"FOUNDRY_API_KEY": "YOUR_API_KEY",
"FOUNDRY_DEPLOYMENT": "gpt-image-2.5-sunburst"
}
}
}
}Use an absolute path and restart the MCP client after changing its configuration.
npm run dev # Run with tsx
npm test # Run tests
npm run build # Compile TypeScript
npm start # Run compiled outputThis project is derived from pierceboggan/nano-banana-mcp under the MIT License.