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

@javascribe/image-toolbox

v1.1.0

Published

MCP Server for image processing - provides tools for AI agents to compress, resize, convert, and batch process images locally using sharp

Readme

@javascribe/image-toolbox

MCP Server for image processing — 让 AI Agent 在本地完成图片压缩、缩放、格式转换和批量处理。

基于 sharp (libvips),所有处理在用户本地执行,零服务器消耗、零网络上传。

快速接入

在你的 AI 客户端(Claude Desktop / Cursor / Qoder 等)中添加:

{
  "mcpServers": {
    "image-toolbox": {
      "command": "npx",
      "args": ["@javascribe/image-toolbox"]
    }
  }
}

配置完成后,Agent 自动发现以下 6 个工具,无需额外代码。

工具清单

get_image_info

获取图片详细信息(格式、尺寸、文件大小、色彩空间等)。

| 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | input | string | ✅ | 图片文件路径 |

compress_image

按质量压缩图片。

| 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | input | string | ✅ | 输入文件路径 | | output | string | ✅ | 输出文件路径 | | quality | number | ❌ | 压缩质量 1-100,默认 75 | | format | string | ❌ | 输出格式:jpeg/png/webp/avif/gif/tiff |

resize_image

缩放图片,支持按像素或百分比。

| 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | input | string | ✅ | 输入文件路径 | | output | string | ✅ | 输出文件路径 | | width | number | ❌ | 目标宽度 (px) | | height | number | ❌ | 目标高度 (px) | | percentage | number | ❌ | 缩放百分比 1-100 | | fit | string | ❌ | 适配模式:cover/contain/fill/inside/outside | | format | string | ❌ | 输出格式 | | quality | number | ❌ | 输出质量 1-100 |

convert_format

转换图片格式。

| 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | input | string | ✅ | 输入文件路径 | | output | string | ✅ | 输出文件路径 | | format | string | ✅ | 目标格式:jpeg/png/webp/avif/gif/tiff | | quality | number | ❌ | 输出质量 1-100 |

compress_to_size

将图片压缩到指定目标大小(KB),保持长宽尺寸不变。自动搜索最优压缩参数,必要时降低细节。

| 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | input | string | ✅ | 输入文件路径 | | output | string | ✅ | 输出文件路径 | | target_size | number | ✅ | 目标大小 (KB) | | format | string | ❌ | 输出格式 |

batch_compress

批量压缩图片,支持 glob 模式匹配。可按质量压缩,或统一压缩到指定目标大小。

| 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | input_pattern | string | ✅ | glob 模式或目录路径,如 ./photos/*.jpg | | output_dir | string | ✅ | 输出目录 | | target_size | number | ❌ | 目标大小 (KB),指定后每张图压缩到该大小以内,保持尺寸不变 | | quality | number | ❌ | 压缩质量 1-100,默认 75(未指定 target_size 时生效) | | format | string | ❌ | 输出格式 | | percentage | number | ❌ | 缩放百分比(未指定 target_size 时生效) |

使用示例

配置完成后,直接用自然语言指挥 Agent:

"把 ./photos 目录下的所有图片压缩到 200KB 以内"
"将 logo.png 转成 WebP 格式,质量 80"
"把这张 4000x3000 的照片缩小到 50%"
"批量压缩 ./images/*.jpg,质量 60,输出到 ./output"

支持格式

  • 输入:JPEG, PNG, WebP, AVIF, GIF, TIFF, BMP, SVG, HEIC
  • 输出:JPEG, PNG, WebP, AVIF, GIF, TIFF

环境要求

  • Node.js >= 18
  • 首次运行 npx 会自动下载 sharp 的平台原生二进制(约 10MB)

隐私说明

所有图片处理完全在本地完成,不会上传到任何服务器。

License

MIT