Flux Image MCP Server

by ckz
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Enables image generation using the Flux Schnell model hosted on Replicate, allowing users to create images based on text prompts.

Flux 图像 MCP 服务器

该 MCP 服务器使用 Replicate 上的 Flux Schnell 模型提供图像生成功能。

安装

  1. 全局安装 MCP SDK:
npm install -g @modelcontextprotocol/sdk@latest
  1. 将此存储库克隆到您的 MCP 服务器目录:
cd ~/Documents/Cline/MCP git clone https://github.com/yourusername/flux-img-mcp.git cd flux-img-mcp npm install
  1. 构建服务器:
npm run build
  1. 将服务器配置添加到您的 MCP 设置文件(全局或工作区):
{ "mcpServers": { "flux-img": { "command": "node", "args": ["/path/to/flux-img-mcp/build/index.js"], "env": { "REPLICATE_API_TOKEN": "your-replicate-api-token" }, "disabled": false, "alwaysAllow": [] } } }

配置

服务器需要以下环境变量:

用法

一旦安装并配置完毕,服务器将提供以下工具:

生成图像

根据文本提示,使用 Flux Schnell 模型生成图像。

参数:

  • prompt (字符串,必需):所需图像的文本描述

使用示例:

<use_mcp_tool> <server_name>flux-img</server_name> <tool_name>generate_image</tool_name> <arguments> { "prompt": "A beautiful sunset over mountains" } </arguments> </use_mcp_tool>

该工具将返回包含以下内容的 JSON 响应:

  • status :生成请求的状态
  • output :生成图像的 URL(如果成功)
  • error :任何错误消息(如果失败)

发展

要对服务器进行更改:

  1. 修改src/index.ts中的源代码
  2. 重建服务器: npm run build
  3. 重新启动 MCP 服务器以使更改生效

错误处理

该服务器包括针对以下方面的全面错误处理:

  • 缺少 API 令牌
  • 参数无效
  • API 请求失败
  • 网络问题

安全

  • 切勿将您的复制 API 令牌提交到版本控制
  • 始终通过环境变量提供令牌
  • 服务器在发出 API 请求之前验证所有输入参数
-
security - not tested
A
license - permissive license
-
quality - not tested

使用 Replicate 上的 Flux Schnell 模型提供图像生成功能,允许用户根据文本提示创建图像。

  1. Installation
    1. Configuration
      1. Usage
        1. generate_image
      2. Development
        1. Error Handling
          1. Security
            ID: v93w5s68xa