image-gen-mcp
Allows generating images using OpenAI's DALL-E models (DALL-E 2 and DALL-E 3) by providing a prompt and optional parameters.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@image-gen-mcpGenerate a picture of a cyberpunk cat in a neon city"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Image Gen MCP Server — 文生图能力代理 🎨
让 LLM 通过 MCP 调用 AI 模型生成图片。只需一个 API Key,即可让任何 AI 客户端拥有图片生成能力。
每个部署者自行选择图片生成提供商和默认模型,只需在部署时配置环境变量即可。
功能
工具 | 说明 |
| 根据文字描述生成图片。传入 prompt + 可选参数,返回图片 URL |
| 查看当前提供商和推荐使用的模型列表 |
Related MCP server: MCP OpenAI Image Generation Server
支持的图片生成提供商
提供商 |
| 特点 |
硅基流动 |
| 国内直接访问,免费额度,推荐中文用户 |
OpenAI |
| DALL-E 3,需国际网络 |
自定义接口 |
| 任何 OpenAI 兼容接口(中转 API) |
一键运行(无需手动安装)
项目支持 uvx / pip 两种方式一键运行,无需手动克隆仓库。
方式 | 命令 | 前提条件 |
uvx 🏆 |
| 安装 uv(自动安装 Python 依赖) |
pip |
| 安装 Python 3.10+ |
# uvx 运行(默认 stdio 模式,适用于本地 Reasonix 接入)
uvx --from git+https://github.com/DoctorPan/image-gen-mcp image-gen-mcp
# uvx 运行(SSE 模式,用于远程部署)
uvx --from git+https://github.com/DoctorPan/image-gen-mcp image-gen-mcp --transport sse --port 8000
# 需要先设置环境变量
set IMAGE_API_KEY=你的硅基流动APIKey
set IMAGE_PROVIDER=siliconflow注意:uvx 会自动从 GitHub 拉取代码并安装 Python 依赖,首次运行可能需要几十秒。
在 Reasonix 中配置(推荐)
方式一:通过 uvx 一键运行(推荐)
无需克隆仓库、无需手动安装依赖,Reasonix 自动通过 uvx 拉取运行:
{
"mcpServers": {
"image-gen-mcp": {
"command": "uvx",
"args": ["--from", "git+https://github.com/DoctorPan/image-gen-mcp", "image-gen-mcp"],
"env": {
"IMAGE_API_KEY": "你的硅基流动 API Key",
"IMAGE_PROVIDER": "siliconflow",
"DEFAULT_IMAGE_MODEL": "black-forest-labs/FLUX.1-dev"
}
}
}
}方式二:本地 Python 直接运行(已克隆项目)
{
"mcpServers": {
"image-gen-mcp": {
"command": "python",
"args": ["C:\\path\\to\\image-gen-mcp\\server.py"],
"env": {
"IMAGE_API_KEY": "你的硅基流动 API Key",
"IMAGE_PROVIDER": "siliconflow",
"DEFAULT_IMAGE_MODEL": "black-forest-labs/FLUX.1-dev"
}
}
}
}方式三:远程 SSE URL(部署到魔搭后)
{
"mcpServers": {
"image-gen-mcp": {
"url": "https://mcp.api-inference.modelscope.net/xxxxx/mcp"
}
}
}快速开始(本地开发)
# 1. 进入项目目录
cd image-gen-mcp
# 2. 安装依赖
pip install -r requirements.txt
# 3. 复制配置模板
copy .env.example .env
# 4. 编辑 .env,填入你的配置
# IMAGE_API_KEY=sk-xxx
# IMAGE_PROVIDER=siliconflow
# 5. 启动(默认 stdio 模式)
python server.py
# 或者本地测试 SSE 模式
python server.py --transport sse --port 8000如何使用
示例:生成一张图片
generate_image(
prompt="一只穿着西装的猫,坐在办公室的老板椅上,夕阳从窗外照进来,赛博朋克风格",
model="black-forest-labs/FLUX.1-dev",
size="1024x1024"
)选择不同的提供商
在 generate_image 的 model 参数中传入不同的模型名称:
提供商 | 推荐模型 | 尺寸支持 |
硅基流动 |
| 1024x1024、768x1344、864x1152、1344x768、1152x864 |
硅基流动 |
| 同上 |
OpenAI |
| 1024x1024、1792x1024、1024x1792 |
OpenAI |
| 256x256、512x512、1024x1024 |
部署到魔搭 Hosted(SSE 模式)🚀
魔搭社区提供 Hosted MCP 服务,可以将你的 MCP 服务器部署在魔搭云端,生成 SSE URL 供远程调用。
部署步骤
第 1 步:将代码推送到 GitHub
cd image-gen-mcp
git init
git add .
git commit -m "初始提交"
git remote add origin https://github.com/DoctorPan/image-gen-mcp.git
git push -u origin main第 2 步:在魔搭提交 MCP 服务
进入 MCP 广场 → 点击 提交 MCP 服务
填写以下信息:
字段 | 内容 |
服务名称 |
|
中文名称 | 文生图能力代理 |
描述 | 让 LLM 通过 MCP 调用 AI 模型生成图片。支持硅基流动、OpenAI 等多个提供商。 |
源代码地址 |
|
启动命令 |
|
传输方式 | SSE |
第 3 步:部署 Hosted 服务
审核通过后,在 MCP 管理页面找到 image-gen-mcp,点击部署,选择 Hosted 部署类型,配置环境变量:
变量 | 必填 | 值 |
| ✅ | 你的图片生成 API Key |
| ❌ |
|
| ❌ |
|
部署成功后,魔搭会生成 SSE URL。
环境变量速查
环境变量 | 作用 | 示例值 |
| ⭐ 你的 API Key(必填) |
|
| 选择提供商 |
|
| 自定义 API 地址 |
|
| 调用的默认模型 |
|
| 默认图片尺寸 |
|
| 传输模式 |
|
| SSE 监听地址 |
|
| SSE 监听端口 |
|
命令行参数
python server.py --help
# 输出:
usage: server.py [-h] [--transport {stdio,sse}] [--host HOST] [--port PORT]
Image Gen MCP Server — 文生图能力代理
options:
-h, --help show this help message and exit
--transport {stdio,sse}
传输模式: stdio (默认) / sse (远程部署)
--host HOST SSE 监听地址 (默认 0.0.0.0)
--port PORT SSE 监听端口 (默认 8000)项目结构
image-gen-mcp/
├── pyproject.toml # Python 项目配置,支持 uvx 一键运行
├── server.py # MCP 服务器主代码
├── requirements.txt # Python 依赖
├── .env.example # 环境变量模板
├── .gitignore
└── README.md许可证
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Doctor-Pan-code/image-gen-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server