Image Generation MCP Server
Enables text-to-image and pixel art generation using Pollinations.ai with no API key required, and supports multiple models like Flux.
README
Image Generation MCP Server
A Model Context Protocol (MCP) server for generating images using Pollinations.ai. No API key required — completely free!
Features
- 🎨 Text-to-Image Generation — Generate high-quality images from text prompts
- 🖼️ Pixel Art Mode — Specialized pixel art generation for retro/8-bit styles
- 🚀 Multiple Models — Support for Flux, Flux-Pro, and Flux-Realism
- 💾 Auto-Save — Generated images are automatically saved to disk
- 🆓 Free — Uses Pollinations.ai which requires no API key
Installation
Prerequisites
- Python 3.8 or higher
- pip
Setup
-
Clone or navigate to the project directory:
cd image-gen-mcp -
Install the package in development mode:
pip install -e . -
(Optional) Configure output directory: Create a
.envfile in the project root:IMAGE_OUTPUT_DIR=./generated_images
Usage
Running the Server
python -m image_gen_mcp
The server will start and be ready to accept requests.
Available Tools
1. generate_image
Generate an image from a text prompt.
Parameters:
prompt(required): Description of the imagewidth(optional): Image width in pixels (default: 1024)height(optional): Image height in pixels (default: 1024)model(optional): Model to use - "flux", "flux-pro", or "flux-realism" (default: "flux")seed(optional): Random seed for reproducibility
Example:
{
"prompt": "a serene mountain landscape with a lake at sunset",
"width": 1024,
"height": 1024,
"model": "flux"
}
2. generate_pixel_art
Generate pixel art from a text prompt.
Parameters:
prompt(required): Description of the pixel artwidth(optional): Image width in pixels (default: 256)height(optional): Image height in pixels (default: 256)
Example:
{
"prompt": "a knight with a sword and shield",
"width": 256,
"height": 256
}
3. list_providers
List available image generation providers and their capabilities.
Example:
{}
Integration with Claude
To use this MCP with Claude Code, add it to your Claude configuration:
- Edit
~/.claude/settings.json - Add the MCP server configuration:
{
"mcpServers": {
"image-gen-mcp": {
"command": "python",
"args": ["-m", "image_gen_mcp"],
"env": {
"IMAGE_OUTPUT_DIR": "./generated_images"
}
}
}
}
- Restart Claude Code
Generated Images
By default, images are saved to ./generated_images/ with filenames like:
prompt_description_1719489264.png
You can change the output directory using the IMAGE_OUTPUT_DIR environment variable.
Troubleshooting
Connection Timeout
If you get a timeout error, it may be because:
- The image generation is taking longer than expected
- Your internet connection is unstable
- Pollinations.ai service is temporarily down
Try again or increase the timeout in providers.py (currently 120 seconds).
Generation Failures
- Ensure you have a stable internet connection
- Try a simpler prompt
- Check that Pollinations.ai is accessible
Architecture
image-gen-mcp/
├── src/image_gen_mcp/
│ ├── __init__.py
│ ├── __main__.py # Entry point
│ ├── server.py # MCP server implementation
│ └── providers.py # Image generation providers
├── pyproject.toml # Project configuration
└── README.md
Contributing
Feel free to extend this server with:
- Additional image generation providers (Together AI, Hugging Face, etc.)
- Caching mechanisms
- Batch generation
- Image enhancement tools
- Cost tracking
License
MIT License
Disclaimer
This project uses Pollinations.ai for image generation. Make sure to comply with their terms of service and respect copyright and usage rights when generating images.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。