Back to MCP directory
publicPublicdnsLocal runtime

mcp_image_processor_to_vercel_blob

这是一个图像处理MCP服务器,提供图像优化、格式转换及上传至Vercel Blob存储的功能,支持本地文件和URL来源的图像处理。

article

README

🚀 图像处理器MCP服务器

本MCP服务器提供图像处理工具,并可将处理后的图像上传至Vercel Blob存储。它具备以下功能:

  1. 优化和调整图像大小(支持本地文件或URL图像)
  2. 将图像转换为WebP格式
  3. 将处理后的PNG和WebP版本图像上传至Vercel Blob存储

✨ 主要特性

  • 图像优化:调整图像大小并进行优化,提升性能
  • WebP转换:将图像转换为WebP格式,减小文件大小
  • Vercel Blob集成:自动将处理后的图像上传至Vercel Blob存储
  • 自定义尺寸:指定图像调整大小的自定义尺寸
  • URL支持:支持处理外部URL的图像

📦 安装指南

服务器已在MCP设置文件中完成安装和配置。它会使用环境变量中的Vercel Blob令牌。

💻 使用示例

基础用法

你可以在Claude中使用use_mcp_tool函数来使用MCP服务器。

处理本地图像

<use_mcp_tool>
<server_name>image-processor</server_name>
<tool_name>process_and_upload_image</tool_name>
<arguments>
{
  "imagePath": "/path/to/image.png",
  "newName": "new-image-name",
  "width": 550,
  "height": 300
}
</arguments>
</use_mcp_tool>

处理URL图像

<use_mcp_tool>
<server_name>image-processor</server_name>
<tool_name>process_and_upload_image_from_url</tool_name>
<arguments>
{
  "imageUrl": "https://example.com/image.jpg",
  "newName": "new-image-name",
  "width": 550,
  "height": 300
}
</arguments>
</use_mcp_tool>

参数说明

本地图像参数

  • imagePath(必需):要处理的图像文件路径
  • newName(必需):处理后图像的新名称(不带扩展名)
  • width(可选):图像调整后的宽度(默认值:550)
  • height(可选):图像调整后的高度(默认值:300)

URL图像参数

  • imageUrl(必需):要处理的图像的URL
  • newName(必需):处理后图像的新名称(不带扩展名)
  • width(可选):图像调整后的宽度(默认值:550)
  • height(可选):图像调整后的高度(默认值:300)

响应结果

服务器将返回一个JSON响应,结构如下:

{
  "success": true,
  "message": "Successfully processed and uploaded image: new-image-name",
  "results": {
    "png": {
      "fileName": "new-image-name_small.png",
      "localPath": "/path/to/temp/new-image-name_small.png",
      "blobUrl": "https://vercel-blob-url/new-image-name_small.png"
    },
    "webp": {
      "fileName": "new-image-name.webp",
      "localPath": "/path/to/temp/new-image-name.webp",
      "blobUrl": "https://vercel-blob-url/new-image-name.webp"
    }
  }
}

高级用法

示例1:处理本地图像

<use_mcp_tool>
<server_name>image-processor</server_name>
<tool_name>process_and_upload_image</tool_name>
<arguments>
{
  "imagePath": "/pathto_file/image_name.png",
  "newName": "test-processed-image",
  "width": 550,
  "height": 300
}
</arguments>
</use_mcp_tool>

示例2:处理URL图像

<use_mcp_tool>
<server_name>image-processor</server_name>
<tool_name>process_and_upload_image_from_url</tool_name>
<arguments>
{
  "imageUrl": "https://pplx-res.cloudinary.com/image/upload/v1749567759/pplx_project_search_images/6dff647e4fb1083aecf9ea6b1d49ea19386be588.jpg",
  "newName": "cloud-image",
  "width": 550,
  "height": 300
}
</arguments>
</use_mcp_tool>

以上两个示例将执行以下操作:

  1. 获取图像(本地路径或URL)
  2. 优化并将图像调整为550x300像素
  3. 创建带有"_small"后缀的PNG版本
  4. 创建WebP版本
  5. 将两个版本上传至Vercel Blob
  6. 返回上传图像的URL

🔧 技术细节

服务器使用了以下工具和库:

  • Sharp:用于图像处理和优化
  • @vercel/blob:用于上传至Vercel Blob存储
  • fs-extra:用于文件系统操作
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client