togetherai image mcp server
Enables the generation of images using Together AI's models through an MCP server, supporting customizable parameters such as model selection, image dimensions, and output directory.
Enables the generation of images using Together AI's models through an MCP server, supporting customizable parameters such as model selection, image dimensions, and output directory.
An MCP server for generating images using Together AI's image generation models.
Install dependencies:
npm install
Build the server:
npm run build
The server requires a Together AI API key. You can get one from Together AI's platform.
Add the server to your Cline MCP settings file:
For macOS/Linux: ~/Library/Application Support/Windsurf/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
{
"mcpServers": {
"togetherai-image": {
"command": "node",
"args": ["/path/to/togetherai-image-server/build/index.js"],
"env": {
"TOGETHER_API_KEY": "your-api-key-here"
},
"disabled": false,
"autoApprove": []
}
}
}
The server provides a generate_image
tool with the following parameters:
{
prompt: string; // Required: Text description of the image to generate
model?: string; // Optional: Model to use (default: 'black-forest-labs/FLUX.1.1-pro')
width?: number; // Optional: Image width in pixels (default: 1024)
height?: number; // Optional: Image height in pixels (default: 768)
steps?: number; // Optional: Number of inference steps (default: 28)
n?: number; // Optional: Number of images to generate (default: 1)
outputDir?: string; // Optional: Directory where images will be saved (default: './output')
}
You can use the server in Cline like this:
Generate an image of a cat and save it to my desktop:
<use_mcp_tool>
<server_name>togeherai-image</server_name>
<tool_name>generate_image</tool_name>
<arguments>
{
"prompt": "A cute cat sitting on a windowsill",
"outputDir": "/Users/username/Desktop/generated-images"
}
</arguments>
</use_mcp_tool>
The tool returns a JSON response containing:
- filepath
: Full path to the saved image
- filename
: Name of the saved image file
- dimensions
: Original and final dimensions of the image
[
{
"description": "Generate an image using Together AI",
"inputSchema": {
"properties": {
"format": {
"default": "png",
"description": "Output format for the generated images",
"enum": [
"png",
"jpg",
"svg"
],
"type": "string"
},
"height": {
"default": 768,
"description": "Image height in pixels",
"type": "number"
},
"model": {
"default": "black-forest-labs/FLUX.1.1-pro",
"description": "Model to use for generation",
"type": "string"
},
"n": {
"default": 1,
"description": "Number of images to generate",
"type": "number"
},
"outputDir": {
"description": "Full absolute path where images will be saved (e.g., /Users/username/Projects/myapp/src/assets)",
"examples": [
"/Users/asanstefanski/Private Projekte/democline/src/assets"
],
"pattern": "^/",
"type": "string"
},
"prompt": {
"description": "Text description of the image to generate",
"type": "string"
},
"steps": {
"default": 28,
"description": "Number of inference steps",
"type": "number"
},
"width": {
"default": 1024,
"description": "Image width in pixels",
"type": "number"
}
},
"required": [
"prompt"
],
"type": "object"
},
"name": "generate_image",
"uiSchema": {
"format": {
"ui:options": {
"label": "Image Format",
"position": "above-chat"
},
"ui:widget": "select"
}
}
}
]