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

tinypng-mcp-server

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

article

README

🚀 TinyPNG MCP 服务器

TinyPNG MCP 服务器是一个可用于压缩图片的工具,支持本地和远程图片压缩,可通过多种方式运行和安装。

🚀 快速开始

使用 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 安装 TinyPNG MCP Server for Claude Desktop:

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

💻 使用示例

压缩本地图片

{
  name: 'compress_local_image',
  description: '压缩一个本地图片文件',
  inputSchema: {
    type: 'object',
    properties: {
      imagePath: {
        type: 'string',
        description: '要压缩的图片文件的绝对路径',
        example: '/Users/user/Downloads/image.jpg',
      },
      outputPath: {
        type: 'string',
        description: '保存压缩图片文件的绝对路径',
        example: '/Users/user/Downloads/image_compressed.jpg',
      },
      outputFormat: {
        type: 'string',
        description: '保存压缩图片文件的格式',
        enum: SUPPORTED_IMAGE_TYPES,
        example: 'image/jpeg',
      },
    },
    required: ['imagePath'],
  },
}

压缩远程图片

{
  name: 'compress_remote_image',
  description: '通过提供图片的 URL 来压缩远程图片文件',
  inputSchema: {
    type: 'object',
    properties: {
      imageUrl: {
        type: 'string',
        description: '要压缩的图片文件的 URL',
        example: 'https://example.com/image.jpg',
      },
      outputPath: {
        type: 'string',
        description: '保存压缩图片文件的绝对路径',
        example: '/Users/user/Downloads/image_compressed.jpg',
      },
      outputFormat: {
        type: 'string',
        description: '保存压缩图片文件的格式',
        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. 补齐环境变量后重启客户端