Retrieves image dimensions from URLs and local files with optional compression capabilities through the Tinify API for i...
Created byApr 23, 2025
Image Tools MCP
A Model Context Protocol (MCP) service for retrieving image dimensions and compressing images, supporting both URL and local file sources.
_[ ](./README_zh.md)_
Features
Retrieve image dimensions from URLs
Get image dimensions from local files
Compress images from URLs using TinyPNG API
Compress local images using TinyPNG API
Convert images to different formats (webp, jpeg/jpg, png)
Returns width, height, type, MIME type, and compression information
Example Results


download from figma url and compress

Usage
Using as an MCP Service
This service provides five tool functions:
`get_image_size` - Get dimensions of remote images
`get_local_image_size` - Get dimensions of local images
`compress_image_from_url` - Compress remote images using TinyPNG API
`compress_local_image` - Compress local images using TinyPNG API
`figma` - Fetch image links from Figma API and compress them using TinyPNG API
Client Integration
To use this MCP service, you need to connect to it from an MCP client. Here are examples of how to integrate with different clients:
Using with Claude Desktop
Install Claude Desktop from [claude.ai/download](https://claude.ai/download)
Get TinyPNG API key: Visit [TinyPNG](https://tinypng.com/developers) and get your API key
Configure Claude Desktop to use this MCP server by editing the configuration file:
Restart Claude Desktop
Ask Claude to get image dimensions: "Can you tell me the dimensions of this image: https://example.com/image.jpg"
Ask Claude to compress an image: "Can you compress this image: https://example.com/image.jpg"
Ask Claude to compress a local image: "Can you compress this image: D:/path/to/image.png"
Ask Claude to compress a local image folder: "Can you compress this folder: D:/imageFolder"
Ask Claude to fetch image links from Figma API: "Can you fetch image links from Figma API: https://www.figma.com/file/XXXXXXX"
Using with MCP Client Library
get_local_image_size
compress_image_from_url
compress_local_image
figma
Technical Implementation
This project is built on the following libraries:
[probe-image-size](https://github.com/nodeca/probe-image-size) - For image dimension detection
[tinify](https://github.com/tinify/tinify-nodejs) - For image compression via the TinyPNG API
[figma-api](https://github.com/figma/api) - For fetching image links from Figma API
Environment Variables
`TINIFY_API_KEY` - Required for image compression functionality. Get your API key from [TinyPNG](https://tinypng.com/developers)
- When not provided, the compression tools (`compress_image_from_url` and `compress_local_image`) will not be registered
`FIGMA_API_TOKEN` - Required for fetching image links from Figma API. Get your API token from [Figma](https://www.figma.com/developers)
- When not provided, the Figma tool (`figma`) will not be registered
Note: The basic image dimension tools (`get_image_size` and `get_local_image_size`) are always available regardless of API keys.