MCP Fooocus API
Provides text-to-image generation capabilities through the Fooocus Stable Diffusion API with intelligent style selection from 300+ options, multiple performance modes, and configurable aspect ratios.
README
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:
uv add git+https://github.com/raihan0824/mcp-fooocus-api.git
Or install from PyPI (when published):
uv add mcp-fooocus-api
Run with uvx:
uvx --from git+https://github.com/raihan0824/mcp-fooocus-api.git mcp-fooocus-api
Using pip
pip install git+https://github.com/raihan0824/mcp-fooocus-api.git
Or from PyPI (when published):
pip install mcp-fooocus-api
Development 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 .env
- Edit the
.envfile to configure your Fooocus API endpoint:
FOOOCUS_API_URL=http://103.125.100.56:8888/v1/generation/text-to-image
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:
{
"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 localhost
API 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
.envfile - Run 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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。