Together AI (Flux.1 Schnell) MCP server

Integrates with Together AI's Flux.1 Schnell model to provide high-quality image generation with customizable dimensions, clear error handling, and optional image saving.
Back to servers
Setup instructions
Provider
Manas Bavaskar
Release date
Feb 27, 2025
Language
TypeScript
Package
Stats
1.3K downloads
8 stars

This MCP server provides an interface for generating high-quality images using the Flux.1 Schnell model via Together AI, implementing the Model Context Protocol (MCP) standard for a consistent integration experience.

Installation

You can install the server using npm:

npm install together-mcp

Or run it directly without installation:

npx together-mcp@latest

Configuration

To add this to your MCP server configuration:

{
  "mcpServers": {
    "together-image-gen": {
      "command": "npx",
      "args": ["together-mcp@latest -y"],
      "env": {
        "TOGETHER_API_KEY": "<API KEY>"
      }
    }
  }
}

Prerequisites

Before using the server, you'll need:

  • Node.js version 16 or higher
  • Together AI API key
    1. Sign in at api.together.xyz
    2. Navigate to API Keys settings
    3. Click "Create" to generate a new API key
    4. Copy the generated key for your MCP configuration

Usage

The server provides one tool: generate_image

Parameters

The image generation tool accepts the following parameters:

{
  // Required
  prompt: string;          // Text description of the image to generate

  // Optional with defaults
  model?: string;          // Default: "black-forest-labs/FLUX.1-schnell-Free"
  width?: number;          // Default: 1024 (min: 128, max: 2048)
  height?: number;         // Default: 768 (min: 128, max: 2048)
  steps?: number;          // Default: 1 (min: 1, max: 100)
  n?: number;              // Default: 1 (max: 4)
  response_format?: string; // Default: "b64_json" (options: ["b64_json", "url"])
  image_path?: string;     // Optional: Path to save the generated image as PNG
}

Basic Request Example

Here's a minimal request with just the required prompt:

{
  "name": "generate_image",
  "arguments": {
    "prompt": "A serene mountain landscape at sunset"
  }
}

Advanced Request Example

You can override any defaults and specify a path to save the image:

{
  "name": "generate_image",
  "arguments": {
    "prompt": "A serene mountain landscape at sunset",
    "width": 1024,
    "height": 768,
    "steps": 20,
    "n": 1,
    "response_format": "b64_json",
    "model": "black-forest-labs/FLUX.1-schnell-Free",
    "image_path": "/path/to/save/image.png"
  }
}

Response Format

The response will be a JSON object containing:

{
  "id": string,        // Generation ID
  "model": string,     // Model used
  "object": "list",
  "data": [
    {
      "timings": {
        "inference": number  // Time taken for inference
      },
      "index": number,      // Image index
      "b64_json": string    // Base64 encoded image data (if response_format is "b64_json")
      // OR
      "url": string        // URL to generated image (if response_format is "url")
    }
  ]
}

If you provided an image_path and the save was successful, the response will include confirmation of the save location.

Usage Notes

  • Only the prompt parameter is required; all others use defaults if not provided
  • Parameters must meet their constraints (e.g., width/height ranges)
  • Base64 responses can be large - use URL format for larger images
  • When saving images, ensure the specified directory exists and is writable
  • Default model is "black-forest-labs/FLUX.1-schnell-Free"
  • Default dimensions are 1024×768
  • Default step count is 1
  • Default number of images is 1
  • Default response format is "b64_json"

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "together-image-gen" '{"command":"npx","args":["together-mcp@latest -y"],"env":{"TOGETHER_API_KEY":"<API KEY>"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "together-image-gen": {
            "command": "npx",
            "args": [
                "together-mcp@latest -y"
            ],
            "env": {
                "TOGETHER_API_KEY": "<API KEY>"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "together-image-gen": {
            "command": "npx",
            "args": [
                "together-mcp@latest -y"
            ],
            "env": {
                "TOGETHER_API_KEY": "<API KEY>"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later