An MCP (Model Context Protocol) server for the rembg background removal library. Remove image backgrounds using AI models through Claude Code, Claude Desktop, Cursor, and other MCP-compatible tools.
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.
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.
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
```
```cmd
git clone <repository-url>
cd rembg-mcp
setup.batCreate 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
```
```bash
pip install --upgrade pip
pip install mcp "rembg[cpu,cli]" pillow
pip install -e .
```
```bash
python test_server.py
python validate_setup.pyTest 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 # WindowsSingle image background removal tool that removes the background from a single image and saves the result.
Batch processing tool that processes all images in a folder and saves outputs with the .out.png suffix.
Advanced option to improve edge quality during background removal.
Option to output only the black/white mask instead of a full transparent cutout.
Support for multiple AI models (u2net, birefnet, isnet, sam, etc.) with recommendations for use cases.