Token导航 LogoToken导航TokenDH.com
Image Tools MCP logo
设计创作未说明官方级别未说明来源级核验

Image Tools MCP

MCP Server

一个用于获取图像尺寸、压缩图像并支持多种格式转换的MCP服务。

工具数

2

提示词数

0

GitHub Stars

8

资源数

0
图像处理格式转换JavaScriptFigma集成

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

kshern

提供方

kshern

最后核验

2026/5/17 20:19

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

图像工具MCP

](https://smithery.ai/server/@kshern/image-tools-mcp)

一种模型上下文协议(MCP)服务,用于检索图像尺寸和压缩图像,支持URL和本地文件源。

_中文文档_

特性

  • 从URL检索图像尺寸
  • 从本地文件获取图像尺寸
  • 使用TinyPNG API压缩URL中的图像
  • 使用TinyPNG API压缩本地图像
  • 将图像转换为不同格式(webp、jpeg/jpg、png)
  • 返回宽度、高度、类型、MIME类型和压缩信息

示例结果

Example Result 1 Example Result 2

Example Result 1 Example Result 2

从figma网址下载并压缩 Example Result 3

用法

用作MCP服务

此服务提供五个工具功能:

  1. get_image_size -获取远程图像的尺寸
  2. get_local_image_size -获取本地图像的尺寸
  3. compress_image_from_url -使用TinyPNG API压缩远程图像
  4. compress_local_image -使用TinyPNG API压缩本地图像
  5. figma -从Figma API获取图像链接,并使用TinyPNG API压缩它们

客户端集成

要使用此MCP服务,您需要从MCP客户端连接到它。以下是如何与不同客户集成的示例:

用法

{
  "mcpServers": {
    "image-tools": {
      "command": "npx",
      "args": ["image-tools-mcp"],
      "env": {
        "TINIFY_API_KEY": "",
        "FIGMA_API_TOKEN": ""
      }
    }
  }
}

与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

{ options: { imageUrl: string // URL of the image to retrieve dimensions for } }


#### get_local_image_size

{ options: { imagePath: string; // Absolute path to the local image file } }


#### compress_image_from_url

{ options: { imageUrl: string // URL of the image to compress outputFormat?: "image/webp" | "image/jpeg" | "image/jpg" | "image/png" // Optional output format } }


#### 压缩库图像

{ 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 } }


#### 菲格玛

{ options: { figmaUrl: string; // URL of the Figma file to fetch image links from } }


## 更新日志

- **2025-05-12:** 更新了Figma API以支持其他参数,包括2倍图像缩放。

## 技术实现

此项目基于以下库构建:

- [探头图像大小](https://github.com/nodeca/probe-image-size) -用于图像尺寸检测
- [tinify](https://github.com/tinify/tinify-nodejs) -通过TinyPNG API进行图像压缩
- [figma api](https://github.com/figma/api) -用于从Figma API获取图像链接

## 环境变量

- `TINIFY_API_KEY` -图像压缩功能所需。从获取API密钥 [TinyPNG](https://tinypng.com/developers)
  - 如果没有提供,压缩工具(`compress_image_from_url` 和 `compress_local_image`)将不会注册
- `FIGMA_API_TOKEN` -需要从Figma API获取图像链接。从获取您的API令牌 [Figma](https://www.figma.com/developers)
  - 如果没有提供,Figma工具(`figma`)将不会注册

注:基本图像尺寸工具(`get_image_size` 和 `get_local_image_size`)无论API密钥如何,始终可用。

## 许可证

麻省理工学院

目录标签

目录标签

图像处理格式转换JavaScriptFigma集成本地部署图像压缩MCP服务

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

2

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP