Back to MCP directory
publicPublicdnsLocal runtime

flux-imagegen-mcp-server

Flux ImageGen MCP Server是一个基于Model Context Protocol (MCP)的专用服务器,专注于通过Pollinations AI提供图像生成和处理功能。它支持从文本提示生成图像URL、直接生成图像以及管理多种图像生成模型。

article

README

🚀 流体图像生成 MCP 服务器

流体图像生成 MCP 服务器是一款专注于图像生成与处理的服务器,由 Pollinations AI 提供支持。它通过模型上下文协议(MCP),为用户提供强大且高效的图像生成功能。

🚀 快速开始

流体图像生成 MCP 服务器是一款经过优化的服务器实现,通过模型上下文协议(MCP)提供强大的图像生成功能。该服务器专注于以下三种核心功能:

  1. 图像 URL 生成
  2. 直接图像生成
  3. 模型列表与管理

✨ 主要特性

  • 🖼️ 图像生成:根据文本提示创建精美的图像
  • 🎨 多种模型支持:兼容各种图像生成模型
  • 🔧 灵活配置:易于安装和自定义
  • 🚀 高性能:优化以实现快速响应时间
  • 🔄 MCP 兼容:完全符合模型上下文协议

📦 安装指南

# 克隆仓库
git clone https://github.com/yourusername/flux-imagegen-mcp-server.git

# 安装依赖项
npm install

🛠️ 配置说明

使用 Claude Desktop 的配置

要在 Claude Desktop 中使用此服务器,请更新你的配置文件位于: C:\Users\[YourUsername]\AppData\Roaming\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "mcpollinations": {
      "command": "cmd",
      "args": [
        "/c",
        "node",
        "PATH_TO_YOUR_SERVER\\server.js"
      ],
      "tools": [
        "generateImageUrl",
        "generateImage",
        "listImageModels"
      ]
    }
  }
}

PATH_TO_YOUR_SERVER 替换为你的实际服务器路径。

💻 使用示例

基础用法

1. 生成图像 URL (generateImageUrl)

根据文本提示生成一个图像的 URL。

{
  "prompt": "壮丽的日落景色",
  "model": "flux",  // 可选,默认为 'flux'
  "width": 1024,    // 可选
  "height": 1024,   // 可选
  "enhance": true,  // 可选
  "safe": false     // 可选
}

2. 直接生成图像 (generateImage)

根据文本提示直接生成并保存图像。

{
  "prompt": "宁静的湖泊映衬着群山",
  "model": "flux",
  "width": 1024,
  "height": 1024,
  "enhance": true,
  "safe": false,
  "outputPath": "./output",
  "fileName": "mountain_lake",
  "format": "png"
}

3. 列出图像模型 (listImageModels)

返回可用的图像生成模型列表。

// 示例响应:
{
  "models": [
    {
      "id": "flux",
      "name": "Flux",
      "description": "默认图像生成模型"
    },
    // 其他模型...
  ]
}

高级用法

// 示例服务器启动代码:
const express = require('express');
const app = express();

app.get('/generate-image', (req, res) => {
  try {
    // 处理请求并生成图像
    res.send(imageData);
  } catch (error) {
    console.error('生成图像时出错:', error);
    res.status(500).send('生成图像失败');
  }
});

app.listen(3000, () => {
  console.log('服务器已启动,监听端口 3000');
});

⚙️ 环境要求

  • Node.js >= 16.0.0
  • NPM >= 7.0.0
  • 支持 Windows/Linux/MacOS

🛠️ 开发指引

要贡献或修改服务器:

  1. 叉克仓库
  2. 创建功能分支
  3. 进行修改
  4. 提交更改

🐞 错误处理与日志记录

  • 使用 try-catch 处理错误
  • 记录关键操作的日志

👥 贡献者

  • [Your Name]
  • [Contributor Name]

📄 许可证

[在此处添加许可证信息]


流体图像生成 MCP 服务器
© 2025,保留所有权利

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