MCP server for removing image backgrounds locally using rembg and DirectML
Project description
Background Vanish MCP Server
A local Model Context Protocol (MCP) server that provides tools for isolating backgrounds from images (creating transparent PNGs). It runs entirely locally using rembg (U2NET) and the official mcp Python SDK.
Features
- Local-first: Uses
rembgwhich downloads the U2NET model (~176MB) locally on first run. No API keys or cloud service dependencies. - File System Integration: Works directly with local file paths.
- Base64 support: Can process images sent as base64 strings directly.
Tools
1. remove_background
Removes the background from an image file on the local file system.
- Arguments:
input_path(string, required): Absolute path to the input image file (e.g. JPG, PNG).output_path(string, optional): Absolute path where the transparent PNG should be saved. Defaults to<input_filename>_no_bg.png.return_base64(boolean, optional): Iftrue, returns the base64-encoded string of the output.
- Returns: A confirmation message with path info and optional base64 representation.
2. remove_background_base64
Removes background from a base64-encoded image directly.
- Arguments:
image_base64(string, required): Base64-encoded image data. Supports optional data URI prefix (e.g.data:image/png;base64,...).
- Returns: A transparent PNG image encoded in base64.
Setup & Installation
1. Python Environment Setup
Ensure Python 3.10+ is installed. Then set up the virtual environment:
python -m venv .venv
.venv\Scripts\activate
pip install -e .
Or directly install the required packages:
pip install mcp rembg pillow hatchling
2. Configure Claude Desktop
Add this to your Claude Desktop configuration file (typically located at %APPDATA%\Claude\claude_desktop_config.json):
{
"mcpServers": {
"bg-vanish-mcp": {
"command": "C:/Companies/MCP-servers/bg-remover-mcp/.venv/Scripts/python.exe",
"args": [
"C:/Companies/MCP-servers/bg-remover-mcp/server.py"
],
"env": {
"USE_GPU": "true"
}
}
}
}
[!NOTE] On the very first image processing request,
rembgwill automatically download the U2NET model to your user home folder (~/.u2net/u2net.onnx). This may take a few moments depending on your network connection.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bg_vanish_mcp-0.1.0.tar.gz.
File metadata
- Download URL: bg_vanish_mcp-0.1.0.tar.gz
- Upload date:
- Size: 770.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10e355107ff9e3e65ad523f096eeecfd94d8a4fb2dbdc176d82ba0147a5572c9
|
|
| MD5 |
8621babff6fe5d9e9b5679aecbbd9409
|
|
| BLAKE2b-256 |
c427ecf9bda4a74f4802fabe2e438042ddfb50e52ee961e6c82bdadbb6890c48
|
File details
Details for the file bg_vanish_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bg_vanish_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ab9b65290c7705fe426ac4e6e4bf7d3f5595948521c2de6beb7c9b2bcf0aa34
|
|
| MD5 |
5570ad8c57f4a1b0d31b2db40d2813ab
|
|
| BLAKE2b-256 |
79add12c0b9e3c0ee3bdb1376800df12868ec6a65d8f50f5d08154f47a4dda40
|