Skip to main content
Glama

Image Gen MCP Server — 文生图能力代理 🎨

让 LLM 通过 MCP 调用 AI 模型生成图片。只需一个 API Key,即可让任何 AI 客户端拥有图片生成能力。

每个部署者自行选择图片生成提供商和默认模型,只需在部署时配置环境变量即可。

功能

工具

说明

generate_image

根据文字描述生成图片。传入 prompt + 可选参数,返回图片 URL

list_image_models

查看当前提供商和推荐使用的模型列表

Related MCP server: MCP OpenAI Image Generation Server

支持的图片生成提供商

提供商

IMAGE_PROVIDER

特点

硅基流动

siliconflow

国内直接访问,免费额度,推荐中文用户

OpenAI

openai

DALL-E 3,需国际网络

自定义接口

custom

任何 OpenAI 兼容接口(中转 API)

一键运行(无需手动安装)

项目支持 uvx / pip 两种方式一键运行,无需手动克隆仓库。

方式

命令

前提条件

uvx 🏆

uvx --from git+https://github.com/DoctorPan/image-gen-mcp image-gen-mcp

安装 uv(自动安装 Python 依赖)

pip

pip install git+https://github.com/DoctorPan/image-gen-mcp && image-gen-mcp

安装 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_imagemodel 参数中传入不同的模型名称:

提供商

推荐模型

尺寸支持

硅基流动

black-forest-labs/FLUX.1-dev

1024x1024、768x1344、864x1152、1344x768、1152x864

硅基流动

stabilityai/stable-diffusion-3-5-large

同上

OpenAI

dall-e-3

1024x1024、1792x1024、1024x1792

OpenAI

dall-e-2

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 服务

  1. 登录 https://modelscope.cn

  2. 进入 MCP 广场 → 点击 提交 MCP 服务

  3. 填写以下信息:

字段

内容

服务名称

image-gen-mcp

中文名称

文生图能力代理

描述

让 LLM 通过 MCP 调用 AI 模型生成图片。支持硅基流动、OpenAI 等多个提供商。

源代码地址

https://github.com/DoctorPan/image-gen-mcp

启动命令

python server.py --transport sse --port 8000

传输方式

SSE

第 3 步:部署 Hosted 服务

审核通过后,在 MCP 管理页面找到 image-gen-mcp,点击部署,选择 Hosted 部署类型,配置环境变量:

变量

必填

IMAGE_API_KEY

你的图片生成 API Key

IMAGE_PROVIDER

siliconflow(默认)

DEFAULT_IMAGE_MODEL

black-forest-labs/FLUX.1-dev

部署成功后,魔搭会生成 SSE URL。

环境变量速查

环境变量

作用

示例值

IMAGE_API_KEY

⭐ 你的 API Key(必填)

sk-xxx

IMAGE_PROVIDER

选择提供商

siliconflow / openai / custom

IMAGE_BASE_URL

自定义 API 地址

https://your-api.com/v1

DEFAULT_IMAGE_MODEL

调用的默认模型

black-forest-labs/FLUX.1-dev

DEFAULT_IMAGE_SIZE

默认图片尺寸

1024x1024

IMAGE_MCP_TRANSPORT

传输模式

stdio(本地) / sse(远程)

IMAGE_MCP_HOST

SSE 监听地址

0.0.0.0

IMAGE_MCP_PORT

SSE 监听端口

8000

命令行参数

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

Available Tools

2 tools
generate_imageA

根据文字描述生成一张或多张图片。

向图片生成模型发送文字描述(prompt),模型会生成对应的图片并返回图片 URL。 支持多个提供商,默认使用硅基流动(免费额度)。

model 参数不传时使用默认模型。不同提供商默认模型不同:

  • siliconflow: black-forest-labs/FLUX.1-dev(高质量开源模型)

  • openai: dall-e-3

  • custom: 由部署者自定

你也可以传入自己熟悉的任意模型名称(只要在你的提供商平台可用)。

size 参数控制图片尺寸:

  • siliconflow 推荐: 1024x1024(默认)

  • openai DALL-E 3: 1024x1024 / 1792x1024 / 1024x1792

适用于:

  • 根据描述生成插图、海报、概念图

  • 为文章、演示生成配图

  • 创意设计、头脑风暴视觉化

  • 生成社交媒体图片

注意:生成的图片 URL 通常有有效期(数小时到数天),请及时保存。

ParametersJSON Schema
NameRequiredDescriptionDefault
nNo
sizeNo
modelNo
promptYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. Discloses multi-provider support, default model behavior, size constraints, and URL expiration. Does not mention rate limits or authorization, but covers main behavioral traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with bullet points and sections. Information is valuable but slightly lengthy; some repetition could be trimmed. Good front-loading of purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given output schema exists, return values need no explanation. Covers generation behavior, provider options, parameter defaults, and URL expiry. Could explicitly mention sibling tool for model list, but overall very complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Despite 0% schema coverage signal, description explains 'model' (defaults per provider, custom) and 'size' (recommended dimensions) in detail. 'n' is implied but not explicitly explained; 'prompt' is clarified as text description. Adds significant meaning beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool generates images from text descriptions, using verb 'generate' and resource 'image(s)'. It distinguishes itself from the sibling tool 'list_image_models' by being about generation, not listing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides specific use cases (illustrations, posters, etc.), default models per provider, and size recommendations. Lacks explicit 'when not to use' or direct alternatives, but the sibling tool context helps.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_image_modelsB

列出当前提供商推荐使用的图片生成模型列表及使用说明。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so the description must fully cover behavioral traits. It only states the tool lists models and instructions, with no mention of auth, rate limits, or read-only nature.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single clear sentence, front-loaded with the action and resource. No redundancy, though it could be expanded slightly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given zero parameters and an output schema, the description is adequate but could specify the source of the data (e.g., provider-specific) or the format of usage instructions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are zero parameters, so the schema provides no information. The description adds meaning by indicating the output includes model list and usage instructions, but it is minimal.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool lists image generation models and usage instructions recommended by the current provider. It distinguishes from sibling generate_image by focusing on listing rather than generation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied but not explicit. It is reasonable to use this before generate_image, but no explicit when-to-use or alternative guidance is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 2 tool updatesv1.0.0
    • First observedgenerate_image
    • First observedlist_image_models

TDQS

A3.7/5.0
Disambiguation5/5

The two tools have completely distinct purposes: one lists available image models, the other generates images. No overlap or confusion possible.

Naming Consistency5/5

Both tools use a consistent verb_noun pattern in snake_case: 'list_image_models' and 'generate_image', making them predictable and easy to understand.

Tool Count3/5

With only 2 tools, the server feels under-scoped for its stated support of multiple providers and model selection. While minimal, it may be acceptable for a focused image generation task, but lacks coverage for related operations.

Completeness3/5

The server covers basic listing and generation, but lacks tools for retrieving generated images (URLs expire), managing providers, or handling model customization beyond the generate call. Minor gaps exist that could limit agent autonomy.

Maintenance

ActivitySlowing
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

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