Tinify image tools
dev.tinify由 tinify.dev 发布v0.1.7更新于 Oct 24, 2026
Compress, resize, crop, and convert images with the Tinify.dev API from any MCP client.
概览
本地 MCP 服务器,让助手通过 Tinify.dev API 压缩、缩放、裁剪和转换图片,并把结果写入新文件。
- 可以做什么
- 压缩 PNG、JPEG、WebP 和 AVIF 文件,可选质量模式与目标大小
- 按宽度、高度或比例缩放图片,可选择保持宽高比
- 按矩形裁剪图片,并在 AVIF、WebP、JPEG、PNG 之间转换格式
- 查询套餐、计费周期与剩余操作次数
- 返回精确的字节数据,并说明文件是否真的被优化
- 适用场景
- 适合让助手处理本机上的图片素材,例如批量压缩截图文件夹、为网页调整照片尺寸,并查看真实的压缩前后大小而不是估算的节省比例。
- 运行要求
- 通过 npx 在本地运行,需要 Node.js 20 或更高版本。需要在 TINIFY_API_KEY 环境变量中提供 Tinify.dev API 密钥,免费额度为每月 500 次操作。可选环境变量 TINIFY_BASE_URL 可覆盖 API 地址。需要能访问 Tinify.dev API 的网络。
安装
在 SourceWeft 中
- 打开 控制台中的 Tinify image tools,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
@tinify-dev/mcp
MCP (Model Context Protocol) server for the Tinify.dev image API. Lets ChatGPT, Claude, Cursor, and other MCP clients compress, resize, crop, and convert images — with honest results.
- Never lies about savings — when the API cannot shrink a file it says so (
optimized: false) instead of writing a byte-identical "optimized" copy. - Never overwrites your originals silently — results go to
<name>.min.<ext>beside the input, or to an explicitoutput_path. Replacing a file requiresoverwrite: true. - Raw numbers in
structuredContenton every call, so agents can do math instead of parsing prose.
Not affiliated with TinyPNG. This server talks to the Tinify.dev API.
Requirements
- Node.js >= 20
- A Tinify.dev API key from tinify.dev/developers — free tier is 500 operations/month, no card required.
Setup
Claude Desktop
Add to claude_desktop_config.json (Settings → Developer → Edit Config):
Claude Code
Cursor
Create .cursor/mcp.json in your project (or ~/.cursor/mcp.json globally):
Remote server (hosted)
The same five tools are available as a hosted streamable-HTTP MCP server - no install, works from ChatGPT connectors, the claude.ai directory, and any registry that expects a URL:
Two ways to authenticate:
- OAuth (for connectors) - ChatGPT connectors and the claude.ai directory only speak "OAuth" or "no auth". Add the server by its URL (
https://api.tinify.dev/mcp) and pick OAuth; the client discovers the authorization and token endpoints automatically from the server's.well-knownmetadata, registers itself, and opens a Connect Tinify page where you paste your Tinify API key. Your key stays the credential - the client only ever holds an opaque token that maps back to it server-side. - Direct bearer (for scripts/CLIs) - send
Authorization: Bearer tnf_live_...(ortnf_test_...) and skip OAuth entirely. Unchanged.
ChatGPT developer-mode connection
-
In ChatGPT, open Settings → Security and login and enable Developer mode.
-
Open ChatGPT Plugins, select the plus button, and add
https://api.tinify.dev/mcp. -
Complete Connect Tinify with a Tinify API key.
-
Add the connection from the conversation's tools menu, attach a PNG/JPEG/WebP/AVIF, and ask:
The hosted server cannot access local paths, so each image tool accepts exactly one of:
image— the ChatGPT attachment object. ChatGPT fills this automatically because the descriptor advertisesopenai/fileParams.image_base64— a portable fallback for other MCP clients, capped at ~28 MB decoded.
ChatGPT attachment downloads are HTTPS-only, reject private/reserved network targets and redirects, time out after 30 seconds, and are capped at the Tinify API's 40 MB limit. Successful operations return exact byte metrics and a temporary MCP result link. Existing base64 callers also receive structuredContent.image_base64 for backwards compatibility. get_usage is identical to the local version. Nothing is written to the user's filesystem.
Try it with curl:
For local files, prefer the stdio server above - it reads and writes them directly with no base64 round-trip and no 28 MB cap.
One server, two transport adapters
This repository intentionally supports both OpenAI and Claude:
- The shared tool names, Tinify client, result metrics, errors, and annotations are platform-neutral.
- The stdio adapter uses absolute local paths and writes files for desktop/CLI clients such as Claude, Cursor, and Codex.
- The hosted adapter uses ChatGPT file attachments or base64 and returns temporary result links because hosted servers cannot read a user's filesystem.
An OpenAI-only repository would duplicate the Tinify logic and make behavior drift more likely. OpenAI-specific descriptor metadata stays as a small additive layer in the hosted adapter; a separate repository is not needed.
For public OpenAI submission, set the portal-provided domain token as
OPENAI_APPS_CHALLENGE_TOKEN in /etc/tinify/mcp-http.env and deploy the
matching nginx location from deploy/nginx-location.conf. The endpoint returns
only that token at /.well-known/openai-apps-challenge; do not commit the real
portal token.
Tools
All image tools require absolute paths (MCP servers run with an unpredictable working directory) and pre-check the 40 MB API limit locally. API errors come back as readable tool errors with the error code and request_id to quote to support.
Example prompts
- "Compress every PNG in /Users/me/site/static/img"
- "Resize /Users/me/photo.jpg to 1200px wide and tell me how many bytes it saved"
- "Convert /Users/me/hero.png to webp with best quality"
- "How many Tinify operations do I have left this month?"
Limits and privacy
- Max 40 MB / 50 MP per image; PNG, JPEG, WebP, AVIF.
- Uploaded images and results are deleted from Tinify.dev servers after 2 hours.
- The server only reads the files you point it at and only writes where it tells you it wrote.
Troubleshooting
- "TINIFY_API_KEY is not set" — the server exits at startup with the exact config snippet to fix it. Add the key to the
envblock of your MCP config. invalid_api_key— the key is wrong or revoked; create a new one at tinify.dev/developers.quota_exhausted(429) — the monthly quota is used up; runget_usageto see the period end.- "path must be absolute" — pass full paths like
/Users/you/img.png, not./img.png. - Logs go to stderr; in Claude Desktop see
~/Library/Logs/Claude/mcp-server-tinify.log.
Roadmap
- Batch tools (create/commit/wait/download) on top of the durable batch API — not in v1.
License
MIT © Stian Larsen
One-click / one-line installs
Cursor: Add to Cursor - then set your real key in Cursor's MCP settings.
VS Code:
Codex CLI:
or in ~/.codex/config.toml:
Claude Code plugin (MCP + image-optimization skill):
More: https://tinify.dev/mcp
来源:README.md,提交 957bc95
工具
0版本历史
1- v0.1.7最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分