npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bangdao-ai/mcp-image-compressor

v1.0.1

Published

MCP Server for image compression

Readme

MCP Image Compressor

基于 @modelcontextprotocol/sdk 实现的图片压缩 MCP Server。

功能特性

  • 压缩图片文件(JPEG、PNG、WebP 格式)
  • 可调节输出质量(1-100)
  • 支持按最大宽度/高度等比缩放
  • 支持限制最大文件大小
  • 支持格式转换

环境要求

  • Node.js >= 18.0.0
  • npm >= 9.0.0

安装

npm install

构建

npm run build

使用方式

作为 MCP Server 运行

npm start

在 Cursor 中使用(npx 方式)

  1. 在 Cursor 设置中添加 MCP Server:

    • 打开 Cursor 设置 → Features → MCP
    • 点击 "Add New MCP Server"
  2. 配置 server:

    {
      "mcpServers": {
        "image-compressor": {
          "command": "npx",
          "args": ["-y", "@bangdao-ai/mcp-image-compressor"]
        }
      }
    }
  3. 重启 Cursor 后,在 AI 对话框中即可使用图片压缩功能

在 Cursor 中使用(本地开发方式)

{
  "mcpServers": {
    "image-compressor": {
      "command": "node",
      "args": ["/path/to/mcp/dist/index.js"]
    }
  }
}

工具参数

| 参数 | 类型 | 必填 | 默认值 | 说明 | |------|------|------|--------|------| | inputPath | string | 是 | - | 输入图片的绝对路径 | | outputPath | string | 是 | - | 输出图片的绝对路径 | | quality | number | 否 | 80 | 输出质量 (1-100) | | maxWidth | number | 否 | - | 最大宽度(保持宽高比) | | maxHeight | number | 否 | - | 最大高度(保持宽高比) | | maxSize | number | 否 | - | 最大文件大小(MB),如 0.5 表示 500KB | | format | string | 否 | jpeg | 输出格式:jpeg, png, webp |

返回结果示例

{
  "success": true,
  "message": "图片压缩成功",
  "input": {
    "path": "/path/to/input.jpg",
    "format": "jpeg",
    "size": 2846064,
    "width": 4214,
    "height": 2846
  },
  "output": {
    "path": "/path/to/output.jpg",
    "format": "jpeg",
    "size": 407707,
    "width": 4214,
    "height": 2846,
    "quality": 12
  },
  "compressionRatio": "85.67%"
}

发布到 npm

# 修改 package.json 中的版本号
npm publish

依赖

  • @modelcontextprotocol/sdk - MCP 协议 SDK
  • sharp - 高性能图片处理库
  • zod - TypeScript 模式验证