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

mcp-image-uploader

v1.0.2

Published

MCP server for image compression and upload

Downloads

18

Readme

MCP Image Uploader

一个用于图片智能压缩和上传的 Model Context Protocol (MCP) 服务器。

功能特性

  • 多源输入: 支持本地文件路径和远程 URL
  • 智能压缩: 根据图片格式和大小自动应用最优压缩策略
  • 多格式支持: JPEG、PNG、WebP、AVIF
  • 双运行时: 支持 Node.js 和 Bun

安装

# 使用 pnpm
pnpm install

# 构建
pnpm build

使用方式

Claude Desktop 配置

~/Library/Application Support/Claude/claude_desktop_config.json 中添加:

{
  "mcpServers": {
    "image-uploader": {
      "command": "node",
      "args": [
        "/path/to/mcp-image-uploader/dist/index.js",
        "UPLOAD_ENDPOINT=https://your-api.com/upload"
      ]
    }
  }
}

或使用开发模式:

{
  "mcpServers": {
    "image-uploader": {
      "command": "npx",
      "args": [
        "tsx",
        "/path/to/mcp-image-uploader/src/index.ts",
        "UPLOAD_ENDPOINT=https://your-api.com/upload"
      ]
    }
  }
}

Bun 运行时

{
  "mcpServers": {
    "image-uploader": {
      "command": "bun",
      "args": [
        "/path/to/mcp-image-uploader/src/index.ts",
        "UPLOAD_ENDPOINT=https://your-api.com/upload"
      ]
    }
  }
}

配置参数

| 参数 | 必填 | 说明 | |------|------|------| | UPLOAD_ENDPOINT | ✅ | 图片上传接口地址 |

也可以通过环境变量配置:

UPLOAD_ENDPOINT=https://your-api.com/upload node dist/index.js

上传接口要求

上传接口需要支持以下格式:

请求:

  • Method: POST
  • Body: 图片文件 (File 对象)

响应:

{
  "url": "https://cdn.example.com/path/to/image.jpg"
}

错误响应:

{
  "dm_error": 10001,
  "error_msg": "错误信息"
}

工具说明

upload_image

压缩并上传图片到图床。

参数:

| 参数 | 类型 | 默认值 | 说明 | |------|------|--------|------| | source | string | (必填) | 图片来源:本地路径或远程 URL | | skipCompress | boolean | false | 是否跳过压缩,直接上传原图 | | autoCompress | boolean | true | 是否启用智能自动压缩(仅 skipCompress=false 时生效) | | quality | number | - | 手动压缩质量 (1-100),仅 skipCompress=false 且 autoCompress=false 时生效 | | format | string | - | 输出格式:jpeg/png/webp/avif(默认保持原格式) |

返回:

{
  "success": true,
  "url": "https://...",
  "stats": {
    "originalSize": "1.5 MB",
    "compressedSize": "320 KB",
    "compressionRatio": "78%"
  }
}

压缩策略

JPEG

  • 自动: < 500KB → quality=78 | > 2MB → quality=65 | 常规 → quality=72
  • 手动: quality=85 (默认)

PNG

  • 自动: 有损量化 + 动态压缩等级
  • 手动: 无损压缩

WebP

  • 自动: quality=75, alphaQuality=100
  • 手动: 自定义 quality (默认 75)

AVIF

  • 自动: 无损压缩
  • 手动: quality=50 (默认)

开发

# 开发模式
pnpm dev

# 构建
pnpm build

# 启动
pnpm start

License

MIT