支持使用ModelScope上的模型进行文本到图像的生成。
2.3w 查看 · 2026-07-07 更新
简介
支持使用ModelScope上的模型进行文本到图像的生成。
简介
支持使用ModelScope上的模型进行文本到图像的生成。
ModelScope 图像生成 MCP
一个强大的模型上下文协议(MCP)服务器,集成了 ModelScope 的图像生成功能,通过聊天界面实现无缝的 AI 图像创建和模型发现。
功能特性
- 🔍 模型发现:使用关键词搜索和探索 ModelScope 上的模型,支持高级筛选选项
- 🎨 文本生成图像:使用最先进的模型从文本描述生成高质量图像
- 🖼️ 图像转换图像:基于文本提示转换现有图像,实现创意编辑
- 📊 模型分析:按热度、下载量或修改日期对模型进行排序
- 🚀 简单集成:与支持 MCP 的聊天客户端无缝集成
可用工具
模型搜索工具
🔍 search_models - 搜索和发现 ModelScope 上的模型
| 参数 | 类型 | 描述 | 示例 |
|---|---|---|---|
query | string | 搜索关键词 | "Flux", "SDXL", "" |
task | string | 按任务类型筛选(可选) | "text-to-image" |
libraries | string | 按库类型筛选(可选) | "LoRA" |
sort | string | 排序方式(可选) | "DownloadsCount", "StarsCount", "GmtModified" |
limit | integer | 结果数量 (1-30)(可选) | 10 |
图像生成工具
🎨 generate_image_url_from_text - 从文本描述创建图像
| 参数 | 类型 | 描述 | 默认值 |
|---|---|---|---|
description | string | 图像生成的文本提示 | 必需 |
model | string | 默认使用的模型 ID | "Qwen/Qwen-Image" |
✍️ generate_image_url_from_text_and_image_url - 转换现有图像
| 参数 | 类型 | 描述 | 默认值 |
|---|---|---|---|
description | string | 图像转换的文本提示 | 必需 |
image_url | string | 输入图像的 URL | 必需 |
model | string | 默认使用的模型 ID | "black-forest-labs/FLUX.1-Kontext-dev" |
热门可用模型
- 文本生成图像:
Qwen/Qwen-Image(默认) - 图像转换图像:
black-forest-labs/FLUX.1-Kontext-dev(默认) - 还有 10000+ 模型可通过 ModelScope 平台获得!
配置
步骤 1:获取 API 密钥
从 ModelScope API 密钥 获取您的 API 密钥以访问 API。
步骤 2:配置 MCP 客户端
将以下配置添加到您的 MCP 客户端(例如,Cherry Studio、Claude Desktop):
{ "MS-ImgGen-MCP": { "command": "uvx", "args": ["ms_image_gen_mcp@latest"], "env": { "MODELSCOPE_API_KEY": "YOUR_MODELSCOPE_API_KEY" } } }
开发者
前置要求
- Python 3.11+:运行 MCP 服务器所需
- ModelScope API 密钥:从 ModelScope 获取 API 访问权限
- Node.js(可选):MCP Inspector 调试所需
安装
通过 pip 安装软件包:
pip install ms-image-gen-mcp
使用 MCP Inspector 调试
用于开发和调试,使用 MCP Inspector:
npx @modelcontextprotocol/inspector -e MODELSCOPE_API_KEY=YOUR_MODELSCOPE_API_KEY python -m ms_image_gen_mcp
版本历史
| 版本 | 更改内容 |
|---|---|
| 1.2.0 | 转换为异步 API |
| 1.1.0 | 添加模型搜索和图像到图像生成 |
| 1.0.0 | 初始发布,支持文本到图像生成 |
工具列表
-
search_models: Search for models on ModelScope.
-
text_to_image: Generate an image from the input description using ModelScope API, it returns the image URL.
Args: description: the description of the image to be generated, containing the desired elements and visual features. model: the model name to be used for image generation, default is "Qwen/Qwen-Image".
- text_image_to_image: Generate an image from the input description and input image_url using ModelScope API, it returns the image URL.
Args: description: the description of the image to be generated, containing the desired elements and visual features. image_url: the image URL to be used as the input image for image generation. model: the model name to be used for image generation, default is "black-forest-labs/FLUX.1-Kontext-dev".
服务配置
[{'mcpServers': {'modelscope-image-gen-mcp': {'args': ['ms_image_gen_mcp'], 'command': 'uvx', 'env': {'MODELSCOPE_API_KEY': 'YOUR_MODELSCOPE_TOKEN'}}}}]
来源
- 来源:github
- 链接:https://pypi.org/project/ms-image-gen-mcp/