Image Generation MCP Server
A FastMCP server for generating and editing images using OpenAI's gpt-image-1 and Azure FLUX.1-Kontext-pro models. This component is part of the AppKit platform and is designed to be integrated into the main application.
Features
- Text-to-Image Generation: Create images from natural language prompts using multiple AI models
- Image Editing & Inpainting: Edit existing images with text prompts and optional masks (gpt-image-1)
- Multiple Formats: Output as PNG, JPEG, or WEBP with customizable quality
- Prompt Enhancement: Auto-refine prompts via LLM for better results
Configuration
This component uses AppKit's configuration system (appkit_commons) and is configured via MCPImageGeneratorConfig. The settings are loaded from configuration/config.yaml or environment variables mapped by appkit_commons.
Settings
| Setting | Description | Default |
|---|---|---|
backend_server |
URL of the backend server (for retrieving images) | http://localhost:8000 |
max_file_size_mb |
Maximum allowed file size for input images | 10 |
max_images_to_keep |
Storage retention limit for generated images | 50 |
generator |
Active image generator backend (azure or google) |
azure |
azure_api_key |
Azure OpenAI API key | None |
azure_base_url |
Azure OpenAI endpoint URL | None |
azure_prompt_optimizer |
LLM model used for prompt enhancement (Azure) | gpt-5-mini |
azure_image_model |
Image generation model identifier (Azure) | FLUX.1-Kontext-pro |
google_api_key |
Google AI API key | None |
google_prompt_optimizer |
LLM model used for prompt enhancement (Google) | gemini-2.0-flash-001 |
google_image_model |
Image generation model identifier (Google) | imagen-4.0-generate-preview-06-06 |
auth_tokens |
List of MCP tokens and scopes for authentication | [] |
Integration
This module is designed to be integrated into the main AppKit application rather than running standalone. The create_image_mcp_server function returns a configured FastMCP instance which is mounted by the main application.
Usage in AppKit
In app/app.py, the server is initialized effectively as follows:
from appkit_commons.registry import service_registry
from appkit_user.authentication.services import get_verifier
from appkit_mcp_image.server import create_image_mcp_server, init_generators
from appkit_mcp_image.configuration import MCPImageGeneratorConfig
# ... inside initialization ...
image_mcp_config = service_registry().get(MCPImageGeneratorConfig)
_generators = init_generators(image_mcp_config)
# Create and mount the MCP server
servers["/image"] = create_image_mcp_server(
_generators[image_mcp_config.generator],
auth=get_verifier(),
)
Tools & API
generate_image
Create images from text descriptions.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
prompt |
string | required | Image description (max 32,000 chars) |
size |
string | 1024x1024 |
Dimensions: 1024x1024, 1536x1024, 1024x1536, or auto |
output_format |
string | jpeg |
Output format: png, jpeg, or webp |
seed |
integer | 0 |
Random seed for reproducibility (0 = random) |
enhance_prompt |
boolean | true |
Auto-enhance prompt via LLM |
background |
string | auto |
Background: transparent, opaque, or auto |
Example:
generate_image(
prompt="A serene mountain landscape at sunset with golden light reflecting off a lake",
size="1536x1024",
output_format="png",
enhance_prompt=True,
)
edit_image
Edit existing images with text prompts and optional masks for inpainting.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
prompt |
string | required | Description of desired edits (max 32,000 chars) |
image_paths |
array | required | Image URLs, file paths, or base64 data URLs (max 16) |
mask_path |
string | optional | Optional mask image for inpainting (transparent areas indicate edit zones) |
size |
string | auto |
Output dimensions |
output_format |
string | jpeg |
Output format: png, jpeg, or webp |
background |
string | auto |
Background setting |
Example:
edit_image(
prompt="Add a vibrant rainbow across the sky",
image_paths=["https://example.com/landscape.jpg"],
mask_path="https://example.com/sky_mask.png",
output_format="png",
)
Image Input Formats
Supported input methods for image_paths parameter:
- HTTP/HTTPS URLs:
https://example.com/image.jpg - Local file paths:
/path/to/image.png - Base64 data URLs:
data:image/png;base64,iVBORw0KG...
Inpainting with Masks
For precise control over edits, use mask images:
- Create a PNG image with alpha transparency
- Transparent areas (alpha=0) mark regions to edit
- Opaque areas remain unchanged
- Mask dimensions must match the input image
License
This project is licensed under the MIT License - see LICENSE.md for details.
Metadata
Release files for appkit-mcp-image 1.17.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| appkit_mcp_image-1.17.1.tar.gz | 20.7 kB | Without provenance | Details for appkit_mcp_image-1.17.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| appkit_mcp_image-1.17.1-py3-none-any.whl | Python 3 | none | any | Details for appkit_mcp_image-1.17.1-py3-none-any.whl |
Total release size: 37.2 kB
Release files / appkit_mcp_image-1.17.1.tar.gz
| Download URL | appkit_mcp_image-1.17.1.tar.gz |
|---|---|
| Size | 20.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e5fe6e899db28b9fd559cab9b6654935ce10764f61267d7dcaab9268424871cf
|
|
BLAKE2b-256 checksum How to use checksums |
f2a9b4fcde33c3fe777fc91c5daf056aed0a2158b25652c1ababf9b92f37d3c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / appkit_mcp_image-1.17.1-py3-none-any.whl
| Download URL | appkit_mcp_image-1.17.1-py3-none-any.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a73a81f16deafa4ad1cf14f25706321945362a90b1e0332d4a81e164c5006d7
|
|
BLAKE2b-256 checksum How to use checksums |
aa38a68762b1d83c191186fb1af07c024c82be59a3947e2c1794e0783106be96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for appkit-mcp-image 1.17.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.