شعار mcp-imagemagick

mcp-imagemagick

مؤسسة
AeyeOps

MCP server for image conversion using ImageMagick and darktable

الناشرAeyeOps
المستودعmcp-imagemagick
اللغةRust
التفريعات
1
النجوم
15
الأدوات المتاحة
0
نوع نقل البياناتstdio
الفئات
الترخيصMIT
الروابط
  • اربط الأدوات بسير عمل الذكاء الاصطناعي

    يتيح mcp-imagemagick إمكانات 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 الخاص بـ mcp-imagemagick مع نماذج ذكاء اصطناعي متعددة

يربط TypingMind أدوات MCP على مستوى مساحة العمل، لذا بمجرد توصيل mcp-imagemagick، يمكنك استخدامه مع نماذج ذكاء اصطناعي مختلفة في TypingMind بدلًا من إعداده لكل نموذج على حدة. يعمل تكامل MCP هذا محليًا عبر موصل MCP الخاص بـ TypingMind على جهازك.

دليل الإعداد لاستخدام الموصل المحلي

استخدم هذا الخيار عندما يحتاج خادم MCP إلى الوصول إلى ملفات محلية أو تطبيقات أو موارد خاصة على جهاز الكمبيوتر لديك.

1

فتح إعدادات MCP

في TypingMind، انتقل إلى «الإعدادات»، ثم «الإعدادات المتقدمة»، ثم «بروتوكول سياق النموذج»، واختر «إعداد الموصل».

  1. افتح TypingMind في متصفحك.
  2. انقر على أيقونة الإعدادات.
  3. انتقل إلى الإعدادات المتقدمة.
  4. افتح قسم بروتوكول سياق النموذج.
  5. انقر على «إعداد الموصل» واختر «هذا الجهاز».
شاشة إعداد موصل MCP في TypingMind مع تحديد «هذا الجهاز»
2

تنفيذ أمر الموصل

اختر «هذا الجهاز»، وانسخ الأمر من TypingMind وشغّله في Terminal. أبقِ العملية قيد التشغيل أثناء استخدام MCP.

  1. انسخ أمر الإعداد الذي يعرضه TypingMind.
  2. افتح Terminal على macOS أو Windows Terminal على Windows.
  3. الصق الأمر ونفّذه.
  4. وافق على تثبيت الحزمة إذا طلب منك Terminal تأكيد المتابعة.
  5. أبقِ نافذة Terminal والعملية التي تعمل فيها قيد التشغيل أثناء استخدام أدوات MCP.
3

أضف mcp-imagemagick كخادم

عندما تظهر حالة الموصل «جاهز»، انقر على «تعديل الخوادم» والصق إعدادات خادم MCP.

  1. انتظر حتى تظهر حالة الموصل «جاهز».
  2. انقر على «تعديل الخوادم».
  3. الصق إعدادات خادم MCP الخاص بـ mcp-imagemagick.
  4. احفظ قائمة الخوادم.
  5. حدّث الحالة إذا أردت التأكد من أن الموصل لا يزال جاهزًا.
إعدادات MCP في TypingMind تعرض خادمًا نشطًا وزر «تعديل الخوادم»
{
  "mcpServers": {
    "aeyeops-mcp-imagemagick": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-imagemagick"
      ]
    }
  }
}
4

استخدام الاتصال مع نماذج مختلفة

احفظ قائمة الخوادم، وافتح «الإضافات»، وفعّل أدوات MCP الخاصة بـ mcp-imagemagick، ثم اختر أي نموذج ذكاء اصطناعي مدعوم في TypingMind واستخدم الأدوات في المحادثة أو أسندها إلى وكيل ذكاء اصطناعي.

  1. افتح صفحة الإضافات في TypingMind.
  2. فعّل أدوات MCP الخاصة بـ mcp-imagemagick.
  3. ابدأ محادثة واختر نموذج الذكاء الاصطناعي الذي تريد استخدامه.
  4. استخدم أدوات MCP في المحادثة أو عيّنها لوكيل ذكاء اصطناعي.
  5. انتقل إلى نموذج ذكاء اصطناعي آخر عند الحاجة دون إعادة الاتصال بـ MCP.
محادثة في TypingMind تستخدم أدوات MCP المفعّلة مع نموذج ذكاء اصطناعي محدّد
هل يمكنك استخدام mcp-imagemagick لمساعدتي في هذه المهمة؟
mcp-imagemagick
بالتأكيد. قرأته.
إليك ما وجدته باستخدام mcp-imagemagick.

الأسئلة الشائعة

ما استخدامات خادم MCP mcp-imagemagick؟

mcp-imagemagick هو خادم MCP يتيح لتطبيقات الذكاء الاصطناعي المتوافقة الاتصال بأدوات ومصادر سياق خارجية. في TypingMind، يمكنك إضافة خادم MCP هذا مرة واحدة وإتاحة أدواته في مساحة عملك للذكاء الاصطناعي.

هل يمكنني استخدام خادم MCP mcp-imagemagick مع نماذج ذكاء اصطناعي متعددة في TypingMind؟

نعم. يربط TypingMind أدوات MCP على مستوى مساحة العمل، لذا يمكنك استخدام mcp-imagemagick مع نماذج ذكاء اصطناعي مختلفة مثل Claude أو ChatGPT أو Gemini أو غيرها من النماذج التي أعددتها في TypingMind، دون إعداد خادم MCP لكل نموذج على حدة.

لماذا تستخدم موصل MCP mcp-imagemagick مع TypingMind؟

يُعد TypingMind من أفضل واجهات المحادثة مع النماذج اللغوية الكبيرة، إذ يجمع نماذج ذكاء اصطناعي متعددة ومطالبات وإضافات ووكلاء ذكاء اصطناعي ومفاتيح API وأدوات MCP في مساحة عمل واحدة. بعد توصيل mcp-imagemagick، يمكنك استخدام أدوات MCP الخاصة به عبر نماذجك المفضلة مع الحفاظ على سير عمل محادثاتك منظمًا في TypingMind.

كيف أوصّل خادم MCP mcp-imagemagick بـ TypingMind؟

يعمل mcp-imagemagick عبر موصل MCP المحلي في TypingMind. هذا هو الخيار الأنسب عندما يحتاج خادم MCP إلى الوصول إلى ملفات محلية أو تطبيقات سطح المكتب أو أدوات سطر الأوامر أو موارد خاصة على حاسوبك.

ما الأدوات التي يوفّرها خادم MCP mcp-imagemagick في TypingMind؟

يتيح mcp-imagemagick إمكانات MCP يمكنك تفعيلها من صفحة الإضافات في TypingMind واستخدامها في المحادثات أو تعيينها لوكلاء ذكاء اصطناعي.

هل أحتاج إلى مشاركة مفاتيح API الخاصة بي مع TypingMind لاستخدام خادم MCP mcp-imagemagick؟

لا. يعطي TypingMind الأولوية للعمل المحلي ويُبقي مزوّدي النماذج ومفاتيح API والمطالبات وإعدادات MCP تحت تحكمك. إذا كان mcp-imagemagick يتطلب مصادقة، فأضف الترويسات أو إعدادات OAuth أو الإعدادات المحلية المطلوبة لخادم MCP هذا عند إنشاء الاتصال.

خوادم MCP ذات صلة

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا البريدية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇