mcp-imagemagick logo

mcp-imagemagick

Organization
AeyeOps

MCP server for image conversion using ImageMagick and darktable

PublisherAeyeOps
Repositorymcp-imagemagick
LanguageRust
Forks
1
Stars
15
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    mcp-imagemagick exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    15 stars and 1 forks from the linked 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.

Installation

TypingMind
Prerequisites:

Node.js 18+

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

Use mcp-imagemagick MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once mcp-imagemagick is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add mcp-imagemagick as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the mcp-imagemagick MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "aeyeops-mcp-imagemagick": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-imagemagick"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the mcp-imagemagick MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the mcp-imagemagick MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use mcp-imagemagick to help me with this task?
mcp-imagemagick
Sure. I read it.
Here is what I found using mcp-imagemagick.

Frequently asked questions

What is the mcp-imagemagick MCP server used for?

mcp-imagemagick is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use mcp-imagemagick MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use mcp-imagemagick with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use mcp-imagemagick MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With mcp-imagemagick connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect mcp-imagemagick MCP to TypingMind?

mcp-imagemagick runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does mcp-imagemagick MCP provide in TypingMind?

mcp-imagemagick exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use mcp-imagemagick MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If mcp-imagemagick requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇