Skip to main content

MCP server for MiniMax image generation (text-to-image and image-to-image)

Project description

yooztech_mcp_minimax_t2i —— MiniMax 图片生成 MCP 工具

基于 MCP (Model Context Protocol) 的 MiniMax 图片生成服务,提供文生图(text-to-image)与图生图(image-to-image)两种核心功能。

功能概述

  • text_to_image(prompt, ...): 根据文本描述生成图片
  • image_to_image(prompt, subject_reference, ...): 结合参考图生成图片

在 Cursor 中配置

需要在 MCP Server 配置中设置环境变量 MINIMAX_API_KEY

{
  "mcpServers": {
    "yooztech_mcp_minimax_t2i": {
      "command": "yooztech_mcp_minimax_t2i",
      "args": [],
      "env": {
        "MINIMAX_API_KEY": "your-api-key"
      }
    }
  }
}

或使用 uvx 方式:

{
  "mcpServers": {
    "yooztech_mcp_minimax_t2i": {
      "command": "uvx",
      "args": ["yooztech_mcp_minimax_t2i"],
      "env": {
        "MINIMAX_API_KEY": "your-api-key"
      }
    }
  }
}

API Key 获取

请访问 MiniMax 开放平台 注册账号并获取 API Key。

工具详解

1. text_to_image - 文生图

根据详尽的文本描述(prompt),直接生成与之匹配的图片。

参数:

  • prompt (必填): 图片描述文本,建议详细描述场景、主体、风格等
  • model (可选): 使用的模型,默认 "image-01"
  • aspect_ratio (可选): 图片宽高比,默认 "16:9"
    • 可选值:1:1, 16:9, 9:16, 4:3, 3:4

返回:

  • success: 是否成功
  • images: 生成的图片 URL 列表
  • model: 使用的模型
  • aspect_ratio: 宽高比

使用示例:

{
  "tool": "text_to_image",
  "args": {
    "prompt": "men Dressing in white t shirt, full-body stand front view image :25, outdoor, Venice beach sign, full-body image, Los Angeles, Fashion photography of 90s, documentary, Film grain, photorealistic",
    "aspect_ratio": "16:9"
  }
}

2. image_to_image - 图生图

此功能允许提供一张或多张包含清晰主体的参考图(支持网络图片链接),并结合 prompt 描述,生成一张保留了主体特征的新图片。

参数:

  • prompt (必填): 图片描述文本,描述希望生成的场景
  • subject_reference (必填): 参考图列表,每项包含:
    • type: 参考图类型,目前仅支持 "character"(角色)
    • image_file: 参考图 URL(支持网络图片链接)
  • model (可选): 使用的模型,默认 "image-01"
  • aspect_ratio (可选): 图片宽高比,默认 "16:9"

返回:

  • success: 是否成功
  • images: 生成的图片 URL 列表
  • model: 使用的模型
  • aspect_ratio: 宽高比

使用示例:

{
  "tool": "image_to_image",
  "args": {
    "prompt": "女孩在图书馆的窗户前,看向远方",
    "subject_reference": [
      {
        "type": "character",
        "image_file": "https://cdn.hailuoai.com/prod/2025-08-12-17/video_cover/xxx.jpg"
      }
    ]
  }
}

完整使用流程

  1. 在 Cursor 配置中设置 MINIMAX_API_KEY 环境变量
  2. 调用 text_to_imageimage_to_image 生成图片
  3. 获取返回的图片 URL 列表(直接返回 URL,无需处理 Base64)

错误处理

所有工具在失败时会返回包含错误信息的字典,包含以下字段:

  • success: 是否成功
  • error: 错误类型
  • message: 错误详情

依赖

  • Python >= 3.10
  • mcp >= 1.2.0
  • httpx >= 0.27.0

许可证

MIT (见 LICENSE)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yooztech_mcp_minimax_t2i-0.0.2.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yooztech_mcp_minimax_t2i-0.0.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file yooztech_mcp_minimax_t2i-0.0.2.tar.gz.

File metadata

File hashes

Hashes for yooztech_mcp_minimax_t2i-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8e555718e880e40595d66e70605fccf2fa1c73bfa1306097fa81ce2aeda1527a
MD5 e4ff90a4bfeaddda634edfccf311a599
BLAKE2b-256 e1bcb49c113652180640cf24ad8964a969a658ee3996434c43c5129daade1481

See more details on using hashes here.

File details

Details for the file yooztech_mcp_minimax_t2i-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for yooztech_mcp_minimax_t2i-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7995727bcf6c9c9b41b763c1049b775c9a91873acc64642155069b70a844d81e
MD5 170e0209b23fa89a895554e9dad1ac7c
BLAKE2b-256 f5112d12ac15b909ecdb60f78dfb7fe87e0a7d5306df28641f9d69460e40bd9a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page