Image Processing MCP Server

Image Processing MCP Server

Enables image processing tasks such as resizing, compressing, converting formats, cropping, and extracting metadata directly within IDEs like Cursor via the Model Context Protocol.

Category
访问服务器

README

Image Processing MCP server

Description

This project serves as an MCP (Model Context Protocol) server, offering a suite of tools for common image processing tasks. It enables applications and services, such as Cursor and Claude, to easily perform operations like resizing, compressing, and converting image formats directly within your IDE, streamlining your workflow without needing to switch contexts.

Example usage

Live example usage

Resize images in bulk:

Prompt:

Resize all images in `src/assets` folder to a height of 150px,
store the resulting images with the `_small` suffix

Convert images format:

Prompt:

Convert all images with the `.jpeg` extension located in the `/media` directory to the `webp` format.
Save the converted images in the same directory.

Compress large images:

Prompt:

Compress all images in the `/src/images` directory that have a file size larger than 10MB.

Features

  • Resize Images: Adjust the dimensions of images.
  • Compress Images: Reduce file size with configurable quality and lossless options.
  • Convert Image Format: Change image files between various formats (JPEG, PNG, WebP, AVIF, TIFF).
  • Get Image Metadata: Retrieve technical details and information about image files.
  • Crop Images: Extract a specified rectangular area from an image.

Installation

To set up the project locally, follow these steps:

  1. Prerequisites: Ensure you have Node.js (version 14 or higher recommended) and npm installed on your system.

  2. Clone the Repository:

    git clone git@github.com:rafael-castelo/image-processing-mcp-server.git
    cd image-processing-mcp
    
  3. Install Dependencies:

    npm install
    
  4. Build:

    npm run build
    

    This will generate a build of the server and save it on ./build

Usage

Using from Cursor

Add or merge the following configuration to the mcpServers object:

NPX

    {
        "mcpServers": {
        "image-processing": {
                "command": "npx",
                "args": [
                    "-y",
                    "image-processing-mcp-server"
                ]
            }
        }
    }

LOCAL

    {
        "mcpServers": {
        "image-processing": {
                "command": "node",
                "args": [
                    "path/to/mcp/server/build/index.js"
                ]
            }
        }
    }

Once this configuration is in place and Cursor is running, it will automatically start the image-processing MCP server, making the tools available for use via tool calls in the chat or other Cursor features that interact with MCP.

Tools Reference

This section details the image processing tools exposed by the MCP server, including their purpose and parameters.

resize-image

Description: Resize an image to a given width and height.

Parameters:

  • imagePath (string, required): Absolute path to the image file to be resized.
  • outputPath (string, required): Absolute path to save the resized image.
  • width (number, optional): Resulting width of the image. Optional if height is provided.
  • height (number, optional): Resulting height of the image. Optional if width is provided.
  • keepAspectRatio (boolean, optional): Whether to keep the original aspect ratio (default: false).
  • quality (number, optional): Compression quality (default: format standard, 1-100 for JPEG/WEBP, 0-9 for PNG).

compress-image

Description: Compress an image while preserving as much quality as possible. The original format is always kept.

Parameters:

  • imagePath (string, required): Absolute path to the image file to be compressed.
  • outputPath (string, required): Absolute path to save the compressed image.
  • quality (number, optional): Controls the trade-off between file size and visual quality. For JPEG, WebP, and AVIF, higher values (e.g., 90-100) mean better quality and larger files, while lower values (e.g., 60-80) reduce file size but may introduce visible artifacts.
  • lossless (boolean, optional): If true, uses lossless compression when supported by the format (e.g., PNG, WebP, AVIF). If false, lossy compression is used (default: true).

convert-image-format

Description: Convert an image to another format without losing quality. The tool always uses lossless conversion if supported by the output format. Supported formats: jpeg, jpg, png, webp, avif, tiff.

Parameters:

  • imagePath (string, required): Absolute path to the image file to be converted.
  • outputPath (string, required): Absolute path to save the converted image.
  • format (string, required): Desired output format (jpeg, jpg, png, webp, avif, tiff).

get-image-metadata

Description: Retrieves basic file information, including file size, format, dimensions in pixels (width and height), resolution, color space (e.g., sRGB, CMYK) and orientation details for a given image.

Parameters:

  • imagePath (string, required): Absolute path to the image file.

crop-image

Description: Crop an image to a specified rectangular area.

Parameters:

  • imagePath (string, required): Absolute path to the image file to be cropped.
  • outputPath (string, required): Absolute path to save the cropped image.
  • left (number, required): The x-coordinate of the top-left corner of the area to be cropped, in pixels.
  • top (number, required): The y-coordinate of the top-left corner of the area to be cropped, in pixels.
  • width (number, required): The width of the area to be cropped, in pixels.
  • height (number, required): The height of the area to be cropped, in pixels.

batch-image-processing

Description: Run multiple image processing tasks (resize, compress, get metadata, crop image or convert format) in a single batch operation. Always use this tool for tasks involving operations on more than one image.

Parameters:

  • operations (array of objects, required): An array of image processing operations to perform. Each object in the array should have two properties:
    • toolName (string, required): The name of the tool to run (resize-image, compress-image, convert-image-format, get-image-metadata, or crop-image).
    • options (object, required): An object containing the parameters specific to the tool specified in toolName. Refer to the individual tool descriptions for the required parameters.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选