Skip to main content

🪄 ImageSorcery MCP - Powerful Image Processing Tools for AI Assistants

License MCP Claude App Cline

❌ Without ImageSorcery MCP

AI assistants are limited when working with images:

  • ❌ Can't modify or analyze images directly
  • ❌ No ability to crop, resize, or process images
  • ❌ Some LLMs can't detect objects or extract text from images
  • ❌ Limited to verbal descriptions with no visual manipulation

✅ With ImageSorcery MCP

🪄 ImageSorcery empowers AI assistants with powerful image processing capabilities:

  • ✅ Crop, resize, and rotate images with precision
  • ✅ Draw text and shapes on images
  • ✅ Detect objects using state-of-the-art models
  • ✅ Extract text from images with OCR
  • ✅ Get detailed image metadata
  • ✅ Use a wide range of pre-trained models for object detection, OCR, and more

Just ask your AI to help with image tasks:

"Copy all the images with pets from ~/photos/ into ~/pets/."

"Numerate fields on this screenshot.png and prepare screenshot_description.md with a list of described fields."

"Crop the photo.jpg to make the person be centered."

😉 Hint: Add "use imagesorcery" to make sure it will uses propper tool".

Your tool will combine multiple tools listed below to achieve your goal.

🛠️ Available Tools

Tool Description Example Prompt
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'"
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'"
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'"
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'"
get_metainfo Gets metadata information about an image file "Get metadata information about my image 'photo.jpg'"
detect Detects objects in an image using models from Ultralytics "Detect objects in my image 'photo.jpg' with a confidence threshold of 0.4"
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_models Lists all available models in the models directory "List all available models in the models directory"
ocr Performs Optical Character Recognition (OCR) on an image using EasyOCR "Extract text from my image 'document.jpg' using OCR with English language"

😉 Hint: detailed information and usage instructions for each tool can be found in the tool's /src/imagesorcery_mcp/tools/README.md.

🚀 Getting Started

Requirements

  • Python 3.10 or higher
  • Claude.app, Cline, or another MCP client

Installation

  1. Install the package using pip: It's recommended to use a virtual environment, but you can also install it globally.

    # Optional: Create and activate a virtual environment
    # python -m venv venv
    # source venv/bin/activate  # For Linux/macOS
    # venv\Scripts\activate    # For Windows
    
    pip install imagesorcery-mcp
    
  2. Run the post-installation script: This step is crucial for downloading the models required by the tools.

    imagesorcery-mcp --post-install
    
What does the post-installation script do? The `imagesorcery-mcp --post-install` script performs the following actions:
  • Creates a models directory to store pre-trained models.
  • Generates the initial models/model_descriptions.json file.
  • 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.
  • Installs the clip Python package from Ultralytics' GitHub repository (required for text prompts with the find tool).
  • Downloads the CLIP model file required by the find tool.

You can run this process anytime to restore the default models.

⚙️ Configuration MCP client

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": ["detect", "crop", "get_models", "draw_texts", "get_metainfo", "rotate", "resize", "classify", "draw_rectangles", "find", "ocr"],
      "timeout": 100
    }
}
For Windows
"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": ["detect", "crop", "get_models", "draw_texts", "get_metainfo", "rotate", "resize", "classify", "draw_rectangles", "find", "ocr"],
      "timeout": 100
    }
}

📦 Additional Models

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
About Model Descriptions

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.

🤝 Contributing

Whether you're a 👤 human or an 🤖 AI agent, we welcome your contributions to this project!

Directory Structure

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      # Import the central logger
│           └── *.py           # Implements the tool.
└── 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.

Development Setup

  1. Clone the repository:
git clone https://github.com/sunriseapps/imagesorcery-mcp.git # Or your fork
cd imagesorcery-mcp
  1. (Recommended) Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # For Linux/macOS
# venv\Scripts\activate    # For Windows
  1. Install the package in editable mode along with development dependencies:
pip install -e ".[dev]"

This will install imagesorcery-mcp and all dependencies from [project.dependencies] and [project.optional-dependencies].dev (including build and twine).

Rules

These rules apply to all contributors: humans and AI.

  1. 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.

  2. 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.

  3. 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.

  4. Update related README.md files with your changes. Stick to the format and structure of the existing README.md files.

  5. 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.

  6. 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.

Coding hints

  • Use type hints where appropriate
  • Use pydantic for data validation and serialization

📝 Questions?

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.

📜 License

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imagesorcery_mcp-0.2.4.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imagesorcery_mcp-0.2.4-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file imagesorcery_mcp-0.2.4.tar.gz.

File metadata

  • Download URL: imagesorcery_mcp-0.2.4.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for imagesorcery_mcp-0.2.4.tar.gz
Algorithm Hash digest
SHA256 44757e4f4cfad3677b2b64f65e8434a1ec8e619f1b4b34bb6e946a38398bd628
MD5 7dbd93b237ec293ef561d098c51e3f93
BLAKE2b-256 8bff033918c6c6c3813a530f0e95d014663c10b3528501ff134e0ee3c9d95e3c

See more details on using hashes here.

File details

Details for the file imagesorcery_mcp-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for imagesorcery_mcp-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fc1315c55ba21251c5465897f5c0e6b655a2fd34beb03e787afc07f4c2bd0fab
MD5 36096b8bd70ce895f7cdc7204a13de8f
BLAKE2b-256 58b606128fc83c6b04d6474b3971d28aed83ca0a0b72fb0bc483df1698dae733

See more details on using hashes here.

Release history Release notifications | RSS feed

0.12.0

2 files

0.11.4

2 files

0.11.0

2 files

0.10.1

2 files

0.10.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

This release

0.2.4 This release

2 files

0.2.3

2 files

0.2.1

2 files

0.2.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page