Back to MCP directory
publicPublicdnsLocal runtime

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

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