MCP 图像生成服务器采用 Go 语言实现,借助 OpenAI 的 DALL-E API 实现图像生成功能。它展示了如何构建 MCP 工具,这些工具可被大型语言模型(如 Claude)调用,为图像生成提供了便捷的解决方案。
go build -o ./bin/imagegen-go ./main
将此服务器添加到你的 Claude Desktop 配置中,路径为 ~/Library/Application Support/Claude/claude_desktop_config.json
:
{
"mcpServers": {
"imagegen-go": {
"command": "/path/to/imagegen-go/bin/imagegen-go",
"env": {
"OPENAI_API_KEY": "your-api-key",
"DEFAULT_DOWNLOAD_PATH":"/path/to/downloads"
}
}
}
}
示例提示: "你能生成一张描述‘河流旁的家园, cinematic 风格’的图片吗?"
此服务器实现了 MCP 工具能力,并提供了一个单一工具:
generate-image
:从文本提示生成图像,使用 OpenAI 的 DALL-EMIT License