Skip to main content

A Model Context Protocol (MCP) server for generating images using Fal.ai's HiDream-I1-Full model

Project description

FAL AI Image Generator MCP

A Model Context Protocol (MCP) server for generating images using the FAL.ai platform and HiDream-ai/HiDream-I1-Full model.

Quick Start

  1. Get a FAL.ai API Key
  • Sign up at FAL.ai and obtain your API key
  1. Install the package
# Using pip
pip install fal-ai-mcp

# Using uv
uv pip install fal-ai-mcp
  1. Run and Test the server
# Using Python module
export FAL_KEY="your-fal-api-key" && npx @modelcontextprotocol/inspector -- python -m fal_ai_mcp

# Using uvx (alternative method)
export FAL_KEY="your-fal-api-key" && npx @modelcontextprotocol/inspector uvx fal-ai-mcp

Configure in Claude Desktop, Cursor or Windsurf

Add this configuration to your MCP config file:

Method 1: Using uvx

{
  "mcpServers": {
    "fal-ai-image-generator": {
      "command": "uvx",
      "args": [
        "fal-ai-mcp"
      ],
      "env": {
        "FAL_KEY": "your-fal-api-key"
      }
    }
  }
}

Method 2: Using Python module

{
  "mcpServers": {
    "fal-ai-image-generator": {
      "command": "python",
      "args": ["-m", "fal_ai_mcp"],
      "env": {
        "FAL_KEY": "your-fal-api-key"
      }
    }
  }
}

Features

This MCP server provides a tool for generating high-quality images from text prompts using FAL.ai platform:

  • Text-to-image generation using the text_to_image_fal tool
  • Returns complete metadata including image URL or base64 image data, dimensions, and other information
  • Easy integration with MCP-compatible applications

API Reference

text_to_image_fal

Generates an image from a text prompt using the FAL.ai API and HiDream-I1-Full model.

Parameters:

  • prompt (string): The text description of the image you want to generate

Returns:

  • A dictionary containing the generated image data, including:
    • images: Array of generated images with URLs, dimensions, and content type
    • timings: Performance metrics
    • seed: The random seed used for generation
    • has_nsfw_concepts: Safety check results
    • prompt: The original prompt

Installation Options

Global Installation

To install the package globally or in your current environment:

# Using pip (recommended)
pip install fal-ai-mcp

# Using uv
uv pip install fal-ai-mcp

If you encounter any issues with the installation, try using the --force-reinstall flag:

pip install fal-ai-mcp --force-reinstall

Installing from Source

# Using pip
pip install git+https://github.com/OKitchen/fal-ai-mcp.git

# Using uv
uv pip install git+https://github.com/OKitchen/fal-ai-mcp.git

Adding as a Project Dependency

To add the package as a dependency to your Python project (requires a pyproject.toml file):

# Navigate to your project directory that has a pyproject.toml
cd your-project-directory

# Add as a dependency using uv
uv add fal-ai-mcp

Note: The uv add command will only work in a Python project that has a pyproject.toml file and is not named fal-ai-mcp (to avoid circular dependencies).

Locally Runing the Server

uv run mcp dev src/fal_ai_mcp/fal_ai_mcp.py

Troubleshooting

Python Version Requirements

This package requires Python 3.10 or higher. If you encounter an error like:

ERROR: Could not find a version that satisfies the requirement fal-ai-mcp
ERROR: No matching distribution found for fal-ai-mcp

Make sure you're using Python 3.10 or higher:

python --version

Module Not Found

If you encounter an error like:

No module named fal_ai_mcp

Make sure the package is properly installed:

pip list | grep fal-ai-mcp

If it's not listed, try reinstalling:

pip install --force-reinstall fal-ai-mcp

FAL API Key Not Set

If you see an error about missing FAL API keys:

ValueError: Neither FAL_API_KEY nor FAL_KEY environment variables are set

Make sure to set your FAL.ai API key before running the server:

export FAL_KEY="your-fal-api-key"

Development

To set up the development environment:

# Clone the repository
git clone https://github.com/OKitchen/fal-ai-mcp.git
cd fal-ai-mcp

# Set up a virtual environment
uv init
uv pip install -e .

# Run the server locally with your FAL.ai API key
export FAL_KEY="your-fal-api-key" && uv run -m fal_ai_mcp

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fal_ai_mcp-0.1.3.tar.gz (507.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fal_ai_mcp-0.1.3-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file fal_ai_mcp-0.1.3.tar.gz.

File metadata

  • Download URL: fal_ai_mcp-0.1.3.tar.gz
  • Upload date:
  • Size: 507.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for fal_ai_mcp-0.1.3.tar.gz
Algorithm Hash digest
SHA256 720281b1c5015a3ae3a098439c4aa754a9a2cce343f7d13783a2ec4ec49496ef
MD5 4a9a2cf6d1daaceeb46dedb1ad40444f
BLAKE2b-256 ff63ab4d33a37e996c5313473b0515c56efddf07a8c24af7a87562327c25e926

See more details on using hashes here.

File details

Details for the file fal_ai_mcp-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: fal_ai_mcp-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for fal_ai_mcp-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 099dac9849b75e57b8f75261989ead0a101f0be82c95c292b333d2e89e886222
MD5 c56c54e276b2e88d02e88d91b622a37e
BLAKE2b-256 c78e8c045f4dc4fa51adddaeccbdffc804cc9f405091bc9b39146053366da78e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page