Skip to main content
Glama

image-tools-mcp

Herramientas de imagen MCP

Un servicio de Protocolo de Contexto de Modelo (MCP) para recuperar dimensiones de imágenes y comprimir imágenes, compatible con fuentes de archivos locales y URL.

中文文档

Características

  • Recuperar dimensiones de imágenes a partir de URL
  • Obtener las dimensiones de la imagen desde archivos locales
  • Comprimir imágenes desde URL usando la API TinyPNG
  • Comprimir imágenes locales usando la API TinyPNG
  • Convertir imágenes a diferentes formatos (webp, jpeg/jpg, png)
  • Devuelve información de ancho, alto, tipo, tipo MIME y compresión.

Resultados de ejemplo

Ejemplo Resultado 1Ejemplo Resultado 2

Descargar desde la URL de Figma y comprimirEjemplo Resultado 3

Uso

Utilizando como servicio MCP

Este servicio proporciona cinco funciones de herramienta:

  1. get_image_size - Obtener las dimensiones de las imágenes remotas
  2. get_local_image_size - Obtener las dimensiones de las imágenes locales
  3. compress_image_from_url - Comprime imágenes remotas usando la API TinyPNG
  4. compress_local_image : comprime imágenes locales usando la API TinyPNG
  5. figma : obtiene enlaces de imágenes de la API de Figma y los comprime usando la API TinyPNG

Integración de clientes

Para usar este servicio MCP, debe conectarse desde un cliente MCP. A continuación, se muestran ejemplos de integración con diferentes clientes:

Uso con Claude Desktop
  1. Instalar Claude Desktop desde claude.ai/download
  2. Obtenga la clave API de TinyPNG: Visite TinyPNG y obtenga su clave API
  3. Configure Claude Desktop para utilizar este servidor MCP editando el archivo de configuración:
{ "mcpServers": { "image-tools": { "command": "npx", "args": ["image-tools-mcp"], "env": { "TINIFY_API_KEY": "<YOUR_TINIFY_API_KEY>", "FIGMA_API_TOKEN": "<YOUR_FIGMA_API_TOKEN>" } } } }
  1. Reiniciar Claude Desktop
  2. Pídele a Claude que obtenga las dimensiones de la imagen: "¿Puedes decirme las dimensiones de esta imagen: https://example.com/image.jpg ?"
  3. Pídele a Claude que comprima una imagen: "¿Puedes comprimir esta imagen: https://example.com/image.jpg ? "
  4. Pídele a Claude que comprima una imagen local: "¿Puedes comprimir esta imagen: D:/path/to/image.png?"
  5. Pídele a Claude que comprima una carpeta de imágenes local: "¿Puedes comprimir esta carpeta: D:/imageFolder?"
  6. Pídele a Claude que obtenga enlaces de imágenes de la API de Figma: "¿Puedes obtener enlaces de imágenes de la API de Figma: https://www.figma.com/file/XXXXXXX ?"
Uso con la biblioteca de cliente MCP
import { McpClient } from "@modelcontextprotocol/client"; // Initialize the client const client = new McpClient({ transport: "stdio" // or other transport options }); // Connect to the server await client.connect(); // Get image dimensions from URL const urlResult = await client.callTool("get_image_size", { options: { imageUrl: "https://example.com/image.jpg" } }); console.log(JSON.parse(urlResult.content[0].text)); // Output: { width: 800, height: 600, type: "jpg", mime: "image/jpeg" } // Get image dimensions from local file const localResult = await client.callTool("get_local_image_size", { options: { imagePath: "D:/path/to/image.png" } }); console.log(JSON.parse(localResult.content[0].text)); // Output: { width: 1024, height: 768, type: "png", mime: "image/png", path: "D:/path/to/image.png" } // Compress image from URL const compressUrlResult = await client.callTool("compress_image_from_url", { options: { imageUrl: "https://example.com/image.jpg", outputFormat: "webp" // Optional: convert to webp, jpeg/jpg, or png } }); console.log(JSON.parse(compressUrlResult.content[0].text)); // Output: { originalSize: 102400, compressedSize: 51200, compressionRatio: "50.00%", tempFilePath: "/tmp/compressed_1615456789.webp", format: "webp" } // Compress local image const compressLocalResult = await client.callTool("compress_local_image", { options: { imagePath: "D:/path/to/image.png", outputPath: "D:/path/to/compressed.webp", // Optional outputFormat: "image/webp" // Optional: convert to image/webp, image/jpeg, or image/png } }); console.log(JSON.parse(compressLocalResult.content[0].text)); // Output: { originalSize: 102400, compressedSize: 51200, compressionRatio: "50.00%", outputPath: "D:/path/to/compressed.webp", format: "webp" } // Fetch image links from Figma API const figmaResult = await client.callTool("figma", { options: { figmaUrl: "https://www.figma.com/file/XXXXXXX" } }); console.log(JSON.parse(figmaResult.content[0].text)); // Output: { imageLinks: ["https://example.com/image1.jpg", "https://example.com/image2.jpg"] } ### Tool Schemas #### get_image_size ```typescript { options: { imageUrl: string // URL of the image to retrieve dimensions for } }
obtener_tamaño_de_imagen_local
{ options: { imagePath: string; // Absolute path to the local image file } }
comprimir_imagen_desde_url
{ options: { imageUrl: string // URL of the image to compress outputFormat?: "image/webp" | "image/jpeg" | "image/jpg" | "image/png" // Optional output format } }
comprimir_imagen_local
{ options: { imagePath: string // Absolute path to the local image file outputPath?: string // Optional absolute path for the compressed output image outputFormat?: "image/webp" | "image/jpeg" | "image/jpg" | "image/png" // Optional output format } }
Figma
{ options: { figmaUrl: string; // URL of the Figma file to fetch image links from } }

Registro de cambios

  • 12/05/2025: Se actualizó la API de Figma para admitir parámetros adicionales, incluido un escalado de imagen de 2x.

Implementación técnica

Este proyecto se basa en las siguientes bibliotecas:

  • probe-image-size : para la detección de la dimensión de la imagen
  • tinify - Para la compresión de imágenes a través de la API TinyPNG
  • figma-api : para obtener enlaces de imágenes de la API de Figma

Variables de entorno

  • TINIFY_API_KEY : Necesaria para la compresión de imágenes. Obtén tu clave API de TinyPNG.
    • Cuando no se proporcionan, las herramientas de compresión ( compress_image_from_url y compress_local_image ) no se registrarán
  • FIGMA_API_TOKEN : Necesario para obtener enlaces de imágenes de la API de Figma. Obtén tu token de API de Figma.
    • Cuando no se proporciona, la herramienta Figma ( figma ) no se registrará

Nota: Las herramientas básicas de dimensión de imagen ( get_image_size y get_local_image_size ) siempre están disponibles independientemente de las claves API.

Licencia

Instituto Tecnológico de Massachusetts (MIT)

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Image Tools MCP es un servicio de Protocolo de Contexto de Modelo (MCP) que recupera las dimensiones de las imágenes y las comprime desde URL y archivos locales mediante la API TinyPNG. Admite la conversión de imágenes a formatos como webp, jpeg/jpg y png, y proporciona información detallada sobre el ancho, la altura, el tipo y la compresión.

  1. Características
    1. Resultados de ejemplo
  2. Uso
    1. Utilizando como servicio MCP
    2. Integración de clientes
  3. Registro de cambios
    1. Implementación técnica
      1. Variables de entorno
        1. Licencia

          Related MCP Servers

          • A
            security
            A
            license
            A
            quality
            This MCP server aids users in searching and analyzing their photo library by location, labels, and people, offering functionalities like photo analysis and fuzzy matching for enhanced photo management.
            Last updated -
            20
            Python
            MIT License
            • Apple
          • -
            security
            A
            license
            -
            quality
            An MCP server that provides multiple file conversion tools for AI agents, supporting various document and image format conversions including DOCX to PDF, PDF to DOCX, image conversions, Excel to CSV, HTML to PDF, and Markdown to PDF.
            Last updated -
            15
            Python
            MIT License
            • Linux
            • Apple
          • -
            security
            A
            license
            -
            quality
            An MCP tool server that enables generating and editing images through OpenAI's image models, supporting text-to-image generation and advanced image editing (inpainting, outpainting) across various MCP-compatible clients.
            Last updated -
            52
            TypeScript
            MIT License
            • Linux
            • Apple
          • A
            security
            F
            license
            A
            quality
            An MCP (Model Context Protocol) server that allows generating, editing, and creating variations of images using OpenAI's DALL-E APIs.
            Last updated -
            1
            TypeScript

          View all related MCP servers

          MCP directory API

          We provide all the information about MCP servers via our MCP API.

          curl -X GET 'https://glama.ai/api/mcp/v1/servers/kshern/image-tools-mcp'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server