Skip to content

getmochify/mochify-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mochify-cli

MCP Badge License: MIT

A command-line tool and MCP server for mochify.xyz — 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

Download the latest binary from Releases, or build from source:

cargo install --path .
cargo build --release
# binary at ./target/release/mochify

CLI Usage

mochify [OPTIONS] <FILES>...

Options

Flag Description
-t, --type <FORMAT> Output format: jpg, png, webp, avif, jxl
-w, --width <N> Target width in pixels
-H, --height <N> Target height in pixels
--crop Crop to exact dimensions
-r, --rotation <DEG> Rotation: 0, 90, 180, 270
-o, --output <DIR> Output directory (default: same as input)
-p, --prompt <TEXT> Natural-language prompt — resolves params automatically
-k, --api-key <KEY> API key (or set MOCHIFY_API_KEY env var)

Examples

# Convert a JPEG 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

# With an API key
MOCHIFY_API_KEY=your-key mochify photo.jpg -t jxl

# Use a natural-language prompt instead of explicit flags
mochify photo.jpg -p "convert to avif and resize to 1200px wide"

# Prompt works with multiple files too
mochify ./images/*.jpg -p "compress for web, keep under 1000px wide" -o ./out

Free usage is 25 images per day without an API key. Visit mochify.xyz for more.

MCP Server (Claude Desktop)

mochify can run as an MCP server, letting Claude process images on your behalf directly from conversation.

Setup

Add the following to your Claude Desktop config at ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "mochify": {
      "command": "/path/to/mochify-cli",
      "args": ["serve"],
      "env": {
        "MOCHIFY_API_KEY": "your-key-here"
      }
    }
  }
}

Restart Claude Desktop. The mochify server will appear in your connections.

Usage

Just 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 them to /Users/me/projects/blog/compressed/"

Claude will call the squish tool automatically.

API

Powered by the mochify.xyz API at https://api.mochify.xyz/v1/squish.

  • Images are processed in-memory and never stored on disk
  • Supports JPEG (Jpegli), AVIF, JXL, WebP, and PNG output
  • Up to 25MB per image

Visit mochify.xyz for the web interface.

About

High-performance Rust CLI & MCP Server for bulk image compression (AVIF, WebP, JXL, HEIC). Native speed, privacy-first, and AI-agent ready.

Topics

Resources

License

Stars

Watchers

Forks

Packages