Flux图像生成
STDIO使用Flux模型生成图像的MCP服务器
使用Flux模型生成图像的MCP服务器
This MCP server provides image generation capabilities using the Flux Schnell model on Replicate.
npm install -g @modelcontextprotocol/sdk@latest
cd ~/Documents/Cline/MCP git clone https://github.com/yourusername/flux-img-mcp.git cd flux-img-mcp npm install
npm run build
{ "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": [] } } }
The server requires the following environment variable:
REPLICATE_API_TOKEN
: Your Replicate API token. You can get this from your Replicate account settings.Once installed and configured, the server provides the following tool:
Generates an image using the Flux Schnell model based on a text prompt.
Parameters:
prompt
(string, required): Text description of the desired imageExample usage:
<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>
The tool will return a JSON response containing:
status
: The status of the generation requestoutput
: The URL of the generated image (if successful)error
: Any error message (if failed)To make changes to the server:
src/index.ts
npm run build
The server includes comprehensive error handling for: