easytiny-mcp
One-line summary: A batch image optimizer that compresses images visually losslessly into a temp directory for preview, then replaces the originals only after you approve the plan.
prepare_compression(read-only): compress files/directories of JPEG, PNG, WebP, AVIF, GIF, and SVG into a temp folder without touching originals; returns aplan_idplus a preview table (old size, new size, encoder used, SSIMULACRA2 score, skip reason).Options:
paths(required, absolute paths recommended),effort(fast/balanced/max),min_score(50–100, default 85 = visually lossless),recursive(default true).Each format has a fixed encoder ladder (e.g.
cjpegli→jpegtran,pngquant→oxipng,cwebp,avifenc,gifsicle, SVGO), accepting the first result that saves ≥3% at SSIMULACRA2 ≥85, with lossless fallback; files <10KB or already compressed are skipped.
apply_compression(destructive): atomically replace the originals for a givenplan_id, with optionalbackup: trueto copy originals into.image-backup/first. Intended only after the user has seen the preview table and explicitly agreed.cancel_compression: throw away a plan and delete its temp files; originals stay untouched.Plans are valid for 30 minutes and are invalidated by a server restart, so a new preview + approval is needed afterward.
Caveat: the schema's
apply_compressionrequires onlyplan_idand exposes noconfirmed: truefield, although the README states that flag is mandatory — a mismatch worth fixing before relying on the approval guarantee.
Compresses JPEG images losslessly or lossily using cjpegli/jpegtran, with SSIMULACRA2 quality checks and a preview/confirm workflow before replacing the originals.
Optimizes SVG files with a conservative SVGO configuration, verifying results via rendering comparison before the compressed file replaces the original.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@easytiny-mcp compress all images in ./assets — preview first, then apply with backups"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
easytiny-mcp
视觉无损的图片批量压缩 MCP 服务。压缩结果先放在临时目录预览,用户确认后才原地替换原图。
工具
工具 | 作用 |
| 压缩到临时目录,返回 |
| 用户在聊天中确认后,传入 |
| 丢弃预览结果 |
Related MCP server: TinyPNG MCP Server
确认与替换流程
调用
prepare_compression,将返回的预览表完整展示给用户,原图保持不变。用户在聊天中明确同意替换该计划后,调用
apply_compression({ plan_id, confirmed: true });需要备份时额外传入backup: true。服务端校验确认参数和计划,再检查原图是否发生变化并执行替换。无论客户端是否支持 elicitation,都不会再次请求确认表单。
confirmed 无默认值:省略、传 false 或传字符串 "true" 都不会替换文件,计划仍可在有效期内重新提交。计划有效期为 30 分钟,失效或服务重启后需要重新生成预览并获得确认。
此参数是调用方对已有用户授权的明确声明;服务端能校验参数,不能直接读取或验证聊天内容。调用方必须确认授权对应当前 plan_id,不得自行填 true。客户端自身的工具审批策略仍然生效。
升级时,原先只传 { plan_id } 的调用及工作流说明需同步增加 confirmed: true(仅在用户已同意后)。已运行的 MCP 服务需重启或重新连接以加载新的工具定义;固定使用 npm 旧版本的配置不会自动使用本地修改。
压缩策略
每种格式一个主力编码器,按固定顺序尝试,采用第一个「节省 ≥3% 且 SSIMULACRA2 ≥85」的结果,最后以无损优化兜底。小于 10KB 或已压缩过的文件直接跳过。
格式 | balanced 尝试顺序 |
JPEG |
|
PNG |
|
WebP | 有损源 |
AVIF |
|
GIF |
|
SVG | SVGO(保守配置)+ 渲染比对 |
effort:fast 跳过 SSIMULACRA2 判定、参数更保守;max 从更激进的参数逐级放宽,更慢、压缩率更高。
开发
pnpm install
scripts/build-bins.sh # 编译编码器到 vendor/bin(也可用 EASYTINY_BIN_DIR 指定目录)
pnpm tsx scripts/gen-img.ts # 重新生成 img/ 下的测试图片(已提交,一般无需运行)
pnpm fixtures # 从 img/ 生成其他格式的测试样例
pnpm bench img bench/fixtures [--effort fast|balanced|max] [-v] # 只输出统计,不改动原图
pnpm test接入
支持 macOS(Apple Silicon / Intel)与 Windows x64,需要 Node.js ≥ 20。编码器随平台包自动安装,无需额外依赖。
# Claude Code:所有项目可用;只想在当前项目用就去掉 --scope user
claude mcp add --scope user easytiny -- npx -y easytiny-mcp其他客户端(Cursor 等)的 JSON 配置:
{ "mcpServers": { "easytiny": { "command": "npx", "args": ["-y", "easytiny-mcp"] } } }本地开发版:先 pnpm build,再把命令换成 node /path/to/easytiny-mcp/dist/index.js。
发布
推送 v* tag 后,GitHub Actions 会在各平台编译编码器、跑测试,并发布主包 easytiny-mcp 与平台包 easytiny-mcp-darwin-arm64、easytiny-mcp-darwin-x64、@easychan/easytiny-mcp-win32-x64:
git tag v0.2.0 && git push origin v0.2.0npm 认证使用 Trusted Publishing(OIDC),无需长期 token:
首次发布前包还不存在,需要在 npm 生成一个可发布的 Granular Access Token,填入仓库 Secrets 的
NPM_TOKEN。首次发布成功后,在 npmjs.com 上为 4 个包分别添加 Trusted Publisher(仓库
chaneasy/easytiny-mcp,工作流release.yml,环境npm),然后删除NPM_TOKEN。
Available Tools
3 toolsapply_compression替换原图ADestructive
用 prepare_compression 的结果替换原图。只能在用户看过预览表并明确同意后调用。
Inputs: plan_id (required), backup.
cancel_compression取消压缩计划A
丢弃 prepare_compression 的结果并清理临时文件,原图不受影响。
Inputs: plan_id (required).
prepare_compression预览图片压缩ARead-only
视觉无损压缩图片(JPEG/PNG/WebP/AVIF/GIF/SVG),结果存放在临时目录,不修改原图。返回 plan_id 和预览表。必须把预览表完整展示给用户,并在用户明确同意后才能调用 apply_compression。
Inputs: paths (required), effort, min_score, recursive.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a clearly distinct role in the workflow: prepare generates a compression plan and preview, apply commits the changes, and cancel discards the plan. There is no overlap in purpose, and the descriptions explicitly state when each should be used.
All tool names follow a consistent verb_noun pattern in snake_case: prepare_compression, apply_compression, cancel_compression. The verbs are distinct and the noun is consistent, making the pattern predictable.
With only 3 tools, the set is minimal but perfectly scoped to the compression workflow. Each tool corresponds to a necessary step (prepare, apply, cancel), and no extraneous tools are present.
The surface covers the full lifecycle: creating a compression plan with preview, committing the result, and aborting the operation. There are no obvious missing operations for the stated purpose of safe, preview-based image compression.
Related MCP Connectors
List compression profiles, estimate gains, and compress images, PDFs, and Office files.
Image and PDF toolkit: convert to AVIF/WebP/JXL, resize, crop, remove backgrounds, optimize PDFs.
Compress, convert and resize images, and scan web pages for every image they load.
Compress PNG images and convert them to or from popular image and document formats.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables conversion between multiple image formats including JPG, PNG, WebP, GIF, BMP, TIFF, SVG, ICO, and AVIF with quality control and batch processing capabilities.498 npm2MIT
- AlicenseNot gradedqualityDmaintenanceEnables batch image compression and resizing using the TinyPNG API. Supports PNG, JPEG, WebP, and AVIF formats with detailed compression reports and multiple resize modes.7 npm2ISC
- AlicenseDqualityDmaintenanceConverts PNG, JPG, and JPEG images to WebP format with configurable quality and lossless compression, supporting single and batch conversion.214 npm1MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to compress photos on the local machine to an exact target size in B, KB, or MB, with tools for batch compression, pre-flight feasibility estimation, image info lookup, and format listing, all returning structured JSON statuses.2MIT