Project description

Feature

  • ? Support text to image generation backed by models on ModelScope

Prerequisites

  1. Python 3.11+

  2. ModelScope Token (obtained from ModelScope)

  3. Node.js (optional, for MCP Inspector)

Install

  1. python packages
pip install -r requirements.txt
  1. install modelscope-image-gen-mcp
pip install modelscope_image_gen_mcp

Debug by MCP Inspector

start the inspector by following command in terminal (replace YOUR_MODELSCOPE_TOKEN with your own token):

npx @modelcontextprotocol/inspector -e MODELSCOPE_API_KEY=YOUR_MODELSCOPE_API_KEY python -m modelscope_image_gen_mcp

Start the server

start the server by following command:

env MODELSCOPE_API_KEY=YOUR_MODELSCOPE_API_KEY python -m modelscope_image_gen_mcp

or you can add following json into your config file

{
    "mcpServers": {
        "modelscope_image_gen_mcp": {
            "command": "python",
            "args": [
                "-m",
                "modelscope_image_gen_mcp"
            ],
            "env": {
                "MODELSCOPE_API_KEY": "MODELSCOPE_API_KEY"
            }
        }
    }
}
[
  {
    "description": "Generate an image from the input description using ModelScope API, it returns the image URL.nnArgs:n    english_description: the description in english of the image to be generated, containing the desired elements and visual features.n    model: the model name to be used for image generation, default is "MusePublic/489_ckpt_FLUX_1".n",
    "inputSchema": {
      "properties": {
        "english_description": {
          "title": "English Description",
          "type": "string"
        },
        "model": {
          "default": "MusePublic/489_ckpt_FLUX_1",
          "title": "Model",
          "type": "string"
        }
      },
      "required": [
        "english_description"
      ],
      "title": "generate_image_url_from_textArguments",
      "type": "object"
    },
    "name": "generate_image_url_from_text"
  }
]