返回 MCP 目录
public公开dns本地运行

tinypng-mcp-server

TinyPNG的MCP服务器,提供本地和远程图片压缩功能

article

README

🚀 TinyPNG的MCP服务器

TinyPNG的MCP服务器为图像压缩提供了便捷的服务,支持本地和远程图像的压缩,可与Claude Desktop集成使用。

🚀 快速开始

使用bunnode运行服务器

  1. 安装依赖并构建项目
pnpm i
pnpm build
  1. 编辑mcp.json文件
{
  "mcpServers": {
    "tinypng": {
      "command": "bun", // 或 "node"
      "args": ["/path/to/tinypng-mcp-server/src/index.ts"], // 或 "dist/index.js"
      "env": {
        "TINYPNG_API_KEY": "your-tinypng-api-key"
      }
    }
  }
}

通过Smithery进行安装

若要通过 Smithery 自动为Claude Desktop安装TinyPNG MCP服务器,可执行以下命令:

npx -y @smithery/cli install @aiyogg/tinypng-mcp-server --client claude

💻 使用示例

基础用法

1. 压缩本地图像

{
  name: 'compress_local_image',
  description: 'Compress a local image file',
  inputSchema: {
    type: 'object',
    properties: {
      imagePath: {
        type: 'string',
        description: 'The ABSOLUTE path to the image file to compress',
        example: '/Users/user/Downloads/image.jpg',
      },
      outputPath: {
        type: 'string',
        description: 'The ABSOLUTE path to save the compressed image file',
        example: '/Users/user/Downloads/image_compressed.jpg',
      },
      outputFormat: {
        type: 'string',
        description: 'The format to save the compressed image file',
        enum: SUPPORTED_IMAGE_TYPES,
        example: 'image/jpeg',
      },
    },
    required: ['imagePath'],
  },
}

2. 压缩远程图像

{
  name: 'compress_remote_image',
  description: 'Compress a remote image file by giving the URL of the image',
  inputSchema: {
    type: 'object',
    properties: {
      imageUrl: {
        type: 'string',
        description: 'The URL of the image file to compress',
        example: 'https://example.com/image.jpg',
      },
      outputPath: {
        type: 'string',
        description: 'The ABSOLUTE path to save the compressed image file',
        example: '/Users/user/Downloads/image_compressed.jpg',
      },
      outputFormat: {
        type: 'string',
        description: 'The format to save the compressed image file',
        enum: SUPPORTED_IMAGE_TYPES,
        example: 'image/jpeg',
      },
    },
    required: ['imageUrl'],
  },
}
help

运行方式说明

cloud

托管运行

托管运行通常表示这个 MCP Server 由服务方环境承载,用户一般按页面提供的连接方式或授权流程接入,不需要在本地长期启动一个 MCP 进程

  1. 打开服务方连接页
  2. 完成授权或复制端点
  3. 在 MCP 客户端中连接
terminal

本地运行 / 其它方式

本地运行通常需要用户在自己的电脑或服务器上安装依赖,把 server_config 复制到 MCP 客户端,并按 env_schema 补齐环境变量、密钥或其它配置

  1. 复制 server_config
  2. 安装所需依赖
  3. 补齐环境变量后重启客户端