MCP Fooocus API
A Model Context Protocol (MCP) server that provides text-to-image generation capabilities through the Fooocus Stable Diffusion API.
Features
Text-to-Image Generation: Generate high-quality images from text prompts
Intelligent Style Selection: Automatically selects 1-3 appropriate styles based on your prompt
Custom Style Override: Manually specify styles from 300+ available options
Multiple Performance Modes: Choose between Speed, Quality, and Extreme Speed
Configurable Aspect Ratios: Support for various image dimensions
Environment-based Configuration: Easy API endpoint configuration via
.envfile
Installation
Using uv (Recommended)
Install directly from GitHub:
Or install from PyPI (when published):
Run with uvx:
Using pip
Or from PyPI (when published):
Development Installation
Configuration
Copy the example environment file:
Edit the
.envfile to configure your Fooocus API endpoint:
Usage
Available Tools
The MCP server provides three main tools:
1. generate_image
Generate an image using the Fooocus API.
Parameters:
prompt(required): Text description of the image to generateperformance(optional): Performance setting - "Speed" (default), "Quality", or "Extreme Speed"custom_styles(optional): Comma-separated list of custom stylesaspect_ratio(optional): Image dimensions (default: "1024*1024")
Example:
2. list_available_styles
Lists all available styles organized by category.
Returns:
Total number of available styles
Styles organized by categories (Fooocus, SAI, MRE, Art Styles, etc.)
Available performance options
3. get_server_info
Get information about the server configuration and capabilities.
Returns:
Server version and name
Configured API endpoint
Available features
Performance options
Style Categories
The server includes 300+ styles organized into categories:
Fooocus Styles: Native Fooocus styles (V2, Enhance, Sharp, etc.)
SAI Styles: Stability AI styles (Photographic, Digital Art, Anime, etc.)
Art Styles: Classical art movements (Renaissance, Impressionist, Cubist, etc.)
Photography: Various photography styles (Film Noir, HDR, Macro, etc.)
Game Styles: Video game-inspired styles (Minecraft, Pokemon, Retro, etc.)
Futuristic: Sci-fi and cyberpunk styles
And many more...
Intelligent Style Selection
When you don't specify custom styles, the server automatically selects appropriate styles based on your prompt:
"renaissance portrait" → Selects "Artstyle Renaissance"
"cyberpunk city" → Selects "Futuristic Cyberpunk Cityscape"
"anime character" → Selects "SAI Anime"
"realistic photo" → Selects "SAI Photographic"
"watercolor painting" → Selects "Artstyle Watercolor"
Running the Server
As an MCP Server
Add to your MCP client configuration:
Or if installed from PyPI:
Standalone Server
You can also run the server directly:
API Response Format
Successful generation returns:
Error responses include:
Requirements
Python 3.8+
Access to a Fooocus API endpoint
Internet connection for API requests
Dependencies
mcp>= 1.0.0httpx>= 0.27python-dotenv>= 1.0.0pydantic>= 2.7.2, < 3.0.0
Development
To set up for development:
Clone the repository
Install dependencies:
pip install -e .Configure your
.envfileRun the server:
python -m mcp_fooocus_api.server
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For issues and questions, please visit the GitHub repository.