Rembg MCP Server
Click on "Install 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., "@Rembg MCP Serverremove the background from my profile photo.jpg and save it as profile_nobg.png"
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.
Rembg MCP Server
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.
šÆ Features
š¼ļø Image Processing: Remove backgrounds from single images or batch process folders
š¤ Multiple AI Models: u2net, birefnet, isnet, sam, and more specialized models
ā” Performance Optimized: Model session reuse for efficient batch processing
šØ Advanced Options: Alpha matting, mask-only output, custom backgrounds
š Cross-Platform: Support for Windows, macOS, and Linux
š§ Easy Integration: Works with Claude Desktop, Claude Code CLI, Cursor IDE
Related MCP server: Poof Background Removal MCP Server
š¦ Quick Start
š One-Click Installation
Linux/macOS
git clone <repository-url>
cd rembg-mcp
./setup.shWindows
git clone <repository-url>
cd rembg-mcp
setup.batThe setup scripts will automatically:
Check Python 3.10+ requirement
Create virtual environment
Install all dependencies
Configure MCP server
Test the installation
Guide you through AI model downloads
š§ Manual Installation
If you prefer manual installation or need custom configuration:
Create virtual environment:
python3 -m venv rembg
source rembg/bin/activate # Linux/macOS
# or
rembg\Scripts\activate.bat # WindowsInstall dependencies:
pip install --upgrade pip
pip install mcp "rembg[cpu,cli]" pillow
pip install -e .Test installation:
python test_server.py
python validate_setup.pyDownload AI models:
./download_models.sh # Linux/macOS
# or
python download_models.py # Windows (from activated venv)For GPU support:
pip install -e ".[gpu]"š§ MCP Configuration
Claude Desktop Setup
Find your Claude Desktop config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Add the rembg server configuration:
{
"mcpServers": {
"rembg": {
"command": "/path/to/rembg-mcp/start_server.sh",
"cwd": "/path/to/rembg-mcp",
"env": {
"REMBG_HOME": "~/.u2net",
"OMP_NUM_THREADS": "4"
}
}
}
}Replace
/path/to/rembg-mcpwith your actual project pathRestart Claude Desktop
Testing Your Setup
After configuration, test your MCP server:
Start the server manually:
./start_server.sh # Linux/macOS
# or
start_server.bat # WindowsVerify MCP connection in Claude Desktop:
Look for the rembg tools in your Claude conversation
Try a simple command: "List available MCP tools"
Test with a sample image:
Ask Claude: "Use rembg-i to remove the background from test.jpg"
The server will process your request and return results
Claude Code CLI Setup
Add to your Claude Code settings:
{
"mcpServers": {
"rembg": {
"command": "/path/to/rembg-mcp/start_server.sh",
"cwd": "/path/to/rembg-mcp",
"env": {
"REMBG_HOME": "~/.u2net",
"OMP_NUM_THREADS": "4"
}
}
}
}Cursor IDE Setup
Add to your Cursor settings or workspace .cursor/settings.json:
{
"mcp.servers": {
"rembg": {
"command": "/path/to/rembg-mcp/start_server.sh",
"args": [],
"cwd": "/path/to/rembg-mcp"
}
}
}Windows Configuration
For Windows users, use start_server.bat instead:
{
"mcpServers": {
"rembg": {
"command": "C:\\path\\to\\rembg-mcp\\start_server.bat",
"cwd": "C:\\path\\to\\rembg-mcp"
}
}
}š How to Use
Once configured, you can use the rembg tools directly in your MCP-compatible application:
Basic Usage Examples
Single Image Processing:
Remove the background from my photo.jpg and save it as photo_nobg.pngBatch Processing:
Process all images in my Photos folder and remove their backgroundsAdvanced Processing:
Use the birefnet-portrait model to remove backgrounds from all portrait photos in my folder, apply alpha matting for better edges, and save them to a new folderš ļø Available MCP Tools
rembg-i - Single Image Background Removal
Removes background from a single image file with high precision.
Required Parameters:
input_path: Path to the source image fileoutput_path: Where to save the processed image
Optional Parameters:
model: AI model to use (default: "u2net")alpha_matting: Improve edge quality (default: false)only_mask: Output black/white mask only (default: false)
Supported formats: JPG, PNG, BMP, TIFF, WebP
rembg-p - Batch Folder Processing
Processes all images in a folder automatically.
Required Parameters:
input_folder: Source folder containing imagesoutput_folder: Destination folder for processed images
Optional Parameters:
model: AI model to use (default: "u2net")alpha_matting: Improve edge quality (default: false)only_mask: Output masks only (default: false)file_extensions: File types to process (default: common image formats)
Features:
Automatically finds all supported images
Preserves original filenames with
.out.pngsuffixDetailed progress reporting
Error handling for individual files
š¤ Supported AI Models
Model | Use Case | Size | Quality |
| General purpose (default) | Medium | Good |
| Lightweight version | Small | Good |
| Human subjects | Medium | Good |
| Clothing segmentation | Medium | Good |
| Lightweight general | Small | Good |
| High quality general | Large | Excellent |
| Anime characters | Large | Excellent |
| High accuracy general | Large | Excellent |
| Portrait photos | Large | Excellent |
| Massive dataset trained | X-Large | Best |
| Segment Anything (prompt-based) | Large | Variable |
šÆ Model Recommendations
For beginners: Start with u2net (default) - good balance of speed and quality
For best quality: Use birefnet-general or birefnet-massive
For portraits: Use birefnet-portrait - specialized for human subjects
For anime/cartoons: Use isnet-anime - optimized for animated content
For speed: Use u2netp or silueta - faster processing for batch jobs
š„ Downloading Models
Models are downloaded automatically when first used, but you can pre-download them:
# Interactive selection (recommended)
./download_models.sh # Linux/macOS
# Download specific models
./download_models.sh u2net birefnet-portrait
# Download all models
./download_models.sh all
# Windows (from activated virtual environment)
python download_models.py # Interactive
python download_models.py u2net birefnet-portraitModels are cached in ~/.u2net/ and only need to be downloaded once.
š§ Configuration
Environment Variables
REMBG_HOME: Model storage directory (default:~/.u2net)OMP_NUM_THREADS: Number of CPU threads for processing (default: 4)MODEL_CHECKSUM_DISABLED: Skip model checksum verification
Advanced Options
Alpha Matting: Improves edge quality but increases processing time
Mask Only: Returns black/white mask instead of transparent cutout
Custom Background Colors: Replace transparent areas with solid colors
Batch Processing: Automatically reuses model sessions for efficiency
š Project Structure
rembg-mcp/
āāā rembg_mcp/
ā āāā __init__.py
ā āāā server.py # Main MCP server implementation
āāā rembg/ # Virtual environment (git-ignored)
āāā setup.sh # Linux/macOS setup script
āāā setup.bat # Windows setup script
āāā start_server.sh # Linux/macOS server startup
āāā start_server.bat # Windows server startup (generated)
āāā pyproject.toml # Python package configuration
āāā claude_desktop_config.json # Claude Desktop config (Linux/macOS)
āāā claude_desktop_config_windows.json # Claude Desktop config (Windows)
āāā test_server.py # Installation test
āāā validate_setup.py # Comprehensive setup validation
āāā download_models.py # AI model download utility (Python)
āāā download_models.sh # AI model download script (Linux/macOS)
āāā example_usage.py # Usage examples
āāā README.md # This file
āāā USAGE_CN.md # Chinese documentation
āāā CLAUDE.md # Claude Code context filešØ Troubleshooting
Common Issues
MCP Server Not Found
Verify the
commandpath in your MCP configurationEnsure the script is executable:
chmod +x start_server.shCheck that the virtual environment exists:
ls rembg/
Python Version Issues
python --version # Must be 3.10+
# If wrong version, install Python 3.10+ and recreate venvModel Download Problems
# Clear model cache and re-download
rm -rf ~/.u2net
# Re-download models manually
./download_models.sh # Linux/macOS
python download_models.py # Windows
# Download a specific model
./download_models.sh u2net # Linux/macOS
python download_models.py u2net # WindowsMemory or Performance Issues
# Reduce CPU threads
export OMP_NUM_THREADS=2
# Use lighter models (u2netp, silueta) instead of large onesInstallation Problems
# Clean reinstall
rm -rf rembg/
./setup.sh # Or setup.bat on WindowsGetting Help
Run
python validate_setup.pyfor detailed diagnosticsCheck server logs when starting manually
Ensure your MCP client supports the latest protocol version
š Additional Resources
š¤ Contributing
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
š License
This project is licensed under the MIT License - see the LICENSE file for details.
š Acknowledgments
danielgatis/rembg - The excellent background removal library
Anthropic - For the MCP protocol and Claude
The open source community for the various AI models
Available Tools
2 toolsrembg-iC
Remove background from a single image file
| Name | Required | Description | Default |
|---|---|---|---|
| input_path | Yes | Path to the input image file | |
| output_path | Yes | Path for the output image file | |
| model | No | Model to use for background removal. Each model is optimized for different use cases. | u2net |
| alpha_matting | No | Apply alpha matting for better edge quality | |
| only_mask | No | Return only the mask instead of the cutout |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description should disclose behavioral traits like file creation, side effects, or performance. It only states the operation without mentioning that it writes to output_path or any other behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence, but it is slightly under-informative. It could benefit from additional context without being verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the absence of an output schema and annotations, the description is incomplete. It does not explain the output format, any return values, or how the tool interacts with files beyond the operation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema coverage is 100% with detailed descriptions, especially for the model parameter. The description does not add extra meaning, but the baseline of 3 applies as the schema already provides sufficient semantic context.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action (remove background) and the resource (single image file). It distinguishes from the sibling `rembg-p` only by name, not explicitly, but the purpose is specific.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus the sibling `rembg-p` or any other alternatives. No context about prerequisites or ideal use cases.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
rembg-pB
Remove backgrounds from all images in a folder
| Name | Required | Description | Default |
|---|---|---|---|
| input_folder | Yes | Path to the input folder containing images | |
| output_folder | Yes | Path to the output folder for processed images | |
| model | No | Model to use for background removal. Each model is optimized for different use cases. | u2net |
| alpha_matting | No | Apply alpha matting for better edge quality | |
| only_mask | No | Return only masks instead of cutouts | |
| file_extensions | No | File extensions to process |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden but only states the basic action; lacks disclosure of side effects, error handling, or performance traits.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence is concise and to the point, though could include a bit more context without being verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Missing output specification, error handling, and file processing details; for a batch tool, users need more context on behavior and results.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with detailed parameter descriptions, so the tool description adds no extra semantic value beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states 'Remove backgrounds from all images in a folder', using specific verb and resource, which distinguishes it from the sibling rembg-i tool.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No mention of when to use this tool versus alternatives (e.g., rembg-i for single images), nor any exclusions or prerequisites.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
The two tools are clearly distinct: one processes a single image, the other processes all images in a folder. No overlap or ambiguity.
Both tools share the prefix 'rembg-' but use different suffixes ('-i' and '-p'). The pattern is somewhat consistent, but the suffixes are not fully explanatory without context.
With only two tools, the server is minimal but covers the basic use cases. The scope is narrow, so the count is borderline appropriate, but lacks additional options like different models or output formats.
The server covers single and batch background removal, which are the core operations. However, it lacks other potentially useful features like processing remote URLs, preview, or customizing output, leaving minor gaps.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
AI-powered image processing via GPU. Remove backgrounds and upscale images (2x/4x) directly from any MCP client. OAuth 2.1 authenticated, returns processed images inline with download links. Free credits on signup at maskr.io.
Background removal, upscaling, face restore, document OCR, table extraction, visual understanding.
Removes the background from an image by URL, cutting out the foreground person or object with AI and
Background removal, 4x upscaling, and face restoration via GPU
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA collection of image processing tools that enables users to optimize images, remove backgrounds using AI, and generate favicons from logo files locally.
- AlicenseBqualityDmaintenanceEnables AI assistants to remove backgrounds from images using the Poof API via URLs, file paths, or base64 encoding. It also allows users to monitor their account information and remaining credit balance.2132MIT
- AlicenseAqualityBmaintenanceProvides 33 image processing tools ranging from local edits like resizing and cropping to AI-powered features like background removal and upscaling. It also supports advanced professional workflows for generating AI product photography and virtual try-on scenes.3221MIT
- AlicenseAqualityDmaintenanceEnables image generation, editing, and analysis using Google's Gemini 2.5 Flash and Gemini 3 Pro models, with support for batch processing, style templates, and high-resolution output.87581MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/holocode-ai/rembg-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server