Skip to main content

Images MCP Server

TokenFlux provides a Model Context Protocol (MCP) server for image generation, enabling AI assistants like Claude to generate images through a standardized tool interface.

Server Information

Authentication

The MCP endpoint requires authentication via one of:
  • Authorization: Bearer <api_key> header
  • X-Api-Key: <api_key> header
Requests are rejected with 403 Forbidden when the caller has less than 0.01 credits remaining.

Configuration

Claude Desktop

Add the following to your Claude Desktop configuration (claude_desktop_config.json):

Other MCP Clients

For other MCP-compatible clients, use:
  • URL: https://tokenflux.ai/v1/images/mcp
  • Transport: streamable-http (stateless)
  • Auth Header: Authorization: Bearer YOUR_API_KEY

Available Tools

The MCP server exposes 4 tools for image generation:

list_models

List all available VLM models with their IDs, names, descriptions, and pricing. Parameters: None Response:

get_model

Get detailed information about a specific model including its input schema. Parameters: Response:

generate_image

Generate an image using a VLM model.
Always call get_model first to get the correct input_schema for your model.
Parameters: Behavior:
  • Waits up to 30 seconds for the image to complete
  • If completed: returns status: "succeeded" with images array
  • If still processing: returns status: "processing" with id for polling
Response (completed):
Response (still processing):

get_generation

Get the status and result of an image generation request. Parameters: Response:

Status Values

For best results, AI assistants should follow this workflow:
  1. Discover models: Call list_models to see available options
  2. Get input schema: Call get_model to understand required parameters
  3. Generate image: Call generate_image with proper input
  4. Poll if needed: If status is processing, call get_generation until complete

Error Handling

MCP tool errors are returned with IsError: true and a text message:

Example Conversation

User: Generate an image of a sunset over mountains Assistant (using MCP tools):
  1. Calls list_models → finds black-forest-labs/flux-schnell
  2. Calls get_model with model_id: "black-forest-labs/flux-schnell" → gets input schema
  3. Calls generate_image with:
  4. Returns image URL to user