此MCP服务器使用Replicate Flux模型提供图像生成功能。
要通过Smithery自动安装Image Generation MCP Server到Claude Desktop:
npx -y @smithery/cli install @GongRzhe/Image-Generation-MCP-Server --client claude
您可以直接从npm使用该包,而无需本地安装:
# 不需要安装 - npx会处理它
如果您希望进行本地安装:
# 全局安装
npm install -g @gongrzhe/image-gen-server
# 或者本地安装
npm install @gongrzhe/image-gen-server
编辑您的Claude Desktop配置文件:
~/Library/Application Support/Claude/claude_desktop_config.json此方法直接从npm运行服务器,无需本地文件:
{
"mcpServers": {
"image-gen": {
"command": "npx",
"args": ["@gongrzhe/image-gen-server"],
"env": {
"REPLICATE_API_TOKEN": "your-replicate-api-token",
"MODEL": "alternative-model-name"
},
"disabled": false,
"autoApprove": []
}
}
}
如果您已进行了本地安装:
{
"mcpServers": {
"image-gen": {
"command": "node",
"args": ["/path/to/image-gen-server/build/index.js"],
"env": {
"REPLICATE_API_TOKEN": "your-replicate-api-token",
"MODEL": "alternative-model-name"
},
"disabled": false,
"autoApprove": []
}
}
}
your-replicate-api-tokenREPLICATE_API_TOKEN(必需):用于身份验证的Replicate API令牌MODEL(可选):用于图像生成的Replicate模型。默认为"black-forest-labs/flux-schnell"disabled:控制服务器是否启用(false)或禁用(true)autoApprove:可以无用户确认执行的工具名称数组。空数组意味着所有工具调用都需要确认。基于文本提示使用Flux模型生成图像。
prompt(必需):要生成的图像的文字描述seed(可选):用于可重复生成的随机种子aspect_ratio(可选):图像宽高比(默认:"1:1")output_format(可选):输出格式 - "webp"、"jpg"或"png"(默认:"webp")num_outputs(可选):要生成的图像数量(1-4,默认:1)const result = await use_mcp_tool({
server_name: "image-gen",
tool_name: "generate_image",
arguments: {
prompt: "一座美丽的落日山脉",
aspect_ratio: "16:9",
output_format: "png",
num_outputs: 1
}
});
该工具返回一个包含生成图像URL的数组。
本项目采用MIT许可证。