image2-mcp
MCP server for the company image2 text-to-image API, enabling AI tools to generate images directly from text prompts.
README
image2-mcp
MCP Server for the company image2 text-to-image API. Allows Claude Code, Codex, and other MCP-compatible AI tools to generate images directly.
๐ Quick Start (One Command)
git clone <repo-url>
cd image2-mcp
bash scripts/setup.sh
The script will:
- Check that
uvis installed - Install Python dependencies (
uv sync) - Ask for your API key (or reuse from
~/.claude/.env) - Write
~/.claude/.envwith your key - Add
image2to your~/.claude/.mcp.json - Run a health check to verify everything works
Then restart Claude Code and try: "ๅธฎๆ็ๆไธๅผ ๅพ็..."
๐ฆ Manual Setup
Prerequisites
- Python 3.10+
- uv (Python package manager)
- A company API Key for the unified AI platform
Install
uv sync
Configuration
Copy the environment template and fill in your API key:
cp .env.example ~/.claude/.env
# Edit ~/.claude/.env and set MAGENE_API_KEY
| Variable | Required | Default | Description |
|---|---|---|---|
MAGENE_API_KEY |
Yes | โ | Your company API key |
MAGENE_API_BASE_URL |
No | http://localhost:11636/api/v1/images/generations (set via env) |
API endpoint |
IMAGE2_OUTPUT_DIR |
No | System temp dir /image2-output |
Default image save location |
IMAGE2_MODEL |
No | openai/gpt-image-2 |
Model name override |
MCP Configuration
Add to ~/.claude/.mcp.json:
{
"mcpServers": {
"image2": {
"command": "bash",
"args": [
"-c",
"set -a; [ -f ~/.claude/.env ] && . ~/.claude/.env; [ -f .env ] && . ./.env; set +a; uv run --directory /path/to/image2-mcp python -m image2_mcp"
],
"description": "ๆ็ๅพ โ ่ฐ็จๅ
ฌๅธ็ปไธ API ๅนณๅฐ image2 ๆจกๅ็ๆๅพ็"
}
}
}
Health Check
uv run python -m image2_mcp --health-check
๐ง How It Works
The AI calls generate_image as a native tool:
AI: generate_image(prompt="a cat in a garden", size="1024x1024")
โ Server validates parameters
โ POST to company API
โ Decodes Base64 response
โ Saves PNG to disk
โ Returns image + file path + usage stats to AI
๐ Tool Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
prompt |
string | Yes | โ | Text description of the image (max 32000 chars) |
size |
string | Yes | โ | Image size (see below) |
quality |
string | No | auto |
low, medium, high, or auto |
output_dir |
string | No | From env | Custom output directory |
filename |
string | No | Auto-generated | Custom filename (without .png) |
Available Sizes
| Value | Resolution |
|---|---|
1024x1024 |
1K Square |
1536x1024 |
1.5K Landscape |
1024x1536 |
1.5K Portrait |
2048x2048 |
2K Square |
2048x1152 |
2K Landscape |
3840x2160 |
4K Landscape |
2160x3840 |
4K Portrait |
auto |
Automatic |
Custom sizes supported: WxH format, max 3840px per side, multiples of 16,
aspect ratio โค 3:1, total pixels 655,360โ8,294,400.
๐งช Development
uv sync --group dev
uv run pytest --cov=src --cov-report=term-missing
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.