ComputerVision-based ๐ช sorcery of local image recognition and editing tools for AI assistants Official website: imagesorcery.net ๐ช ImageSorcery empowers AI assistants with powerful image processing capabilities: - โ Crop, resize, and rotate images with precision - โ Remove background - โ Draw text and shapes on images - โ Add logos and watermarks - โ Detect objects using state-of-the-art models
Add this skill
npx mdskills install sunriseapps/imagesorcery-mcpComprehensive local image processing toolkit with excellent tool coverage and clear examples
1# ๐ช ImageSorcery MCP2**ComputerVision-based ๐ช sorcery of local image recognition and editing tools for AI assistants**34Official website: [imagesorcery.net](https://imagesorcery.net?utm_source=readme)56[](https://opensource.org/licenses/MIT) [](https://github.com/microsoft/mcp)7[](https://claude.ai) [](https://cursor.so) [](https://github.com/ClineLabs/cline)8[](https://mseep.ai/app/2620351a-15b1-4840-a93a-cbdbd23a6944) [](https://pepy.tech/projects/imagesorcery-mcp)910<a href="https://glama.ai/mcp/servers/@sunriseapps/imagesorcery-mcp">11 <img width="380" height="200" src="https://glama.ai/mcp/servers/@sunriseapps/imagesorcery-mcp/badge" />12</a>1314## โ With ImageSorcery MCP1516`๐ช ImageSorcery` empowers AI assistants with powerful image processing capabilities:1718- โ Crop, resize, and rotate images with precision19- โ Remove background20- โ Draw text and shapes on images21- โ Add logos and watermarks22- โ Detect objects using state-of-the-art models23- โ Extract text from images with OCR24- โ Use a wide range of pre-trained models for object detection, OCR, and more25- โ Do all of this **locally**, without sending your images to any servers2627Just ask your AI to help with image tasks:2829> "copy photos with pets from folder `photos` to folder `pets`"303132> "Find a cat at the photo.jpg and crop the image in a half in height and width to make the cat be centered"3334๐ _**Hint:** Use full path to your files"._3536> "Enumerate form fields on this `form.jpg` with `foduucom/web-form-ui-field-detection` model and fill the `form.md` with a list of described fields"3738๐ _**Hint:** Specify the model and the confidence"._3940๐ _**Hint:** Add "use imagesorcery" to make sure it will use the proper tool"._4142Your tool will combine multiple tools listed below to achieve your goal.4344## ๐ ๏ธ Available Tools4546| Tool | Description | Example Prompt |47|------|-------------|----------------|48| `blur` | Blurs specified rectangular or polygonal areas of an image using OpenCV. Can also invert the provided areas e.g. to blur background. | "Blur the area from (150, 100) to (250, 200) with a blur strength of 21 in my image 'test_image.png' and save it as 'output.png'" |49| `change_color` | Changes the color palette of an image | "Convert my image 'test_image.png' to sepia and save it as 'output.png'" |50| `config` | View and update ImageSorcery MCP configuration settings | "Show me the current configuration" or "Set the default detection confidence to 0.8" |51| `crop` | Crops an image using OpenCV's NumPy slicing approach | "Crop my image 'input.png' from coordinates (10,10) to (200,200) and save it as 'cropped.png'" |52| `detect` | Detects objects in an image using models from Ultralytics. Can return segmentation masks (as PNG files) or polygons. | "Detect objects in my image 'photo.jpg' with a confidence threshold of 0.4" |53| `draw_arrows` | Draws arrows on an image using OpenCV | "Draw a red arrow from (50,50) to (150,100) on my image 'photo.jpg'" |54| `draw_circles` | Draws circles on an image using OpenCV | "Draw a red circle with center (100,100) and radius 50 on my image 'photo.jpg'" |55| `draw_lines` | Draws lines on an image using OpenCV | "Draw a red line from (50,50) to (150,100) on my image 'photo.jpg'" |56| `draw_rectangles` | Draws rectangles on an image using OpenCV | "Draw a red rectangle from (50,50) to (150,100) and a filled blue rectangle from (200,150) to (300,250) on my image 'photo.jpg'" |57| `draw_texts` | Draws text on an image using OpenCV | "Add text 'Hello World' at position (50,50) and 'Copyright 2023' at the bottom right corner of my image 'photo.jpg'" |58| `fill` | Fills specified rectangular, polygonal, or mask-based areas of an image with a color and opacity, or makes them transparent. Can also invert the provided areas e.g. to remove background. | "Fill the area from (150, 100) to (250, 200) with semi-transparent red in my image 'test_image.png'" |59| `find` | Finds objects in an image based on a text description. Can return segmentation masks (as PNG files) or polygons. | "Find all dogs in my image 'photo.jpg' with a confidence threshold of 0.4" |60| `get_metainfo` | Gets metadata information about an image file | "Get metadata information about my image 'photo.jpg'" |61| `ocr` | Performs Optical Character Recognition (OCR) on an image using EasyOCR | "Extract text from my image 'document.jpg' using OCR with English language" |62| `overlay` | Overlays one image on top of another, handling transparency | "Overlay 'logo.png' on top of 'background.jpg' at position (10, 10)" |63| `resize` | Resizes an image using OpenCV | "Resize my image 'photo.jpg' to 800x600 pixels and save it as 'resized_photo.jpg'" |64| `rotate` | Rotates an image using imutils.rotate_bound function | "Rotate my image 'photo.jpg' by 45 degrees and save it as 'rotated_photo.jpg'" |6566๐ _**Hint:** detailed information and usage instructions for each tool can be found in the tool's `/src/imagesorcery_mcp/tools/README.md`._6768## ๐ Available Resources6970| Resource URI | Description | Example Prompt |71|--------------|-------------|----------------|72| `models://list` | Lists all available models in the models directory | "Which models are available in ImageSorcery?" |7374๐ _**Hint:** detailed information and usage instructions for each resource can be found in the resource's `/src/imagesorcery_mcp/resources/README.md`._7576## ๐ฌ Available Prompts7778| Prompt Name | Description | Example Usage |79|-------------|-------------|---------------|80| `remove-background` | Guides the AI through a comprehensive background removal workflow using object detection and masking tools | "Use the remove-background prompt to remove the background from my photo 'portrait.jpg', keeping only the person" |8182๐ _**Hint:** detailed information and usage instructions for each prompt can be found in the prompt's `/src/imagesorcery_mcp/prompts/README.md`._8384## ๐ Getting Started8586### Requirements8788- `Python 3.10` or higher89- `pipx` (recommended) - for easy installation and virtual environment management90- `ffmpeg`, `libsm6`, `libxext6`, `libgl1-mesa-glx` - system libraries required by OpenCV91- `Claude.app`, `Cline`, or another MCP client9293<details>94<summary>Virtual environments (e.g. Docker)</summary>9596These dependencies are typically included with OpenCV installation and don't require separate installation. But they might be missing in some virtual environments like Docker.9798**For Ubuntu/Debian systems:**99```bash100sudo apt-get update && sudo apt-get install -y ffmpeg libsm6 libxext6 libgl1-mesa-glx101```102103**For Docker containers:**104Add this line to your Dockerfile:105```dockerfile106RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 libgl1-mesa-glx107```108</details>109110### Installation111112113<details>114<summary>For Cline just copy-paste LLM-INSTALL.md</summary>115116```md1171. Load MCP documentation if you have the tool for it. It will give you path to *MCP-configuration file* and other needed instructions.1182. Run command `pipx install imagesorcery-mcp`1193. Run command `imagesorcery-mcp --post-install`1204. Create or modify *MCP-configuration file*.1215. Add the `imagesorcery-mcp` server configuration to the `mcpServers` object in the *MCP-configuration file*122 `"imagesorcery-mcp": {"command": "imagesorcery-mcp","timeout": 100}`1236. Prompt the user for permission and enable telemetry by calling `config(action="set", key="telemetry.enabled", value=True, persist=True)`.1247. Attempt completion, indicating that the installation and configuration are complete.125```126</details>127128#### Method 1: Using pipx (Recommended)129130`pipx` is the recommended way to install ImageSorcery MCP as it automatically handles virtual environment creation and management, making the installation process much simpler.131132<details>133<summary>0. Install pipx (if not already installed):</summary>1341350. **Install pipx (if not already installed):**136 ```bash137 # On macOS with Homebrew:138 brew install pipx139140 # On Ubuntu/Debian:141 sudo apt update && sudo apt install pipx142143 # On other systems with pip:144 pip install --user pipx145 pipx ensurepath146 ```147</details>1481491. **Install ImageSorcery MCP with pipx:**150 ```bash151 pipx install imagesorcery-mcp152 ```1531542. **Run the post-installation script:**155 This step is crucial. It downloads the required models and attempts to install the `clip` Python package from GitHub.156 ```bash157 imagesorcery-mcp --post-install158 ```159160#### Method 2: Manual Virtual Environment (Plan B)161162<details>163<summary>If pipx doesn't work for your system, you can manually create a virtual environment</summary>164165For reliable installation of all components, especially the `clip` package (installed via the post-install script), it is **strongly recommended to use Python's built-in `venv` module instead of `uv venv`**.1661671. **Create and activate a virtual environment:**168 ```bash169 python -m venv imagesorcery-mcp170 source imagesorcery-mcp/bin/activate # For Linux/macOS171 # source imagesorcery-mcp\Scripts\activate # For Windows172 ```1731742. **Install the package into the activated virtual environment:**175 You can use `pip` or `uv pip`.176 ```bash177 pip install imagesorcery-mcp178 # OR, if you prefer using uv for installation into the venv:179 # uv pip install imagesorcery-mcp180 ```1811823. **Run the post-installation script:**183 This step is crucial. It downloads the required models and attempts to install the `clip` Python package from GitHub into the active virtual environment.184 ```bash185 imagesorcery-mcp --post-install186 ```187188**Note:** When using this method, you'll need to provide the full path to the executable in your MCP client configuration (e.g., `/full/path/to/venv/bin/imagesorcery-mcp`).189</details>190191192#### Additional Notes193<details>194<summary>What does the post-installation script do?</summary>195The `imagesorcery-mcp --post-install` script performs the following actions:196197- **Creates a `config.toml` configuration file** in the current directory, allowing users to customize default tool parameters.198- Creates a `models` directory (usually within the site-packages directory of your virtual environment, or a user-specific location if installed globally) to store pre-trained models.199- Generates an initial `models/model_descriptions.json` file there.200- Downloads default YOLO models (`yoloe-11l-seg-pf.pt`, `yoloe-11s-seg-pf.pt`, `yoloe-11l-seg.pt`, `yoloe-11s-seg.pt`) required by the `detect` tool into this `models` directory.201- **Attempts to install the `clip` Python package** from Ultralytics' GitHub repository directly into the active Python environment. This is required for text prompt functionality in the `find` tool.202- Downloads the CLIP model file required by the `find` tool into the `models` directory.203204You can run this process anytime to restore the default models and attempt `clip` installation.205</details>206207<details>208<summary>Important Notes for `uv` users (<code>uv venv</code> and <code>uvx</code>)</summary>209210- **Using `uv venv` to create virtual environments:**211 Based on testing, virtual environments created with `uv venv` may not include `pip` in a way that allows the `imagesorcery-mcp --post-install` script to automatically install the `clip` package from GitHub (it might result in a "No module named pip" error during the `clip` installation step).212 **If you choose to use `uv venv`:**213 1. Create and activate your `uv venv`.214 2. Install `imagesorcery-mcp`: `uv pip install imagesorcery-mcp`.215 3. Manually install the `clip` package into your active `uv venv`:216 ```bash217 uv pip install git+https://github.com/ultralytics/CLIP.git218 ```219 3. Run `imagesorcery-mcp --post-install`. This will download models but may fail to install the `clip` Python package.220 For a smoother automated `clip` installation via the post-install script, using `python -m venv` (as described in step 1 above) is the recommended method for creating the virtual environment.221222- **Using `uvx imagesorcery-mcp --post-install`:**223 Running the post-installation script directly with `uvx` (e.g., `uvx imagesorcery-mcp --post-install`) will likely fail to install the `clip` Python package. This is because the temporary environment created by `uvx` typically does not have `pip` available in a way the script can use. Models will be downloaded, but the `clip` package won't be installed by this command.224 If you intend to use `uvx` to run the main `imagesorcery-mcp` server and require `clip` functionality, you'll need to ensure the `clip` package is installed in an accessible Python environment that `uvx` can find, or consider installing `imagesorcery-mcp` into a persistent environment created with `python -m venv`.225</details>226227## โ๏ธ Configure MCP client228229Add to your MCP client these settings.230231**For pipx installation (recommended):**232```json233"mcpServers": {234 "imagesorcery-mcp": {235 "command": "imagesorcery-mcp",236 "transportType": "stdio",237 "autoApprove": ["blur", "change_color", "config", "crop", "detect", "draw_arrows", "draw_circles", "draw_lines", "draw_rectangles", "draw_texts", "fill", "find", "get_metainfo", "ocr", "overlay", "resize", "rotate"],238 "timeout": 100239 }240}241```242243**For manual venv installation:**244```json245"mcpServers": {246 "imagesorcery-mcp": {247 "command": "/full/path/to/venv/bin/imagesorcery-mcp",248 "transportType": "stdio",249 "autoApprove": ["blur", "change_color", "config", "crop", "detect", "draw_arrows", "draw_circles", "draw_lines", "draw_rectangles", "draw_texts", "fill", "find", "get_metainfo", "ocr", "overlay", "resize", "rotate"],250 "timeout": 100251 }252}253```254<details>255<summary>If you're using the server in HTTP mode, configure your client to connect to the HTTP endpoint:</summary>256257```json258"mcpServers": {259 "imagesorcery-mcp": {260 "url": "http://127.0.0.1:8000/mcp", // Use your custom host, port, and path if specified261 "transportType": "http",262 "autoApprove": ["blur", "change_color", "config", "crop", "detect", "draw_arrows", "draw_circles", "draw_lines", "draw_rectangles", "draw_texts", "fill", "find", "get_metainfo", "ocr", "overlay", "resize", "rotate"],263 "timeout": 100264 }265}266```267</details>268269<details>270<summary>For Windows</summary>271272**For pipx installation (recommended):**273```json274"mcpServers": {275 "imagesorcery-mcp": {276 "command": "imagesorcery-mcp.exe",277 "transportType": "stdio",278 "autoApprove": ["blur", "change_color", "config", "crop", "detect", "draw_arrows", "draw_circles", "draw_lines", "draw_rectangles", "draw_texts", "fill", "find", "get_metainfo", "ocr", "overlay", "resize", "rotate"],279 "timeout": 100280 }281}282```283284**For manual venv installation:**285```json286"mcpServers": {287 "imagesorcery-mcp": {288 "command": "C:\\full\\path\\to\\venv\\Scripts\\imagesorcery-mcp.exe",289 "transportType": "stdio",290 "autoApprove": ["blur", "change_color", "config", "crop", "detect", "draw_arrows", "draw_circles", "draw_lines", "draw_rectangles", "draw_texts", "fill", "find", "get_metainfo", "ocr", "overlay", "resize", "rotate"],291 "timeout": 100292 }293}294```295</details>296297## ๐ฆ Additional Models298299Some tools require specific models to be available in the `models` directory:300301```bash302# Download models for the detect tool303download-yolo-models --ultralytics yoloe-11l-seg304download-yolo-models --huggingface ultralytics/yolov8:yolov8m.pt305```306307<details>308<summary>About Model Descriptions</summary>309310When downloading models, the script automatically updates the `models/model_descriptions.json` file:311312- For Ultralytics models: Descriptions are predefined in `src/imagesorcery_mcp/scripts/create_model_descriptions.py` and include detailed information about each model's purpose, size, and characteristics.313314- For Hugging Face models: Descriptions are automatically extracted from the model card on Hugging Face Hub. The script attempts to use the model name from the model index or the first line of the description.315316After downloading models, it's recommended to check the descriptions in `models/model_descriptions.json` and adjust them if needed to provide more accurate or detailed information about the models' capabilities and use cases.317</details>318319### Running the Server320321ImageSorcery MCP server can be run in different modes:322- `STDIO` - default323- `Streamable HTTP` - for web-based deployments324- `Server-Sent Events (SSE)` - for web-based deployments that rely on SSE325326<details>327<summary>About different modes:</summary>3283291. **STDIO Mode (Default)** - This is the standard mode for local MCP clients:330 ```bash331 imagesorcery-mcp332 ```3333342. **Streamable HTTP Mode** - For web-based deployments:335 ```bash336 imagesorcery-mcp --transport=streamable-http337 ```338339 With custom host, port, and path:340 ```bash341 imagesorcery-mcp --transport=streamable-http --host=0.0.0.0 --port=4200 --path=/custom-path342 ```343344Available transport options:345- `--transport`: Choose between "stdio" (default), "streamable-http", or "sse"346- `--host`: Specify host for HTTP-based transports (default: 127.0.0.1)347- `--port`: Specify port for HTTP-based transports (default: 8000)348- `--path`: Specify endpoint path for HTTP-based transports (default: /mcp)349</details>350351## ๐ Privacy & Telemetry352353We are committed to your privacy. ImageSorcery MCP is designed to run locally, ensuring your images and data stay on your machine.354355To help us understand which features are most popular and fix bugs faster, we've included optional, anonymous telemetry.356357- **It is disabled by default.** You must explicitly opt-in to enable it.358- **What we collect:** Anonymized usage data, including features used (e.g., `crop`, `detect`), application version, operating system type (e.g., 'linux', 'win32'), and tool failures.359- **What we NEVER collect:** We do not collect any personal or sensitive information. This includes image data, file paths, IP addresses, or any other personally identifiable information.360- **How to enable/disable:** You can control telemetry by setting `enabled = true` or `enabled = false` in the `[telemetry]` section of your `config.toml` file.361362## โ๏ธ Configuring the Server363364The server can be configured using a `config.toml` file in the current directory. The file is created automatically during installation with default values. You can customize the default tool parameters in this file. More in [CONFIG.md](CONFIG.md).365366## ๐ค Contributing367<details>368<summary>Whether you're a ๐ค human or an ๐ค AI agent, we welcome your contributions to this project!</summary>369370### Directory Structure371372This repository is organized as follows:373374```375.376โโโ .gitignore # Specifies intentionally untracked files that Git should ignore.377โโโ pyproject.toml # Configuration file for Python projects, including build system, dependencies, and tool settings.378โโโ pytest.ini # Configuration file for the pytest testing framework.379โโโ README.md # The main documentation file for the project.380โโโ setup.sh # A shell script for quick setup (legacy, for reference or local use).381โโโ models/ # This directory stores pre-trained models used by tools like `detect` and `find`. It is typically ignored by Git due to the large file sizes.382โ โโโ model_descriptions.json # Contains descriptions of the available models.383โ โโโ settings.json # Contains settings related to model management and training runs.384โ โโโ *.pt # Pre-trained model.385โโโ src/ # Contains the source code for the ๐ช ImageSorcery MCP server.386โ โโโ imagesorcery_mcp/ # The main package directory for the server.387โ โโโ README.md # High-level overview of the core architecture (server and middleware).388โ โโโ __init__.py # Makes `imagesorcery_mcp` a Python package.389โ โโโ __main__.py # Entry point for running the package as a script.390โ โโโ logging_config.py # Configures the logging for the server.391โ โโโ server.py # The main server file, responsible for initializing FastMCP and registering tools.392โ โโโ middleware.py # Custom middleware for improved validation error handling.393โ โโโ logs/ # Directory for storing server logs.394โ โโโ scripts/ # Contains utility scripts for model management.395โ โ โโโ README.md # Documentation for the scripts.396โ โ โโโ __init__.py # Makes `scripts` a Python package.397โ โ โโโ create_model_descriptions.py # Script to generate model descriptions.398โ โ โโโ download_clip.py # Script to download CLIP models.399โ โ โโโ post_install.py # Script to run post-installation tasks.400โ โ โโโ download_models.py # Script to download other models (e.g., YOLO).401โ โโโ tools/ # Contains the implementation of individual MCP tools.402โ โ โโโ README.md # Documentation for the tools.403โ โ โโโ __init__.py # Makes `tools` a Python package.404โ โ โโโ *.py # Implements the tool.405โ โโโ prompts/ # Contains the implementation of individual MCP prompts.406โ โ โโโ README.md # Documentation for the prompts.407โ โ โโโ __init__.py # Makes `prompts` a Python package.408โ โ โโโ *.py # Implements the prompt.409โ โโโ resources/ # Contains the implementation of individual MCP resources.410โ โโโ README.md # Documentation for the resources.411โ โโโ __init__.py # Makes `resources` a Python package.412โ โโโ *.py # Implements the resource.413โโโ tests/ # Contains test files for the project.414 โโโ test_server.py # Tests for the main server functionality.415 โโโ data/ # Contains test data, likely image files used in tests.416 โโโ tools/ # Contains tests for individual tools.417 โโโ prompts/ # Contains tests for individual prompts.418 โโโ resources/ # Contains tests for individual resources.419```420421### Development Setup4224231. Clone the repository:424```bash425git clone https://github.com/sunriseapps/imagesorcery-mcp.git # Or your fork426cd imagesorcery-mcp427```4284292. (Recommended) Create and activate a virtual environment:430```bash431python -m venv venv432source venv/bin/activate # For Linux/macOS433# venv\Scripts\activate # For Windows434```4354363. Install the package in editable mode along with development dependencies:437```bash438pip install -e ".[dev]"439```440This will install `imagesorcery-mcp` and all dependencies from `[project.dependencies]` and `[project.optional-dependencies].dev` (including `build` and `twine`).441442### Rules443444These rules apply to all contributors: humans and AI.4454460. Read all the `README.md` files in the project. Understand the project structure and purpose. Understand the guidelines for contributing. Think through how it relates to your task, and how to make changes accordingly.4471. Read `pyproject.toml`.448Pay attention to sections: `[tool.ruff]`, `[tool.ruff.lint]`, `[project.optional-dependencies]` and `[project]dependencies`.449Strictly follow code style defined in `pyproject.toml`.450Stick to the stack defined in `pyproject.toml` dependencies and do not add any new dependencies without a good reason.4512. Write your code in new and existing files.452If new dependencies are needed, update `pyproject.toml` and install them via `pip install -e .` or `pip install -e ".[dev]"`. Do not install them directly via `pip install`.453Check out existing source codes for examples (e.g. `src/imagesorcery_mcp/server.py`, `src/imagesorcery_mcp/tools/crop.py`). Stick to the code style, naming conventions, input and output data formats, code structure, architecture, etc. of the existing code.4543. Update related `README.md` files with your changes.455Stick to the format and structure of the existing `README.md` files.4564. Write tests for your code.457Check out existing tests for examples (e.g. `tests/test_server.py`, `tests/tools/test_crop.py`).458Stick to the code style, naming conventions, input and output data formats, code structure, architecture, etc. of the existing tests.4594605. Run tests and linter to ensure everything works:461```bash462pytest463ruff check .464```465In case of failures - fix the code and tests. It is **strictly required** to have all new code to comply with the linter rules and pass all tests.466467468### Coding hints469- Use type hints where appropriate470- Use pydantic for data validation and serialization471</details>472473## ๐ Questions?474475If you have any questions, issues, or suggestions regarding this project, feel free to reach out to:476477- Project Author: [titulus](https://www.linkedin.com/in/titulus/) via LinkedIn478- Sunrise Apps CEO: [Vlad Karm](https://www.linkedin.com/in/vladkarm/) via LinkedIn479480You can also open an issue in the repository for bug reports or feature requests.481482## ๐ License483484This project is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License.485
Full transparency โ inspect the skill content before installing.