FLUX Image Generator MCP Server
FLUX 图像生成器 MCP 服务器
一个 MCP(模型上下文协议)服务器,用于使用 Black Forest Lab 的 FLUX 模型生成图像。使用最新的 MCP SDK (v1.7.0)。
特征
根据文本提示生成图像
自定义图像尺寸、快速上采样和安全设置
将生成的图像保存在本地
从多个提示批量生成图像
Related MCP server: Flux Schnell Server
先决条件
Node.js(v18.0.0 或更高版本)
Black Forest Lab API 密钥(在https://api.bfl.ml获取)
安装
来自源
克隆此存储库
安装依赖项:
npm install根据
.env.example创建一个.env文件并添加您的 Black Forest Lab API 密钥:
BFL_API_KEY=your_api_key_here构建项目:
npm run build使用 npm
npm install -g @modelcontextprotocol/server-flux-image-generator用法
启动 MCP 服务器
使用以下命令启动服务器:
npm start对于使用自动重新编译的开发:
npm run watch与 MCP 客户端集成
要将此服务器与 MCP 客户端(如 Claude)一起使用,请将以下内容添加到客户端的配置中:
{
"mcpServers": {
"flux-image-generator": {
"command": "mcp-server-flux-image-generator",
"env": {
"BFL_API_KEY": "your_api_key_here"
}
}
}
}可用工具
生成图像
根据具有可自定义设置的文本提示生成图像。
参数:
prompt(字符串,必需):要生成的图像的文本描述width(数字,可选,默认值:1024):图像的宽度(以像素为单位)height(数字,可选,默认值:1024):图像的高度(以像素为单位)promptUpsampling(布尔值,可选,默认值:false):通过对提示进行上采样来增强细节seed(数字,可选):用于可重复结果的随机种子safetyTolerance(数字,可选,默认值:3):内容审核容忍度(1-5)
例子:
{
"prompt": "A serene lake at sunset with mountains in the background",
"width": 1024,
"height": 768,
"promptUpsampling": true,
"seed": 12345,
"safetyTolerance": 3
}快速图像
使用默认设置快速生成图像的简化工具。
参数:
prompt(字符串,必需):要生成的图像的文本描述
例子:
{
"prompt": "A futuristic cityscape with flying cars"
}批量生成图像
根据提示列表生成多个图像。
参数:
prompts(字符串数组,必需):文本提示列表(最多 10 个)width(数字,可选,默认值:1024):图像的宽度height(数字,可选,默认值:1024):图像的高度
例子:
{
"prompts": [
"A serene lake at sunset",
"A futuristic cityscape",
"A magical forest with glowing plants"
],
"width": 1024,
"height": 768
}输出格式
所有工具都以这种格式返回响应:
{
"image_url": "https://storage.example.com/generated_image.jpg",
"local_path": "/path/to/output/flux_1234567890.png"
}对于错误:
{
"error": true,
"message": "Error description"
}批处理工具返回:
{
"total": 3,
"successful": 2,
"failed": 1,
"results": [
{
"prompt": "A serene lake at sunset",
"success": true,
"image_url": "https://storage.example.com/image1.jpg",
"local_path": "/path/to/output/flux_batch_1234567890_0.png"
},
{
"prompt": "A futuristic cityscape",
"success": true,
"image_url": "https://storage.example.com/image2.jpg",
"local_path": "/path/to/output/flux_batch_1234567890_1.png"
},
{
"prompt": "Prohibited content",
"success": false,
"error": "Content policy violation"
}
]
}执照
麻省理工学院
Available Tools
3 toolsbatchGenerateImagesC
Generate multiple images from a list of prompts
| Name | Required | Description | Default |
|---|---|---|---|
| prompts | Yes | List of text prompts | |
| width | No | Width of the images | |
| height | No | Height of the images | |
| customPath | No | Custom path to save the generated images |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It doesn't describe what happens during generation (e.g., processing order, error handling), output format, rate limits, authentication needs, or whether it's a read/write operation. The description merely states what the tool does without revealing how it behaves.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise - a single sentence with zero wasted words. It's front-loaded with the core functionality and appropriately sized for the tool's complexity. Every word earns its place in communicating the essential purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a batch generation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't address critical context like what the tool returns (image URLs, file paths, error information), how multiple prompts are processed, or any behavioral characteristics. The agent would need to guess about important operational aspects.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema - it doesn't explain prompt formatting expectations, width/height constraints, or customPath usage scenarios. Baseline 3 is appropriate when the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('generate multiple images') and the resource ('from a list of prompts'), making the purpose immediately understandable. It distinguishes from 'generateImage' by specifying 'multiple' images, but doesn't explicitly differentiate from 'quickImage' which might imply a similar batch capability.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus the sibling tools 'generateImage' or 'quickImage'. There's no mention of use cases, prerequisites, performance considerations, or alternative selection criteria, leaving the agent with insufficient context for optimal tool selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
generateImageC
Generate an image using Black Forest Lab's FLUX model based on a text prompt
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Text description of the image to generate | |
| width | No | Width of the image in pixels | |
| height | No | Height of the image in pixels | |
| promptUpsampling | No | Enhance detail by upsampling the prompt | |
| seed | No | Random seed for reproducible results | |
| safetyTolerance | No | Content moderation tolerance (1-5) | |
| customPath | No | Custom path to save the generated image |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the model (FLUX) but fails to describe key traits like rate limits, authentication needs, output format (e.g., image file type), error handling, or performance characteristics. This leaves significant gaps for a tool that likely involves external API calls and resource-intensive operations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy for an agent to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of an image generation tool with 7 parameters, no annotations, and no output schema, the description is incomplete. It lacks information on behavioral aspects, usage guidelines, and output details (e.g., how the image is returned), which are crucial for proper tool invocation in this context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, meaning all parameters are documented in the schema. The description does not add any additional meaning or context beyond what the schema provides (e.g., it doesn't explain prompt best practices or safety tolerance implications). With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but also doesn't detract.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Generate an image') and specifies the resource (using Black Forest Lab's FLUX model based on a text prompt), which is specific and unambiguous. However, it does not explicitly differentiate from sibling tools like 'batchGenerateImages' or 'quickImage', which might offer batch processing or faster generation, so it misses full sibling differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives such as 'batchGenerateImages' or 'quickImage'. It lacks context about scenarios, prerequisites, or exclusions, leaving the agent without explicit usage instructions beyond the basic function.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
quickImageC
Quickly generate an image based on a text prompt with default settings
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Text description of the image to generate | |
| customPath | No | Custom path to save the generated image |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It mentions 'quickly' and 'default settings,' hinting at speed and simplicity, but lacks details on permissions, rate limits, output format (e.g., image type, size), or whether it's a read-only or mutating operation. This is inadequate for a tool with no annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and appropriately sized for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations, no output schema, and a mutation-like tool (image generation), the description is incomplete. It lacks details on behavioral traits, output handling, and differentiation from siblings. While concise, it doesn't provide enough context for effective agent use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents both parameters ('prompt' and 'customPath'). The description adds no additional meaning beyond implying 'default settings' might affect generation, but it doesn't clarify parameter interactions or usage. Baseline 3 is appropriate as the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'generate an image based on a text prompt with default settings.' It specifies the verb ('generate') and resource ('image'), though it doesn't explicitly differentiate from sibling tools like 'generateImage' or 'batchGenerateImages' beyond mentioning 'default settings.'
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus its siblings. It mentions 'default settings,' which might imply a simpler or faster alternative, but it doesn't specify contexts, exclusions, or named alternatives like 'batchGenerateImages' for batch processing or 'generateImage' for more control.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
- First observed
batchGenerateImages - First observed
generateImage - First observed
quickImage
TDQS
Scored across 3 tools
The tools have significant overlap in purpose, with all three focused on generating images from text prompts. 'generateImage' and 'quickImage' are particularly ambiguous—both generate a single image based on a prompt, differing only in default settings versus customizable ones. 'batchGenerateImages' is more distinct as it handles multiple prompts, but the overall set lacks clear boundaries.
The naming is mixed in style: 'batchGenerateImages' uses camelCase, while 'generateImage' and 'quickImage' are more descriptive but follow a similar verbNoun pattern. There's no consistent casing convention, and the verbs ('batchGenerate', 'generate', 'quick') vary without a clear pattern, making it readable but not predictable.
With only 3 tools, the count feels thin for an image generation server, as it lacks operations for managing or editing images. However, it covers basic generation tasks, so it's borderline—adequate for minimal functionality but could benefit from more comprehensive coverage.
The server is severely incomplete for an image generation domain. It only offers generation tools with no ability to retrieve, update, delete, or edit images. There are no tools for managing image metadata, applying filters, or handling errors, which are common in such systems, leading to significant gaps in agent workflows.
Related MCP Connectors
MCP server for Flux AI image generation
Official FLUX MCP server. Generate, edit, vary, and browse images from Black Forest Labs.
MCP server for Qwen Image 3 AI image generation
MCP server for NanoBanana AI image generation and editing
Related MCP Servers
- AlicenseBqualityCmaintenanceAn MCP server that enables AI assistants to generate images using Black Forest Labs' Flux model via Cloudflare Workers.1MIT
- FlicenseBqualityDmaintenanceAn MCP image generation server based on the Flux Schnell model that provides API access for generating images from text prompts with customizable dimensions and seeds.11-
- FlicenseBqualityNot gradedmaintenanceAn MCP server that enables generating and editing high-quality images with natural language using Black Forest Labs' FLUX.1 Kontext Pro model.25 npm-
- AlicenseBqualityDmaintenanceAn MCP server that enables image generation using Replicate's Flux 1.1 Pro model. It provides a tool for creating visuals from text prompts with customizable settings for aspect ratio, output format, and quality.1MIT