mcp-imagemagickのロゴ

mcp-imagemagick

組織
AeyeOps

MCP server for image conversion using ImageMagick and darktable

公開者AeyeOps
リポジトリmcp-imagemagick
言語Rust
フォーク
1
スター
15
利用可能なツール
0
通信方式stdio
カテゴリ
ライセンスMIT
リンク
  • ツールをAIワークフローに接続

    mcp-imagemagickは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには15件のスターと1件のフォークがあります。

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.

インストール

TypingMind
前提条件:

Node.js 18+

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

mcp-imagemagickのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度mcp-imagemagickに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、デバイス上のTypingMind MCPコネクタを通じてローカルで動作します。

ローカルコネクタのセットアップガイド

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

mcp-imagemagickをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. mcp-imagemagickのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "aeyeops-mcp-imagemagick": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-imagemagick"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてmcp-imagemagickのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. mcp-imagemagickのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
mcp-imagemagickを使ってこのタスクを手伝ってもらえますか?
mcp-imagemagick
はい、読みました。
mcp-imagemagickで調べた結果をお伝えします。

よくある質問

mcp-imagemagick MCPサーバーは何に使いますか?

mcp-imagemagickは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでmcp-imagemagick MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでmcp-imagemagickを利用できます。

TypingMindでmcp-imagemagick MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。mcp-imagemagickを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

mcp-imagemagick MCPをTypingMindに接続するにはどうすればよいですか?

mcp-imagemagickはTypingMindのローカルMCPコネクタ経由で動作します。MCPサーバーがコンピューター上のローカルファイル、デスクトップアプリ、コマンドラインツール、プライベートリソースにアクセスする必要がある場合に最適です。

TypingMindでmcp-imagemagick MCPのどのようなツールを利用できますか?

mcp-imagemagickはMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

mcp-imagemagick MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。mcp-imagemagickで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇