图像工具 MCP
用于检索图像尺寸和压缩图像的模型上下文协议 (MCP) 服务,支持 URL 和本地文件源。
特征
从 URL 中检索图像尺寸
从本地文件获取图像尺寸
使用 TinyPNG API 压缩来自 URL 的图像
使用 TinyPNG API 压缩本地图像
将图像转换为不同的格式(webp、jpeg/jpg、png)
返回宽度、高度、类型、MIME 类型和压缩信息
示例结果
从 figma url 下载并压缩
用法
用作 MCP 服务
该服务提供五种工具功能:
get_image_size
- 获取远程图像的尺寸get_local_image_size
- 获取本地图像的尺寸compress_image_from_url
- 使用 TinyPNG API 压缩远程图像compress_local_image
- 使用 TinyPNG API 压缩本地图像figma
- 从 Figma API 获取图像链接并使用 TinyPNG API 压缩它们
客户端集成
要使用此 MCP 服务,您需要从 MCP 客户端连接到它。以下是如何与不同客户端集成的示例:
与 Claude Desktop 一起使用
从claude.ai/download安装 Claude Desktop
获取 TinyPNG API 密钥:访问TinyPNG并获取您的 API 密钥
通过编辑配置文件来配置 Claude Desktop 以使用此 MCP 服务器:
重启Claude桌面
要求 Claude 获取图像尺寸:“你能告诉我这张图片的尺寸吗: https://example.com/image.jpg ”
要求 Claude 压缩图像:“您能压缩这张图片吗: https://example.com/image.jpg ”
要求 Claude 压缩本地图像:“您能压缩此图像吗:D:/path/to/image.png”
要求 Claude 压缩本地图像文件夹:“您能压缩这个文件夹吗:D:/imageFolder”
要求 Claude 从 Figma API 获取图像链接:“您能从 Figma API 获取图像链接吗: https://www.figma.com/file/XXXXXXX ”
与 MCP 客户端库一起使用
获取本地图像大小
从 URL 压缩图像
压缩本地图像
figma
变更日志
**2025-05-12:**更新 Figma API 以支持其他参数,包括 2 倍图像缩放。
技术实现
该项目基于以下库构建:
环境变量
TINIFY_API_KEY
- 图像压缩功能所需。从TinyPNG获取 API 密钥如果未提供,则压缩工具(
compress_image_from_url
和compress_local_image
)将不会被注册
FIGMA_API_TOKEN
- 从 Figma API 获取图片链接时需要。获取Figma的 API 令牌若未提供,则 Figma 工具(
figma
)将不会被注册
注意:无论 API 密钥如何,基本图像尺寸工具( get_image_size
和get_local_image_size
)始终可用。
执照
麻省理工学院
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Image Tools MCP 是一种模型上下文协议 (MCP) 服务,它使用 TinyPNG API 从 URL 和本地文件中检索图像尺寸并压缩图像。它支持将图像转换为 webp、jpeg/jpg 和 png 等格式,并提供有关宽度、高度、类型和压缩的详细信息。
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityThis 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 -21MIT License
- -securityAlicense-qualityAn 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 -17MIT License
- -securityAlicense-qualityAn 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 -71MIT License
- AsecurityFlicenseAqualityAn MCP (Model Context Protocol) server that allows generating, editing, and creating variations of images using OpenAI's DALL-E APIs.Last updated -1