Logo vun mcp-imagemagick

mcp-imagemagick

Organisatioun
AeyeOps

MCP server for image conversion using ImageMagick and darktable

EditeurAeyeOps
Repositorymcp-imagemagick
SproochRust
Forks
1
Stären
15
Disponibel Tools
0
Transporttypstdio
Kategorien
LizenzMIT
Linken
  • Tools mat KI-Workflows verbannen

    mcp-imagemagick stellt MCP-Funktioune bereit, déi vu kompatibele KI-Clienten a KI-Agente kënne benotzt ginn.

  • 0 disponibel Tools

    Kuckt Iech déi opruffbar Aktiounen hei drënner un, mat Nimm a Beschreiwungen, wa se vum Server geliwwert ginn.

  • Konfiguratioun fir ze kopéieren

    Benotzt d'Installatiounsbeispiller, fir dëse Server an Ärem bevorzugte MCP-Client ze konfiguréieren.

  • Indicateure fir Open Source

    15 Stären an 1 Forks aus dem verlinkte Repository.

mcp-imagemagick

An MCP (Model Context Protocol) server for image conversion using ImageMagick and darktable.

Overview

This server provides tools for converting DNG (Digital Negative) RAW image files to WebP format using either ImageMagick or darktable as the conversion backend. The server implements the MCP protocol over stdio transport, making it compatible with MCP clients like Claude Desktop.

This project serves as both a functional tool and a learning resource for those interested in creating MCP servers. While currently focused on DNG to WebP conversion, we plan to expand its capabilities over time to support more image formats and operations. We're publishing this as a starting point to share our MCP implementation approach and provide others with a working example to learn from.

Features

  • Convert DNG files to WebP format with lossless compression
  • Automatic converter selection based on availability
  • Fallback support between ImageMagick and darktable
  • Full MCP protocol implementation (version 2024-11-05)
  • Robust error handling and recovery
  • Detailed logging to stderr for debugging

Prerequisites

You need at least one of the following image converters installed:

ImageMagick 7

  • Command: convert7 or magick
  • Install on Ubuntu/Debian: sudo apt install imagemagick
  • Verify installation: convert7 -version or magick -version

darktable-cli

  • Command-line interface for darktable RAW processor
  • Install on Ubuntu/Debian: sudo apt install darktable
  • Verify installation: darktable-cli --version

Building from Source

  1. Ensure you have Rust installed (https://rustup.rs/)
  2. Clone or download this repository
  3. Build the project:
bash
cd mcp-imagemagick
cargo build --release

The binary will be available at target/release/mcp-imagemagick.

Usage

MCP Client Configuration

Add the server to your MCP client configuration. For Claude Desktop, add to your settings:

json
{
  "mcpServers": {
    "imagemagick": {
      "command": "/path/to/mcp-imagemagick",
      "args": [],
      "env": {}
    }
  }
}

Available Tools

convert_dng_to_webp

Converts a DNG file to WebP format with lossless compression.

Parameters:

  • input_path (string, required): Path to the DNG file
  • output_path (string, required): Path for the WebP output file
  • converter (string, optional): Which converter to use
    • "auto" (default): Automatically select the best available converter
    • "imagemagick": Use ImageMagick (requires convert7 or magick)
    • "darktable": Use darktable-cli

Example usage:

json
{
  "tool": "convert_dng_to_webp",
  "arguments": {
    "input_path": "/path/to/photo.DNG",
    "output_path": "/path/to/output.webp",
    "converter": "auto"
  }
}
check_converters

Check which image converters are available on the system.

Parameters: None required

Returns: List of available converters and their status

Technical Details

Converter Priority

When using "auto" converter selection:

  1. ImageMagick (priority: 60) - Attempted first when available
  2. darktable (priority: 40) - Used as fallback or when specifically requested

Note: ImageMagick may not support DNG files directly on all systems. The auto-converter will automatically fall back to darktable if ImageMagick fails.

Conversion Settings

ImageMagick WebP settings:
  • webp:lossless=true - Lossless compression
  • webp:exact=true - Preserve exact pixel values
  • webp:method=6 - Maximum compression effort
  • webp:partition-limit=0 - No partition limit
darktable-cli:
  • Uses darktable's RAW processing pipeline
  • Automatically applies any XMP sidecar files if present
  • Provides accurate color management for RAW files

Error Handling

The server includes comprehensive error handling:

  • Continues running even if individual conversions fail
  • Returns proper JSON-RPC error responses
  • Logs detailed error information to stderr
  • Automatically falls back to alternative converters when available

Logging

Control logging verbosity with the RUST_LOG environment variable:

bash
# Show only errors
RUST_LOG=error mcp-imagemagick

# Show informational messages
RUST_LOG=info mcp-imagemagick

# Show detailed debug information
RUST_LOG=debug mcp-imagemagick

Testing

Run the integration test:

bash
cd mcp-imagemagick
python3 test_mcp.py

Project Structure

mcp-imagemagick/
├── src/
│   ├── main.rs           # Entry point with panic handler
│   ├── server.rs         # MCP server implementation
│   ├── transport.rs      # Synchronous stdio transport
│   ├── handlers/         # Request handlers
│   │   └── image.rs      # Image conversion tools
│   └── converters/       # Converter implementations
│       ├── mod.rs        # Auto-converter with fallback
│       ├── imagemagick.rs # ImageMagick converter
│       └── darktable.rs  # darktable converter
├── docs/                 # Additional documentation
└── test_mcp.py          # Integration test

License

MIT License - see LICENSE file for details.

Security Considerations

This project inherits security considerations from ImageMagick. Please be aware:

  • ImageMagick processes many file formats, some of which can contain malicious payloads
  • Always process images from trusted sources when possible
  • Check your ImageMagick security policy (policy.xml) is properly configured
  • Consider running with limited permissions in production environments

For detailed security information, see SECURITY.md and ImageMagick's Security Policy.

Third-Party Software

This project uses the following third-party software:

ImageMagick

darktable

Note: This project calls these tools via their command-line interfaces and does not distribute or incorporate their source code.

Installatioun

TypingMind
Viraussetzungen:

Node.js 18+

{
  "mcpServers": {
    "aeyeops-mcp-imagemagick": {
      "command": "",
      "args": []
    }
  }
}

mcp-imagemagick MCP mat verschiddene KI-Modeller benotzen

TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Soubal mcp-imagemagick verbonnen ass, kënnt Dir et mat verschiddene KI-Modeller an TypingMind benotzen, amplaz et fir all Modell separat anzeriichten. Dës MCP-Integratioun leeft lokal iwwer den TypingMind-MCP-Connector op Ärem Apparat.

Ariichtungsuleedung fir de lokale Connector ze benotzen

Benotzt dës Optioun, wann den MCP-Server Zougrëff op lokal Fichieren, Appen oder privat Ressourcen op Ärem Computer brauch.

1

D'MCP-Astellungen opmaachen

Gitt an TypingMind op „Astellungen“, „Erweidert Astellungen“, dann op „Model Context Protocol“ a wielt „Connector ariichten“.

  1. Maacht TypingMind an Ärem Browser op.
  2. Klickt op d'Astellungssymbol.
  3. Gitt op „Erweidert Astellungen“.
  4. Maacht d'Sektioun „Model Context Protocol“ op.
  5. Klickt op „Connector ariichten“ a wielt „Dësen Apparat“.
Ariichtungsbildschierm vum TypingMind-MCP-Connector mat „Dësen Apparat“ ausgewielt
2

De Connector-Befeel ausféieren

Wielt „Dësen Apparat“, kopéiert de Befeel aus TypingMind a féiert en am Terminal aus. Loosst de Prozess lafen, wärend Dir MCP benotzt.

  1. Kopéiert den Ariichtungsbefeel, deen TypingMind uweist.
  2. Maacht Terminal op macOS oder Windows Terminal op Windows op.
  3. Pescht de Befeel an a féiert en aus.
  4. Bestätegt d'Installatioun vum Package, wann den Terminal Iech freet, ob Dir weiderfuere wëllt.
  5. Loosst den Terminal an de Prozess doranner lafen, wärend Dir MCP-Tools benotzt.
3

mcp-imagemagick als Server derbäisetzen

Wann de Connector-Status „Prett“ ass, klickt op „Serveren änneren“ a pescht d'MCP-Serverkonfiguratioun an.

  1. Waart, bis de Connector-Status „Prett“ weist.
  2. Klickt op „Serveren änneren“.
  3. Pescht d'MCP-Serverkonfiguratioun vu mcp-imagemagick an.
  4. Späichert d'Serverlëscht.
  5. Aktualiséiert, wann Dir kontrolléiere wëllt, ob de Connector nach ëmmer prett ass.
MCP-Astellunge vun TypingMind mat aktivem Server an dem Knäppchen „Serveren änneren“
{
  "mcpServers": {
    "aeyeops-mcp-imagemagick": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-imagemagick"
      ]
    }
  }
}
4

D'Verbindung mat verschiddene Modeller benotzen

Späichert d'Serverlëscht, maacht „Plugins“ op an aktivéiert d'MCP-Tools vu mcp-imagemagick. Wielt dann e belibegen ënnerstëtzte KI-Modell an TypingMind a benotzt d'Tools am Chat oder weist se engem KI-Agent zou.

  1. Maacht d'Säit „Plugins“ an TypingMind op.
  2. Aktivéiert d'MCP-Tools vu mcp-imagemagick.
  3. Start e Chat a wielt de KI-Modell, deen Dir benotze wëllt.
  4. Benotzt d'MCP-Tools am Chat oder weist se engem KI-Agent zou.
  5. Wiesselt bei Bedarf op en anere KI-Modell, ouni MCP nei ze verbannen.
TypingMind-Chat mat aktivéierte MCP-Tools an engem ausgewielte KI-Modell
Hëlleft Dir mir bei dëser Aufgab mat mcp-imagemagick?
mcp-imagemagick
Jo. Ech hunn et gelies.
Dat hunn ech mat mcp-imagemagick fonnt.

Heefeg gestallte Froen

Fir wat gëtt de MCP-Server mcp-imagemagick benotzt?

mcp-imagemagick ass e MCP-Server, deen et kompatibele KI-Clienten erlaabt, sech mat externen Tools a Kontext ze verbannen. An TypingMind kënnt Dir dëse MCP-Server eemol derbäisetzen a seng Tools an Ärem KI-Aarbechtsberäich zur Verfügung stellen.

Kann ech mcp-imagemagick MCP mat méi KI-Modeller an TypingMind benotzen?

Jo. TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Sou kënnt Dir mcp-imagemagick mat verschiddene KI-Modeller wéi Claude, ChatGPT, Gemini oder anere Modeller benotzen, déi Dir an TypingMind konfiguréiert hutt, ouni de MCP-Server fir all Modell separat anzeriichten.

Firwat mcp-imagemagick MCP mat TypingMind benotzen?

TypingMind ass eng vun de beschte Benotzeruewerfläche fir LLM-Chat, well et méi KI-Modeller, Prompts, Plugins, KI-Agenten, API-Schlësselen a MCP-Tools an engem Aarbechtsberäich zesummebréngt. Wann mcp-imagemagick verbonnen ass, kënnt Dir seng MCP-Tools mat Äre bevorzugte Modeller benotzen a gläichzäiteg Är Chataarbecht an TypingMind organiséieren.

Wéi verbannen ech mcp-imagemagick MCP mat TypingMind?

mcp-imagemagick leeft iwwer de lokale MCP-Connector vun TypingMind. Dat eegent sech am beschten, wann de MCP-Server Zougrëff op lokal Fichieren, Desktop-Apps, Kommandozeilen-Tools oder privat Ressourcen op Ärem Computer brauch.

Wéi eng Tools stellt mcp-imagemagick MCP an TypingMind zur Verfügung?

mcp-imagemagick stellt MCP-Funktiounen zur Verfügung, déi Dir op der Plugins-Säit vun TypingMind aktivéiere kënnt, fir se am Chat ze benotzen oder KI-Agenten zouzeweisen.

Muss ech meng API-Schlëssele mat TypingMind deelen, fir mcp-imagemagick MCP ze benotzen?

Nee. TypingMind setzt op lokal Veraarbechtung a léisst Iech d'Kontroll iwwer Är Modellubidder, API-Schlësselen, Prompts a MCP-Konfiguratioun. Wann mcp-imagemagick eng Authentifizéierung verlaangt, setzt déi néideg Headeren, OAuth-Astellungen oder lokal Konfiguratioun fir dee MCP-Server derbäi, wann Dir d'Verbindung erstallt.

Änlech MCP-Serveren

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇