MCP Fooocus API
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Fooocus API create a fantasy landscape with dragons and castles at sunset"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
Related MCP server: Volcengine Image Generation MCP Server
Installation
Using uv (Recommended)
Install directly from GitHub:
uv add git+https://github.com/raihan0824/mcp-fooocus-api.gitOr install from PyPI (when published):
uv add mcp-fooocus-apiRun with uvx:
uvx --from git+https://github.com/raihan0824/mcp-fooocus-api.git mcp-fooocus-apiUsing pip
pip install git+https://github.com/raihan0824/mcp-fooocus-api.gitOr from PyPI (when published):
pip install mcp-fooocus-apiDevelopment Installation
# Clone the repository
git clone https://github.com/raihan0824/mcp-fooocus-api.git
cd mcp-fooocus-api
# Install with uv
uv sync --dev
# Or install with pip
pip install -e ".[dev]"Configuration
Copy the example environment file:
cp .env.example .envEdit the
.envfile to configure your Fooocus API endpoint:
FOOOCUS_API_URL=http://103.125.100.56:8888/v1/generation/text-to-imageUsage
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:
{
"prompt": "A serene landscape with mountains and a lake at sunset",
"performance": "Quality",
"aspect_ratio": "1024*1024"
}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:
{
"mcpServers": {
"fooocus": {
"command": "uvx",
"args": ["--from", "git+https://github.com/raihan0824/mcp-fooocus-api.git", "mcp-fooocus-api"]
}
}
}Or if installed from PyPI:
{
"mcpServers": {
"fooocus": {
"command": "uvx",
"args": ["mcp-fooocus-api"]
}
}
}Standalone Server
You can also run the server directly:
# With uv
uvx --from git+https://github.com/raihan0824/mcp-fooocus-api.git mcp-fooocus-api --port 3000 --host localhost
# Or if installed locally
python -m mcp_fooocus_api.server --port 3000 --host localhostAPI Response Format
Successful generation returns:
{
"success": true,
"prompt": "Your prompt here",
"selected_styles": ["Style1", "Style2"],
"performance": "Speed",
"aspect_ratio": "1024*1024",
"result": {
// Fooocus API response data
}
}Error responses include:
{
"success": false,
"error": "Error description",
"prompt": "Your prompt here",
"selected_styles": ["Style1", "Style2"]
}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.
Available Tools
3 toolsgenerate_imageC
Generate an image using Fooocus Stable Diffusion API.
Args:
prompt: Text description of the image to generate
performance: Performance setting (Speed, Quality, Extreme Speed)
custom_styles: Comma-separated list of custom styles (optional, will auto-select if not provided)
aspect_ratio: Image aspect ratio (default: 1024*1024)
Returns:
Dictionary containing generation result with image URLs
Inputs: prompt (required), performance, custom_styles, aspect_ratio. Returns: object
get_server_infoB
Get information about the Fooocus MCP server configuration.
Returns:
Dictionary containing server configuration information
Inputs: no named parameters. Returns: object
list_available_stylesA
List all available styles for image generation.
Returns:
Dictionary containing all available styles organized by category
Inputs: no named parameters. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose with no overlap: generate_image creates images, get_server_info provides configuration details, and list_available_styles enumerates style options. The three functions are orthogonal and cannot be confused for one another.
All tools follow a consistent verb_noun pattern (generate_image, get_server_info, list_available_styles) with clear, descriptive names that use snake_case uniformly. There are no deviations in naming conventions.
With only 3 tools, the set feels thin for an image generation API. While the core generate_image tool is present, additional operations like image editing, batch generation, or model management might be expected but are missing, making the scope somewhat limited.
The toolset covers the essential workflow: checking server info, listing styles, and generating images. However, there are minor gaps such as no ability to modify or delete generated images, adjust advanced generation parameters beyond the basics, or manage generation history, which could limit agent flexibility.
Maintenance
Related MCP Connectors
Create images and videos from prompts, with options for image mixing, reference images, and start/…
Generate images and videos with 200+ AI models (GPT-Image-2, Seedance, Veo, Kling) via one API.
LLM chat, text tools, image generation, editing, batch image jobs, and asynchronous video generation
Uncensored image, image-to-video and chat generation for adult apps. OpenAI-compatible, pay per use.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables text-to-image generation, image editing, and multi-image composition using Google's Gemini 2.5 Flash Image API. Supports flexible aspect ratios and character consistency across generations.1MIT
- AlicenseBqualityDmaintenanceEnables AI-powered text-to-image generation using Volcengine's API with support for multiple image sizes, customizable parameters like guidance scale and seed, and flexible output formats.1MIT
- FlicenseBqualityDmaintenanceEnables text-to-image generation using the fal.ai GPT image-1 API. It provides a tool to generate images with customizable parameters like size, quality, and background settings via natural language prompts.1-
- AlicenseAqualityCmaintenanceEnables AI agents to interact with a Stable Diffusion REST API for image generation, inpainting, model management, and merging.18GPL 3.0