mcp-image-generator

by GMKR
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Generates images using Together AI's image generation models, specifically the FLUX.1-schnell-Free model by default. Provides tools for creating images from text prompts with customizable dimensions.

MCP 图像生成器

一个模型上下文协议 (MCP) 服务器,用于使用 Together AI 的图像生成模型生成图像。此 MCP 服务器可以在本地运行,也可以使用 SSE 端点运行。MCP 图像生成器需要一个提供程序,目前仅支持“Replicate”和“Together”。您需要设置TOGETHER_API_KEYREPLICATE_API_TOKEN环境变量,并将PROVIDER环境变量设置为“replicate”或“together”。

SSE 端点(Docker 环境)

克隆存储库

git clone https://github.com/gmkr/mcp-imagegen.git cd mcp-imagegen

构建并运行 Docker 容器

docker build -f Dockerfile.server -t mcp-imagegen . docker run -p 3000:3000 mcp-imagegen

使用 MCP 客户端进行配置

{ "mcpServers": { "imagegenerator": { "url": "http://localhost:3000/sse", "env": { "PROVIDER": "replicate", "REPLICATE_API_TOKEN": "your-replicate-api-token" } } } }

url调整为您要使用的 MCP 服务器的端点。 provider可以是“replicate”或“together”。

使用 stdio 在本地运行

先决条件

  • Node.js
  • Together AI API 密钥或复制 API 令牌

安装

  1. 克隆存储库:
    git clone https://github.com/gmkr/mcp-imagegen.git cd mcp-imagegen
  2. 安装依赖项:
    pnpm install

配置

为您的 MCP 客户端创建一个配置文件。以下是示例配置:

{ "mcpServers": { "imagegenerator": { "command": "pnpx", "args": [ "-y", "tsx", "/path/to/mcp-imagegen/src/index.ts" ], "env": { "PROVIDER": "replicate", "REPLICATE_API_TOKEN": "your-replicate-api-token" } } } }

/path/to/mcp-imagegen替换为克隆存储库的绝对路径,并将your-replicate-api-token替换为实际的复制 API 令牌。

用法

MCP 图像生成器提供了一个名为generate_image的工具,可用于根据文本提示生成图像。

工具:generate_image

根据提供的提示生成图像。

参数:

  • prompt (字符串):生成图像的文本提示
  • width (数字,可选):要生成的图像的宽度(默认值:512)
  • height (数字,可选):要生成的图像的高度(默认值:512)
  • numberOfImages (数字,可选):要生成的图像数量(默认值:1)

环境变量

  • PROVIDER :用于图像生成的提供程序(默认值:“replicate”)
  • REPLICATE_API_TOKEN :您的复制 API 令牌
  • TOGETHER_API_KEY :您的 Together AI API 密钥
  • MODEL_NAME :用于图像生成的模型(默认值:“black-forest-labs/flux-schnell”)

执照

麻省理工学院

ID: rcf9w8nft8