Skip to main content
Glama

image-mcp

中文 | English

GitHub stars Downloads Downloads@latest License MCP image-mcp MCP server

A local image processing MCP Server based on Pillow (offline, no API key required). It exposes a set of image tools to DeepSeek Harness (or other stdio MCP-compatible clients) via MCP: info / resize / crop / convert / compress / rotate / flip / thumbnail / watermark / effects / placeholder / overlay — 12 tools in total, visible to the model as mcp__images__*.

Features

  • Offline and zero-cost: pure local Pillow processing, no online API or keys required.

  • 12 image tools: info / resize / crop / convert / compress / rotate / flip / thumbnail / watermark / effects / placeholder / overlay.

  • Standard protocol: JSON-RPC 2.0, line-delimited stdio MCP; all logs go to stderr (stdout is reserved for the protocol).

  • Easy integration: plug into a DSH profile with a one-line config via @deepseek-ai/dsh-mcp-client.

Related MCP server: media-mcp

Installation & Integration (DSH)

pip install -r requirements.txt   # 或 pip install Pillow

Add the following to your DSH profile patch (e.g. cordis.patch.yml):

- id: mcp-images
  name: '@deepseek-ai/dsh-mcp-client'
  config:
    serverName: images
    transport: stdio
    command: python3
    args: ['<PATH-TO>/image_mcp.py']

After restarting DSH, the agent can call the mcp__images__* tools.

Standalone Run (without DSH)

echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | python3 image_mcp.py
# 返回 12 个工具的 schema

Tools Overview

Tool

Description

info

Get image format / dimensions / mode / size

resize

Resize by width/height or ratio (contain / cover / fill / stretch)

crop

Crop a rectangular region

convert

Convert format (PNG/JPEG/WEBP/GIF/BMP/TIFF)

compress

Re-encode and compress by quality

rotate

Rotate (canvas can be expanded)

flip

Flip horizontally / vertically

thumbnail

Thumbnail with the long edge not exceeding the given size

watermark

Text watermark (position / color / opacity / font size)

effects

Effects: grayscale / sepia / invert / blur / sharpen / contrast / brightness

placeholder

Generate a solid-color placeholder image (with optional text)

overlay

Overlay another image on the base image (supports transparency)

Protocol

  • Transport: stdio, one JSON object per line.

  • Version: JSON-RPC 2.0, Protocol 2025-03-26.

  • SERVER_NAME=dsh-image-mcp, SERVER_VERSION=0.1.0.

Supported Systems

  • Supported systems: macOS / Windows / Linux (Python 3 + Pillow, cross-platform).

  • Windows note: use python (not python3) for the command; use absolute paths or backslashes for paths in args.

License

MIT © TOBYCAI

Available Tools

12 tools
compressA

Re-encode an image at a chosen quality to reduce file size, writing the result to a NEW file (source unchanged). Quality is 1-100 (default 80); lower values produce smaller files. The output format defaults to JPEG but can be set via 'format'. Returns the output path plus bytes_before, bytes_after, and saved_percent so you can see how much space was recovered.

Inputs: out (required), path (required), format, quality.

convertA

Change an image's file format and write it to a NEW file (source unchanged). The target format is inferred from the output file extension (e.g. .webp) unless 'format' is given explicitly; supported targets include PNG, JPEG, WEBP, GIF, BMP, TIFF. When saving to a format without transparency (e.g. JPEG), any alpha channel is flattened onto a white background. Returns the output path and final format.

Inputs: out (required), path (required), format.

cropA

Extract a rectangular sub-region and write it to a NEW file (source unchanged). The region is defined by its top-left corner (x, y) and size (width, height); coordinates are automatically clamped to the image bounds, so partial/out-of-bounds boxes are safe. Returns the output path and the actual box used.

Inputs: x (required), y (required), out (required), path (required), +2 more.

effectsA

Apply a single visual effect and write the result to a NEW file (source unchanged). Effects: greyscale, sepia, invert, blur (uses 'radius'), sharpen, contrast (uses 'factor'), brightness (uses 'factor'). Returns the output path and the effect applied. Unknown effect names raise an error.

Inputs: out (required), path (required), effect (required), factor, +1 more.

flipA

Mirror an image and write it to a NEW file (source unchanged). 'axis' selects horizontal (left-right mirror) or vertical (top-bottom flip). Returns the output path and the axis used.

Inputs: out (required), axis (required), path (required).

infoA

Read-only metadata inspector. Returns the image's absolute path, format, width, height, color mode, and file size in bytes. Use it first to learn an image's dimensions or mode before resizing, cropping, or converting. Never writes to or modifies the source file.

Inputs: path (required).

overlayA

Composite one image on top of another and write the result to a NEW file (sources unchanged). The 'overlay' image is placed at offset (x, y) on the 'base' image; its alpha channel is respected, and an 'opacity' of 0-1 lets you fade it in. Use it for logos, badges, or layering. Returns the output path and the offset used.

Inputs: out (required), base (required), overlay (required), x, +2 more.

placeholderA

Generate a brand-new solid-color image (optionally with a centered label) and write it to 'out'. Useful for mockups, spacer images, or test fixtures. Provide width, height, background color, and optional text with its color and font size. Returns the output path and the generated dimensions.

Inputs: out (required), width (required), height (required), text, +3 more.

resizeA

Resize an image and write the result to a NEW file (the source is never overwritten). Provide width and/or height; if only one is given the other is computed to preserve aspect ratio. 'fit' controls how the image maps into the target box: contain fits inside (no crop), cover fills the box and crops the overflow, fill/stretch forces the exact width x height (aspect ratio may change). Returns the output path and resulting dimensions.

Inputs: out (required), path (required), fit, width, +1 more.

rotateA

Rotate an image clockwise by a number of degrees and write it to a NEW file (source unchanged). With expand=true (the default) the canvas is enlarged so no corners are clipped; set expand=false to keep the original canvas size and crop the overflow. Returns the output path and the angle applied.

Inputs: out (required), path (required), degrees (required), expand.

thumbnailA

Create a downscaled preview whose longest side is at most 'size' pixels (aspect ratio preserved), writing it to a NEW file (source unchanged). Ideal for generating small previews or contact sheets. Returns the output path and the max-side constraint applied.

Inputs: out (required), path (required), size (required).

watermarkA

Burn a text label onto an image and write it to a NEW file (source unchanged). Configure placement (position), color (hex, e.g. #ffffff), opacity (0-1, default 0.6), font size, and padding. The label is drawn with an alpha channel so it blends over the image. Returns the output path and the effective position.

Inputs: out (required), path (required), text (required), color, +4 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 12 tools

    Disambiguation5/5

    Each tool targets a distinct image operation: metadata inspection, resizing, cropping, format conversion, compression, rotation, mirroring, thumbnail generation, watermarking, effects, placeholder creation, and compositing. No two tools overlap in purpose; even resize vs thumbnail and convert vs compress have clear differences in use case.

    Naming Consistency5/5

    All tool names are single, lowercase verbs (info, resize, crop, convert, compress, rotate, flip, thumbnail, watermark, effects, placeholder, overlay). The convention is perfectly consistent, with no mixed styles or vague descriptors.

    Tool Count5/5

    With 12 tools, the server is well-scoped for an image manipulation toolkit. Each tool contributes a distinct capability, and the count is neither sparse nor bloated for the domain.

    Completeness5/5

    The tool surface covers the full lifecycle of image manipulation: reading metadata, resizing, cropping, converting, compressing, rotating, flipping, generating thumbnails, adding watermarks, applying effects, creating placeholders, and compositing overlays. There are no obvious gaps for common image operations.

    Maintenance

    ActivityStale
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers