by sunriseapps
ImageSorcery MCP is a Python-based server that provides a suite of computer vision and image processing tools. It enables AI assistants to perform various image manipulation and analysis tasks locally, ensuring data privacy and security.
ImageSorcery MCP is a Python-based server that provides a suite of computer vision and image processing tools for AI assistants. It enables AI models to perform various image manipulation and analysis tasks locally, without sending images to external servers.
To use ImageSorcery MCP, you need to install it in a Python virtual environment (preferably using python -m venv
). After installation, run the post-installation script (imagesorcery-mcp --post-install
) to download necessary models and dependencies. Then, configure your MCP client (e.g., Claude.app, Cline) to connect to the ImageSorcery MCP server, providing the command to run the server and specifying the tools to auto-approve. You can interact with it by asking your AI assistant to perform image tasks, for example, "copy photos with pets from folder photos
to folder pets
" or "Find a cat at the photo.jpg and crop the image in a half in height and width to make the cat be centerized".
ffmpeg
, libsm6
, libxext6
, libgl1-mesa-glx
system libraries (required by OpenCV).python -m venv imagesorcery-mcp
).pip install imagesorcery-mcp
).imagesorcery-mcp --post-install
) to download models and install dependencies like clip
.models
directory and model_descriptions.json
.clip
Python package from Ultralytics' GitHub repository.uv
for installation?
uv pip install imagesorcery-mcp
works, uv venv
might not include pip
in a way that allows the post-install script to automatically install the clip
package. It's recommended to use python -m venv
for virtual environment creation for smoother clip
installation. If using uv venv
, you might need to manually install clip
.mcpServers
object, specifying the command to run imagesorcery-mcp
(or its full path), transportType
, autoApprove
tools, and timeout
.download-yolo-models
and download-clip-models
. The model_descriptions.json
file will be updated automatically.imagesorcery-mcp
imagesorcery-mcp --transport=streamable-http
(can specify host, port, and path)imagesorcery-mcp --transport=sse
ComputerVision-based πͺ sorcery of local image recognition and editing tools for AI assistants
πͺ ImageSorcery
empowers AI assistants with powerful image processing capabilities:
Just ask your AI to help with image tasks:
"copy photos with pets from frolder
photos
to folderpets
"
"Find a cat at the photo.jpg and crop the image in a half in height and width to make the cat be centerized"
π Hint: Use full path to your files".
"Numerate form fields on this
form.jpg
withfoduucom/web-form-ui-field-detection
model and fill theform.md
with a list of described fields"π Hint: Specify the model and the confidence".
π Hint: Add "use imagesorcery" to make sure it will uses propper tool".
Your tool will combine multiple tools listed below to achieve your goal.
Tool | Description | Example Prompt |
---|---|---|
blur |
Blurs specified areas of an image using OpenCV | "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'" |
change_color |
Changes the color palette of an image | "Convert my image 'test_image.png' to sepia and save it as 'output.png'" |
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'" |
detect |
Detects objects in an image using models from Ultralytics | "Detect objects in my image 'photo.jpg' with a confidence threshold of 0.4" |
draw_arrows |
Draws arrows on an image using OpenCV | "Draw a red arrow from (50,50) to (150,100) on my image 'photo.jpg'" |
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'" |
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'" |
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'" |
find |
Finds objects in an image based on a text description | "Find all dogs in my image 'photo.jpg' with a confidence threshold of 0.4" |
get_metainfo |
Gets metadata information about an image file | "Get metadata information about my image 'photo.jpg'" |
ocr |
Performs Optical Character Recognition (OCR) on an image using EasyOCR | "Extract text from my image 'document.jpg' using OCR with English language" |
overlay |
Overlays one image on top of another, handling transparency | "Overlay 'logo.png' on top of 'background.jpg' at position (10, 10)" |
resize |
Resizes an image using OpenCV | "Resize my image 'photo.jpg' to 800x600 pixels and save it as 'resized_photo.jpg'" |
rotate |
Rotates an image using imutils.rotate_bound function | "Rotate my image 'photo.jpg' by 45 degrees and save it as 'rotated_photo.jpg'" |
π Hint: detailed information and usage instructions for each tool can be found in the tool's /src/imagesorcery_mcp/tools/README.md
.
Resource URI | Description | Example Prompt |
---|---|---|
models://list |
Lists all available models in the models directory | "Which models are available in ImageSorcery?" |
π Hint: detailed information and usage instructions for each resource can be found in the resource's /src/imagesorcery_mcp/resources/README.md
.
Python 3.10
or higherffmpeg
, libsm6
, libxext6
, libgl1-mesa-glx
- system libraries required by OpenCVClaude.app
, Cline
, or another MCP clientThese dependencies are typically included with OpenCV installation and don't require separate installation. But they might be missing in some virtual environments like Docker.
For Ubuntu/Debian systems:
sudo apt-get update && sudo apt-get install -y ffmpeg libsm6 libxext6 libgl1-mesa-glx
For Docker containers: Add this line to your Dockerfile:
RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 libgl1-mesa-glx
1. Load MCP documentation if you have the tool for it. It will give you path to *MCP-configuration file* and other needed instructions.
2. Run command `python -m venv imagesorcery-mcp`
3. Run command `source imagesorcery-mcp/bin/activate`
For windows bash run command `source imagesorcery-mcp/Scripts/activate`
For windows cmd run command `imagesorcery-mcp\Scripts\activate`
4. Run command `pip install imagesorcery-mcp`
5. Run command `imagesorcery-mcp --post-install`
6. Create or modify *MCP-configuration file*.
7. Add the `imagesorcery-mcp` server configuration to the `mcpServers` object in the *MCP-configuration file*
`"imagesorcery-mcp": {"command": "/full/path/to/venv/bin/imagesorcery-mcp","timeout": 100}`
8. Access available models using `models://list` resource from `imagesorcery-mcp`
9. Attempt completion, indicating that the installation and configuration are complete.
Create and activate a virtual environment (Strongly Recommended):
For 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
.
python -m venv imagesorcery-mcp
source imagesorcery-mcp/bin/activate # For Linux/macOS
# source imagesorcery-mcp\Scripts\activate # For Windows
Install the package into the activated virtual environment:
You can use pip
or uv pip
.
pip install imagesorcery-mcp
# OR, if you prefer using uv for installation into the venv:
# uv pip install imagesorcery-mcp
Run the post-installation script:
This step is crucial. It downloads the required models and attempts to install the clip
Python package from GitHub into the active virtual environment.
imagesorcery-mcp --post-install
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.models/model_descriptions.json
file there.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.clip
Python package from Ultralytics' GitHub repository directly into the active Python environment. This is required for text prompt functionality in the find
tool.find
tool into the models
directory.You can run this process anytime to restore the default models and attempt clip
installation.
Using uv venv
to create virtual environments:
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).
If you choose to use uv venv
:
uv venv
.imagesorcery-mcp
: uv pip install imagesorcery-mcp
.clip
package into your active uv venv
:
uv pip install git+https://github.com/ultralytics/CLIP.git
imagesorcery-mcp --post-install
. This will download models but may fail to install the clip
Python package.
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.Using uvx imagesorcery-mcp --post-install
:
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.
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
.
Add to your MCP client these settings.
If imagesorcery-mcp
is in your system's PATH after installation, you can use imagesorcery-mcp
directly as the command. Otherwise, you'll need to provide the full path to the executable.
"mcpServers": {
"imagesorcery-mcp": {
"command": "imagesorcery-mcp", // Or /full/path/to/venv/bin/imagesorcery-mcp if installed in a venv
"transportType": "stdio",
"autoApprove": ["blur", "change_color", "crop", "detect", "draw_arrows", "draw_circles", "draw_rectangles", "draw_texts", "find", "get_metainfo", "ocr", "overlay", "resize", "rotate"],
"timeout": 100
}
}
"mcpServers": {
"imagesorcery-mcp": {
"url": "http://127.0.0.1:8000/mcp", // Use your custom host, port, and path if specified
"transportType": "http",
"autoApprove": ["blur", "change_color", "crop", "detect", "draw_arrows", "draw_circles", "draw_rectangles", "draw_texts", "find", "get_metainfo", "ocr", "overlay", "resize", "rotate"],
"timeout": 100
}
}
"mcpServers": {
"imagesorcery-mcp": {
"command": "imagesorcery-mcp.exe", // Or C:\\full\\path\\to\\venv\\Scripts\\imagesorcery-mcp.exe if installed in a venv
"transportType": "stdio",
"autoApprove": ["blur", "change_color", "crop", "detect", "draw_arrows", "draw_circles", "draw_rectangles", "draw_texts", "find", "get_metainfo", "ocr", "overlay", "resize", "rotate"],
"timeout": 100
}
}
Some tools require specific models to be available in the models
directory:
# Download models for the detect tool
download-yolo-models --ultralytics yoloe-11l-seg
download-yolo-models --huggingface ultralytics/yolov8:yolov8m.pt
When downloading models, the script automatically updates the models/model_descriptions.json
file:
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.
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.
After 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.
ImageSorcery MCP server can be run in different modes:
STDIO
- defaultStreamable HTTP
- for web-based deploymentsServer-Sent Events (SSE)
- for web-based deployments that rely on SSESTDIO Mode (Default) - This is the standard mode for local MCP clients:
imagesorcery-mcp
Streamable HTTP Mode - For web-based deployments:
imagesorcery-mcp --transport=streamable-http
With custom host, port, and path:
imagesorcery-mcp --transport=streamable-http --host=0.0.0.0 --port=4200 --path=/custom-path
Available transport options:
--transport
: Choose between "stdio" (default), "streamable-http", or "sse"--host
: Specify host for HTTP-based transports (default: 127.0.0.1)--port
: Specify port for HTTP-based transports (default: 8000)--path
: Specify endpoint path for HTTP-based transports (default: /mcp)This repository is organized as follows:
.
βββ .gitignore # Specifies intentionally untracked files that Git should ignore.
βββ pyproject.toml # Configuration file for Python projects, including build system, dependencies, and tool settings.
βββ pytest.ini # Configuration file for the pytest testing framework.
βββ README.md # The main documentation file for the project.
βββ setup.sh # A shell script for quick setup (legacy, for reference or local use).
βββ 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.
β βββ model_descriptions.json # Contains descriptions of the available models.
β βββ settings.json # Contains settings related to model management and training runs.
β βββ *.pt # Pre-trained model.
βββ src/ # Contains the source code for the πͺ ImageSorcery MCP server.
β βββ imagesorcery_mcp/ # The main package directory for the server.
β βββ __init__.py # Makes `imagesorcery_mcp` a Python package.
β βββ __main__.py # Entry point for running the package as a script.
β βββ logging_config.py # Configures the logging for the server.
β βββ server.py # The main server file, responsible for initializing FastMCP and registering tools.
β βββ logs/ # Directory for storing server logs.
β βββ scripts/ # Contains utility scripts for model management.
β β βββ README.md # Documentation for the scripts.
β β βββ __init__.py # Makes `scripts` a Python package.
β β βββ create_model_descriptions.py # Script to generate model descriptions.
β β βββ download_clip.py # Script to download CLIP models.
β β βββ post_install.py # Script to run post-installation tasks.
β β βββ download_models.py # Script to download other models (e.g., YOLO).
β βββ tools/ # Contains the implementation of individual MCP tools.
β β βββ README.md # Documentation for the tools.
β β βββ __init__.py # Makes `tools` a Python package.
β β βββ *.py # Implements the tool.
β βββ resources/ # Contains the implementation of individual MCP resources.
β βββ README.md # Documentation for the resources.
β βββ __init__.py # Makes `resources` a Python package.
β βββ *.py # Implements the resource.
βββ tests/ # Contains test files for the project.
βββ test_server.py # Tests for the main server functionality.
βββ data/ # Contains test data, likely image files used in tests.
βββ tools/ # Contains tests for individual tools.
βββ resources/ # Contains tests for individual resources.
git clone https://github.com/sunriseapps/imagesorcery-mcp.git # Or your fork
cd imagesorcery-mcp
python -m venv venv
source venv/bin/activate # For Linux/macOS
# venv\Scripts\activate # For Windows
pip install -e ".[dev]"
This will install imagesorcery-mcp
and all dependencies from [project.dependencies]
and [project.optional-dependencies].dev
(including build
and twine
).
These rules apply to all contributors: humans and AI.
Read all the README.md
files in the project. Understand the project structure and purpose. Understand the guidelines for contributing. Think through how it's relate to you task, and how to make changes accordingly.
Read pyproject.toml
.
Make attention to sections: [tool.ruff]
, [tool.ruff.lint]
, [project.optional-dependencies]
and [project]dependencies
.
Strictly follow code style defined in pyproject.toml
.
Stick to the stack defined in pyproject.toml
dependencies and do not add any new dependencies without a good reason.
Write your code in new and existing files.
If new dependencies needed, update pyproject.toml
and install them via pip install -e .
or pip install -e ".[dev]"
. Do not install them diirectly via pip install
.
Check out exixisting 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 outpput data formats, codeode structure, arcchitecture, etc. of the existing code.
Update related README.md
files with your changes.
Stick to the format and structure of the existing README.md
files.
Write tests for your code.
Check out existing tests for examples (e.g. tests/test_server.py
, tests/tools/test_crop.py
).
Stick to the code style, naming conventions, input and outpput data formats, codeode structure, arcchitecture, etc. of the existing tests.
Run tests and linter to ensure everything works:
pytest
ruff check .
In case of fails - fix the code and tests. It is strictly required to have all new code to comply with the linter rules and pass all tests.
If you have any questions, issues, or suggestions regarding this project, feel free to reach out to:
You can also open an issue in the repository for bug reports or feature requests.
This 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.
Please log in to share your review and rating for this MCP.
Discover more MCP servers with similar functionality and use cases
by recraft-ai
Integrates Recraft's raster and vector image operations into an MCP server, enabling clients to generate, edit, style, vectorize, upscale, and manage images via API calls.
by GongRzhe
Image-Generation-MCP-Server is an MCP server that generates images from text prompts using the Replicate Flux model. Its main purpose is to provide a flexible and configurable tool for creating images based on textual descriptions.
by felores
placid-mcp-server integrates Placid.app with Model Context Protocol (MCP) compatible hosts, enabling dynamic image and video creative generation from templates.
by nkapila6
Generate AIβcrafted memes and convert them into Telegram (with WhatsApp support forthcoming) stickers without requiring any external APIs.
by jacwu
mcp-server-aoai-dalle3 is an MCP server that integrates with Azure OpenAI's DALL-E 3 service. It allows MCP clients to generate images from text prompts with customizable parameters.
by netdata
Real-time, perβsecond infrastructure monitoring platform that provides instant insights, autoβdiscovery, edgeβbased machineβlearning anomaly detection, and lightweight visualizations without requiring complex configuration.
by zed-industries
Provides real-time collaborative editing powered by Rust, enabling developers to edit code instantly across machines with a responsive, GPU-accelerated UI.
by github
Enables AI agents, assistants, and chatbots to interact with GitHub via naturalβlanguage commands, providing readβwrite access to repositories, issues, pull requests, workflows, security data and team activity.
by daytonaio
Provides a secure, elastic sandbox environment for executing AIβgenerated code with isolated runtimes and subβ90β―ms provisioning.