copilot-image-gen-mcp
v1.0.0
Published
MCP server for AI image generation and editing with inline display in Copilot Chat. Supports Azure OpenAI and OpenAI.
Downloads
20
Maintainers
Readme
image-gen-mcp
MCP server for AI image generation and editing with inline display in VS Code Copilot Chat.
Features
generate_imageGenerate images from text promptsedit_imageEdit existing images with text instructionsshow_imageDisplay local images inline in the chat pane
Supports Azure OpenAI and OpenAI as providers. Auto-detects based on environment variables.
Quick Start
Add to .vscode/mcp.json:
Azure OpenAI
{
"servers": {
"image-gen": {
"type": "stdio",
"command": "npx",
"args": ["-y", "image-gen-mcp"],
"env": {
"AZURE_OPENAI_ENDPOINT": "https://your-resource.openai.azure.com",
"AZURE_OPENAI_API_KEY": "your-api-key",
"AZURE_OPENAI_DEPLOYMENT": "gpt-image-1"
}
}
}
}OpenAI
{
"servers": {
"image-gen": {
"type": "stdio",
"command": "npx",
"args": ["-y", "image-gen-mcp"],
"env": {
"OPENAI_API_KEY": "sk-..."
}
}
}
}Environment Variables
The server auto-detects the provider based on which variables are set:
| Variable | Provider | Required | Description |
|----------|----------|----------|-------------|
| AZURE_OPENAI_ENDPOINT | Azure | Yes (Azure) | Azure OpenAI endpoint URL |
| AZURE_OPENAI_API_KEY | Azure | Yes (Azure) | Azure OpenAI API key |
| AZURE_OPENAI_DEPLOYMENT | Azure | No | Deployment name (default: gpt-image-1) |
| OPENAI_API_KEY | OpenAI | Yes (OpenAI) | OpenAI API key |
| OPENAI_MODEL | OpenAI | No | Model name (default: gpt-image-1) |
Tools
generate_image
Generate an image from a text prompt.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| prompt | string | Yes | Image generation prompt |
| size | enum | No | 1024x1024 (default), 1024x1536, 1536x1024 |
| quality | enum | No | low, medium (default), high |
edit_image
Edit an existing image with text instructions.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| imagePath | string | Yes | Path to the source image |
| prompt | string | Yes | Editing instructions |
| size | enum | No | Output size (default: 1024x1024) |
| quality | enum | No | Image quality (default: medium) |
show_image
Display a local image file inline in the chat pane.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| imagePath | string | Yes | Path to the image file |
How It Works
The tools return Markdown image syntax with file:/// URIs. When the AI includes this in its response, VS Code renders the image inline in the Copilot Chat pane.
Generated images are saved to .image-gen-mcp/ in the current working directory.
License
MIT
