MCP HubMCP Hub
stefanskiasan

togetherai-image-mcp-server

by: stefanskiasan

togetherai image mcp server

5created 24/01/2025
Visit
image
ai

📌Overview

Purpose: To provide an MCP server for generating images using Together AI's advanced image generation models.

Overview: The Together AI Image Server allows users to leverage Together AI's image generation technology easily. It facilitates the creation of custom images based on text descriptions, ensuring high-quality output and configurability.

Key Features:

  • Model Support: Utilizes Together AI's FLUX.1.1-pro model for image generation, ensuring access to the latest advancements in AI image synthesis.

  • Flexible Configuration: Users can set various parameters such as image dimensions, number of generated images, and output directories, accommodating diverse needs and preferences.

  • Automatic Resizing: Automatically resizes images below specified dimensions while maintaining their aspect ratio, ensuring the quality of output.

  • High-Quality Output: Generates images in high-quality JPEG format with a quality setting of 90%, ensuring visually appealing results.

  • Metadata Retrieval: Provides detailed metadata in the response, including file paths and image dimensions, enhancing usability and tracking.


Together AI Image Server

An MCP server for generating images using Together AI's image generation models.

Setup

  1. Install dependencies:

    npm install
    
  2. Build the server:

    npm run build
    

Configuration

Together AI API Key

The server requires a Together AI API key, which can be obtained from Together AI's platform.

Cline Configuration

Add the server to your Cline MCP settings file at the following path:

For macOS/Linux:

~/Library/Application Support/Windsurf/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

Example configuration:

{
  "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": []
    }
  }
}

Usage in Cline

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')
}

Example Usage

To generate an image of a cat and save it to your desktop:

<use_mcp_tool>
  <server_name>togetherai-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>

Output

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

Features

  • Supports Together AI's latest FLUX.1.1-pro model
  • Automatically resizes images if dimensions are below 256 pixels
  • Maintains aspect ratio during resizing
  • High-quality JPEG output
  • Creates output directories recursively
  • Returns detailed metadata including image dimensions