- Home
- MCP servers
- Rembg
Rembg
- python
2
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"holocode-ai-rembg-mcp": {
"command": "/path/to/rembg-mcp/start_server.sh",
"args": [],
"env": {
"REMBG_HOME": "~/.u2net",
"OMP_NUM_THREADS": "4"
}
}
}
}You run an MCP server that exposes the rembg background removal library as a scalable service. Your server lets you remove image backgrounds with AI models through MCP-enabled tools, supporting single images or batch processing with flexible options and cross-platform compatibility.
How to use
After you configure an MCP client to connect to the rembg MCP server, you can send image processing requests through supported MCP tools. Use a single-image tool for one photo or a batch tool to process multiple images in a folder. You can specify the AI model, enable alpha matting, or request a mask-only output. The server reuses model sessions to speed up batch workflows and can apply custom backgrounds when needed.
Typical workflows you can perform: remove the background from a single image and save the result, process an entire folder of images expanding to a new output directory, or process portraits with a portrait-optimized model while applying alpha matting for crisper edges.
How to install
Prerequisites you need before installing: Python 3.10 or newer and a supported MCP client. You will also run setup or install steps that configure a local MCP server endpoint.
One-click installation for Linux/macOS and Windows is available. Run the following commands in your terminal or command prompt to clone the project, install dependencies, and set up the MCP server.
git clone <repository-url>
cd rembg-mcp
./setup.sh
git clone <repository-url>
cd rembg-mcp
setup.bat
Additional installation steps if you prefer manual setup
Create a Python virtual environment, install dependencies, and validate the setup locally before starting the server.
auto
python3 -m venv rembg
source rembg/bin/activate # Linux/macOS
# or
rembg\Scripts\activate.bat # Windows
pip install --upgrade pip
pip install mcp "rembg[cpu,cli]" pillow
pip install -e .
python test_server.py
python validate_setup.py
Starting and testing the server
Test the server locally, then verify the MCP connection from your client. Start the server using the provided startup script and ensure it runs in your environment.
./start_server.sh # Linux/macOS
# or
start_server.bat # Windows
Available tools
rembg-i
Single image background removal tool that removes the background from a single image and saves the result.
rembg-p
Batch processing tool that processes all images in a folder and saves outputs with the .out.png suffix.
alpha_matting
Advanced option to improve edge quality during background removal.
only_mask
Option to output only the black/white mask instead of a full transparent cutout.
models
Support for multiple AI models (u2net, birefnet, isnet, sam, etc.) with recommendations for use cases.