Back to MCP directory
publicPublicdnsLocal runtime

Image-Generation-MCP-Server

Image Generation MCP Server是一个为Claude Desktop提供图像生成功能的MCP服务器,使用Replicate Flux模型,支持通过文本提示生成图像,并可通过Smithery或npm安装配置。

article

README

🚀 图像生成 MCP 服务器

本 MCP 服务器借助 Replicate Flux 模型,为用户提供强大的图像生成功能,满足多样化的图像创作需求。

MCP Server 徽数字徽章

smithery 徽数字徽章

🚀 快速开始

此 MCP 服务器使用 Replicate Flux 模型提供图像生成功能。

📦 安装指南

通过 Smithery 安装

要自动为 Claude Desktop 安装图像生成 MCP 服务器,请通过 Smithery 安装:

npx -y @smithery/cli install @GongRzhe/Image-Generation-MCP-Server --client claude

选项 1:NPX 方法(无需本地设置)

您可以直接从 npm 使用该包,而无需本地安装:

# 无需安装 - npx 会处理

选项 2:本地安装

如果您更喜欢本地安装:

# 全局安装
npm install -g @gongrzhe/image-gen-server

# 或者本地安装
npm install @gongrzhe/image-gen-server

📚 详细文档

设置

配置 Claude Desktop

编辑您的 Claude Desktop 配置文件:

  • 在 MacOS 上:~/Library/Application Support/Claude/claude_desktop_config.json
  • 在 Windows 上:%APPDATA%/Claude/claude_desktop_config.json
选项 1:NPX 配置(推荐)

此方法直接从 npm 运行服务器,而无需本地文件:

{
  "mcpServers": {
    "image-gen": {
      "command": "npx",
      "args": ["@gongrzhe/image-gen-server"],
      "env": {
        "REPLICATE_API_TOKEN": "your-replicate-api-token",
        "MODEL": "alternative-model-name"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}
选项 2:本地安装配置

如果您已将包本地安装:

{
  "mcpServers": {
    "image-gen": {
      "command": "node",
      "args": ["/path/to/image-gen-server/build/index.js"],
      "env": {
        "REPLICATE_API_TOKEN": "your-replicate-api-token",
        "MODEL": "alternative-model-name"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

环境变量

| 属性 | 详情 | |------|------| | REPLICATE_API_TOKEN | 用于访问 Replicate API 的令牌。 | | MODEL | 可选的自定义模型名称。 |

获取 API 令牌

  1. 访问 Replicate 并注册一个账户。
  2. 在您的个人资料中找到 API 令牌。

💻 使用示例

图像生成工具

功能

  • 生成高质量图像
  • 支持多种风格和模型

基础用法

await craft.image.generate({
  model: "stability-ai/sdxl", // 模型名称
  prompt: "一只飞天的unicorn站在 rainbow mountain上", // 图像描述
  negative_prompt: "", // 可选,排除的内容
  width: 1024, // 图像宽度
  height: 1024, // 图像高度
  samples: 1, // 生成图像的数量
  num_inference_steps: 20, // 推理步骤数
});

示例

The tool returns an array of URLs to the generated images.

📄 许可证

本项目根据 MIT 许可证授权。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client