mochify-cli
High-performance Rust CLI & MCP Server for bulk image compression (AVIF, WebP, JXL, HEIC). Native speed, privacy-first, and AI-agent ready.
Documentation
mochify-cli
A command-line tool and MCP server for mochify.app — a fast, privacy-first image compression and conversion API powered by a native C++ engine.
Compress and convert images to modern formats (AVIF, JXL, WebP, Jpegli) from your terminal, or give AI assistants like Claude direct access to image processing via the Model Context Protocol.
Installation
macOS (Homebrew):
brew tap getmochify/mochify
brew install mochifyWindows (Scoop):
scoop bucket add mochify https://github.com/getmochify/scoop-mochify
scoop install mochifyLinux / WSL:
# x86_64
curl -L https://github.com/getmochify/mochify-cli/releases/latest/download/mochify-linux-x86_64 -o mochify
chmod +x mochify
sudo mv mochify /usr/local/bin/
# arm64
curl -L https://github.com/getmochify/mochify-cli/releases/latest/download/mochify-linux-arm64 -o mochify
chmod +x mochify
sudo mv mochify /usr/local/bin/Cargo (all platforms):
cargo install mochifyRequires Rust. Easiest option on Linux/WSL if you already have the toolchain.
Manual: All binaries at Releases.
From source:
cargo install --path .Authentication
Sign in with your mochify.app account to unlock your full quota:
mochify auth loginThis opens your browser, where you sign in and authorize the CLI. Credentials are saved automatically to `~/.config/mochify/credentials.toml` — no environment variables or manual key copying required. Both the CLI and MCP server pick them up automatically.
mochify auth status # check whether you're signed in
mochify auth logout # remove saved credentialsWithout an account you get 3 images per batch (IP-based). With a free account: 25 images/month. Sign up at mochify.app.
CLI Usage
mochify [OPTIONS] ...Options
| Flag | Description |
|---|---|
| `-t, --type ` | Output format: `jpg`, `png`, `webp`, `avif`, `jxl` |
| `-w, --width ` | Target width in pixels |
| `-H, --height ` | Target height in pixels |
| `--crop` | Crop to exact dimensions (saliency-guided) |
| `-r, --rotation ` | Rotation: `0`, `90`, `180`, `270` |
| `-o, --output ` | Output directory (default: same as input) |
| `-n, --name ` | Base name for the output file (without extension) |
| `--clarity` | Apply clarity (midtone contrast enhancement — crisper, more detailed look) |
| `-p, --prompt ` | Natural-language prompt — resolves all params automatically |
| `-k, --api-key ` | API key override (or set `MOCHIFY_API_KEY` env var) |
Examples
# Convert to AVIF
mochify photo.jpg -t avif
# Resize and convert to WebP
mochify photo.jpg -t webp -w 800
# Batch convert a folder to AVIF at 1200px wide
mochify ./images/*.jpg -t avif -w 1200 -o ./compressed
# Natural-language prompt — let the AI pick the right params
mochify photo.jpg -p "convert to avif, 1200px wide"
mochify photo.jpg -p "optimise for eBay"
mochify photo.jpg -p "remove background and convert to WebP"
mochify photo.jpg -p "resize to 50%, strip EXIF, keep as WebP"
# Custom output name
mochify photo.jpg -t webp -n hero
mochify product.jpg -p "optimise for Shopify" -n product-main
# Pipe file paths from stdin
find . -name "*.jpg" | mochify -t webp -o ./out
cat images.txt | mochify -p "convert to avif 1200px wide" -o ./compressed
ls *.heic | mochify -t jpgOutput file naming
By default, when the output format and directory match the input, the result is saved as `{name}_mochified.{ext}` so it's always clear something happened. If that file already exists, a numeric suffix is added (`_1`, `_2`, etc.). When the format changes (e.g. `.jpg` → `.webp`), the extension change is already unambiguous so no suffix is added.
Use `-n, --name` to set an explicit base name: `mochify photo.jpg -t webp -n hero` saves `hero.webp`. The prompt path also supports this: `mochify *.jpg -p "optimise for Shopify, name them product"` will produce `product.webp`, `product_1.webp`, etc.
PDF processing
PDFs are detected automatically by the `.pdf` extension. You can split a PDF into one file per page, or rasterize its pages to images. The result is saved as a `.zip` next to the input. (PDFs and images can't be mixed in a single command — run them separately.)
| Flag | Description |
|---|---|
| `--op ` | `split` (one PDF per page) or `rasterize` (pages → images) |
| `-t, --type ` | Rasterize output format: `png`, `jpg`, `webp` (default `png`) |
| `--dpi ` | Rasterize resolution in DPI (default `150`) |
| `-q, --quality ` | Rasterize quality `1–100` for lossy formats (jpg/webp) |
# Split a PDF into per-page PDFs
mochify document.pdf --op split
# Rasterize pages to PNG at 150 DPI
mochify document.pdf --op rasterize -t png --dpi 150
# High-res JPEGs for print
mochify document.pdf --op rasterize -t jpg --dpi 300 -q 90
# Or describe it in natural language
mochify document.pdf -p "split into pngs"
mochify report.pdf -p "rasterize to high-res jpegs"MCP Server (Claude Desktop)
`mochify` can run as an MCP server, letting Claude process images on your behalf directly from conversation.
Setup
Run `mochify auth login` first, then add the following to your Claude Desktop config at `~/Library/Application Support/Claude/claude_desktop_config.json`:
{
"mcpServers": {
"mochify": {
"command": "mochify",
"args": ["serve"]
}
}
}Restart Claude Desktop. The mochify server will appear in your connections and use your saved credentials automatically.
Usage
Describe what you want in natural language with the full path to your image:
> "Convert `/Users/me/Desktop/photo.jpg` to AVIF at 1000px wide"
> "Compress all the JPEGs in `/Users/me/projects/blog/images/` to WebP and save to `/Users/me/projects/blog/compressed/`"
> "Optimise `/Users/me/Desktop/product.jpg` for eBay"
> "Remove the background from `/Users/me/Desktop/shirt.png` and save as WebP"
> "Rasterize `/Users/me/Desktop/report.pdf` to PNGs at 200 DPI"
Claude calls the `squish` tool for images and the `pdf` tool for PDFs automatically, and reports back the saved path and file size.
API
Powered by `https://api.mochify.app` — `/v1/squish` for images and `/v1/pdf` for PDF split/rasterize. Files are processed in-memory and never written to disk.
| Plan | Ops/month | Max file size |
|---|---|---|
| Free (no account) | 3/batch | 20 MB |
| Free (with account) | 25 | 20 MB |
| Seller ($7.99/mo) | 300 | 75 MB |
| Pro ($24.99/mo) | 1,200 | 75 MB |
Visit mochify.app for the web interface, pricing, and API docs.
Frequently asked questions
What is mochify-cli?
mochify-cli is High-performance Rust CLI & MCP Server for bulk image compression (AVIF, WebP, JXL, HEIC). Native speed, privacy-first, and AI-agent ready.
How do I install mochify-cli?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is mochify-cli open source?
Yes — it is hosted on GitHub at https://github.com/getmochify/mochify-cli and has 1 stars.
Related MCP tools
Fast, local-first web content extraction for LLMs. Scrape, crawl, extract structured data — all from Rust. CLI, REST API, and MCP server.
an open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM
Search infrastructure for AI
YC (S26) | Open Computer History | Record your screen continuously locally and provide context to your agents (Claude, Codex, Openclaw, Hermes, Runner...)
The fastest and the most accurate file search SDK for AI agents, Neovim, Rust, C, Python, Bun and NodeJS
Semantic version control => entity-level diffs, blame, and impact analysis on top of git. 28 languages via tree-sitter. Built for coding agents.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP