@mcpcn/image-ai-generation-mcp
v2.0.7
Published
AI image generation MCP tool powered by the Nano Banana Pro API
Readme
AI Image Generation MCP
An AI image generation MCP tool powered by the Nano Banana Pro API. It creates high-quality images from text prompts.
Features
- Intelligent image generation from text prompts
- GPT Image-2 text-to-image task creation
- Optional platform-side content filtering control
- Optional callback URL for completed tasks
- Async task polling through
query-task - Cloud generation with image URLs returned by the API
Installation
npm install
npm run buildConfiguration
Set the KIE_API_KEY environment variable:
export KIE_API_KEY=your_api_key_hereGet an API key at https://kie.ai/api-key.
You can optionally set KIE_MODEL to override the default model:
export KIE_MODEL=gpt-image-2-text-to-imageUsage
Tool 1: generate-image
Creates an image generation task. If the image completes within 2 seconds, the tool returns the image URL directly. Otherwise, it returns a task ID for async polling.
Parameters:
prompt(required): Image generation prompt. Describe the desired image in detail, up to 20,000 characters.nsfw_checker(optional): Whether to disable platform-side content filtering. Defaults tofalse.callBackUrl(optional): Callback URL invoked after the task completes.
Example:
{
"prompt": "A cute orange cat sitting on a windowsill, looking out at a snowy landscape",
"nsfw_checker": false
}Example with callback URL:
{
"prompt": "A watercolor-style mountain cabin at sunrise, soft light, detailed brush texture",
"nsfw_checker": false,
"callBackUrl": "https://example.com/callback"
}Synchronous success response:
{
"status": "success",
"message": "Image generation completed.",
"prompt": "A cute orange cat sitting on a windowsill, looking out at a snowy landscape",
"nsfw_checker": false,
"imageUrl": "https://static.aiquickdraw.com/tools/example/image.png"
}Async response:
{
"status": "async",
"message": "Image generation is taking longer than expected and has switched to async mode.",
"taskId": "281e5b0*********************f39b9",
"prompt": "A cute orange cat sitting on a windowsill, looking out at a snowy landscape",
"nsfw_checker": false,
"tip": "Use the query-task tool to check task progress and results."
}Tool 2: query-task
Queries the status and progress of an image generation task.
Parameters:
taskId(required): Task ID returned bygenerate-image.
Example:
{
"taskId": "281e5b0*********************f39b9"
}Response format:
{
"taskId": "281e5b0*********************f39b9",
"state": "success",
"model": "gpt-image-2-text-to-image",
"elapsedSeconds": 45,
"imageUrl": "https://static.aiquickdraw.com/tools/example/1763662100739_DlBXJvdR.png",
"failCode": null,
"failMsg": null,
"createdAt": "2026-01-22T03:00:00.000Z",
"completedAt": "2026-01-22T03:00:45.000Z"
}State values:
waiting: The task is queued or still processing.success: The task completed successfully. Retrieve the image fromimageUrl.fail: The task failed. CheckfailMsgfor details.
Prompt Tips
For better results:
- Describe the subject, environment, lighting, colors, and other details.
- Specify the desired artistic style or visual reference.
- Describe composition details such as camera angle, depth of field, and focal point.
- Include the mood or atmosphere you want the image to convey.
Good prompt examples:
- "A girl in a red dress dancing under cherry blossom trees, soft sunlight filtering through the petals, dreamy pink tones, cinematic composition"
- "A cyberpunk Tokyo street after rain, neon signs glowing, wet pavement reflecting colorful light, wide-angle lens"
- "An oil painting of a mountain cabin in autumn, golden leaves, warm fireplace light through the window, peaceful atmosphere"
API Notes
This tool uses the Nano Banana Pro API. See https://kie.ai/api-key for details.
Development
# Development mode
npm run dev
# Build
npm run build
# Clean
npm run cleanLicense
MIT
