article
README
🚀 流体图像生成 MCP 服务器
流体图像生成 MCP 服务器是一款专注于图像生成与处理的服务器,由 Pollinations AI 提供支持。它通过模型上下文协议(MCP),为用户提供强大且高效的图像生成功能。
🚀 快速开始
流体图像生成 MCP 服务器是一款经过优化的服务器实现,通过模型上下文协议(MCP)提供强大的图像生成功能。该服务器专注于以下三种核心功能:
- 图像 URL 生成
- 直接图像生成
- 模型列表与管理
✨ 主要特性
- 🖼️ 图像生成:根据文本提示创建精美的图像
- 🎨 多种模型支持:兼容各种图像生成模型
- 🔧 灵活配置:易于安装和自定义
- 🚀 高性能:优化以实现快速响应时间
- 🔄 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
🛠️ 开发指引
要贡献或修改服务器:
- 叉克仓库
- 创建功能分支
- 进行修改
- 提交更改
🐞 错误处理与日志记录
- 使用
try-catch处理错误 - 记录关键操作的日志
👥 贡献者
- [Your Name]
- [Contributor Name]
📄 许可证
[在此处添加许可证信息]
流体图像生成 MCP 服务器
© 2025,保留所有权利
扫码联系在线客服