Labsco
mhe8mah logo

WebP Batch Converter

β˜… 6

from mhe8mah

Batch convert PNG, JPG, and JPEG images to WebP format with options for quality, lossless mode, and multi-threaded processing.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeQuick setup

WebP Batch Converter

A Model Context Protocol (MCP) server for batch converting images to WebP format with cross-platform support. Works seamlessly with MCP-aware IDEs like Cursor.

<a href="https://glama.ai/mcp/servers/@mhe8mah/webp-batch-mcp"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@mhe8mah/webp-batch-mcp/badge" alt="WebP Batch Converter MCP server" /> </a>

🌟 Features

  • πŸ–ΌοΈ Batch conversion of PNG, JPG, and JPEG files to WebP
  • 🌍 Cross-platform support (macOS, Linux, Windows)
  • ⚑ Multi-threaded processing for fast conversions
  • πŸŽ›οΈ Flexible options including quality control, lossless mode, and metadata preservation
  • πŸ“Š Detailed reporting with file sizes and savings statistics
  • πŸ”§ Dual engine support - prefers Google's cwebp, falls back to Sharp
  • 🎯 MCP integration for use in AI-powered development environments

βš™οΈ How to Add This Server in Cursor

  1. Clone and build the project:
Copy & paste β€” that's it
git clone https://github.com/mhe8mah/webp-batch-mcp.git
cd webp-batch-mcp
npm install
npm run build
  1. Open Cursor Settings
  2. Navigate to Features β†’ MCP
  3. Add a new server configuration:
Copy & paste β€” that's it
{
  "mcpServers": {
    "webp-batch": {
      "command": "node",
      "args": ["/path/to/webp-batch-mcp/dist/server.js"]
    }
  }
}
  1. Restart Cursor
  2. The convert_to_webp tool will be available in your AI conversations

πŸ”§ Technical Details

Conversion Strategy

  1. Primary Engine: Google's cwebp tool (included in libwebp-tools)

    • Fastest performance
    • Best compression
    • Full feature support
  2. Fallback Engine: Sharp (Node.js)

    • Pure JavaScript implementation
    • No external dependencies
    • Cross-platform compatibility

Output Behavior

  • Default: Creates .webp files alongside originals
  • Overwrite mode: Replaces originals with WebP versions
  • Flat mode: Outputs all WebP files to specified directory
  • Metadata preservation: Maintains EXIF and ICC profiles when requested

Performance

  • Utilizes all CPU cores by default
  • Processes images concurrently using p-limit
  • Provides real-time progress feedback
  • Reports detailed conversion statistics

πŸ› οΈ Development

Building

Copy & paste β€” that's it
npm run build

Testing

Copy & paste β€” that's it
npm test

Development Mode

Copy & paste β€” that's it
npm run dev

πŸ“Š Test Results

Verified with real web images:

  • JPEG (35KB β†’ 17KB): 51% space savings
  • PNG (7.9KB β†’ 2.8KB): 65% space savings
  • Overall: 53% average compression

πŸ“‹ Dependencies

Runtime

  • @modelcontextprotocol/sdk - MCP server framework
  • sharp - Image processing fallback
  • chalk - Colorized terminal output
  • commander - CLI argument parsing
  • glob - File pattern matching
  • p-limit - Concurrency control

Development

  • typescript - Type safety
  • tsup - Fast TypeScript bundler
  • jest - Testing framework

πŸ“„ License

MIT License - see LICENSE file for details.

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

πŸ†˜ Support

For issues and feature requests, please use the GitHub issue tracker.