Batch convert PNG, JPG, and JPEG images to WebP format with options for quality, lossless mode, and multi-threaded processing.
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.
npm install -g webp-batch-mcp
git clone https://github.com/mhe8mah/webp-batch-mcp.git
cd webp-batch-mcp
npm install
npm run build
docker build -t webp-batch .
docker run -v /path/to/images:/data webp-batch
node dist/cli.js [options]
--src <dir>
- Source directory to scan (default: current directory)--quality <0-100>
- WebP quality setting (default: 75)--lossless
- Use lossless encoding (recommended for PNG)--overwrite
- Replace original files with WebP versions--threads <n>
- Number of concurrent conversions (default: CPU count)--preserve-meta
- Preserve EXIF and ICC metadata--flat <dir>
- Output all WebP files to specified directory# Convert all images in current directory
node dist/cli.js
# High quality conversion of specific directory
node dist/cli.js --src ./photos --quality 95 --preserve-meta
# Lossless conversion with overwrite
node dist/cli.js --src ./images --lossless --overwrite
# Batch process to output directory
node dist/cli.js --src ./input --flat ./output --threads 8
The MCP server exposes a single tool: convert_to_webp
{
"src": "string", // Source directory (default: ".")
"quality": "number", // Quality 0-100 (default: 75)
"lossless": "boolean", // Lossless mode (default: false)
"overwrite": "boolean", // Replace originals (default: false)
"threads": "number", // Concurrent threads (default: CPU count)
"preserveMeta": "boolean", // Keep metadata (default: false)
"flat": "string" // Output directory (optional)
}
git clone https://github.com/mhe8mah/webp-batch-mcp.git
cd webp-batch-mcp
npm install
npm run build
{
"mcpServers": {
"webp-batch": {
"command": "node",
"args": ["/path/to/webp-batch-mcp/dist/server.js"]
}
}
}
convert_to_webp
tool will be available in your AI conversationsPrimary Engine: Google's cwebp
tool (included in libwebp-tools)
Fallback Engine: Sharp (Node.js)
.webp
files alongside originalsnpm run build
npm test
npm run dev
Verified with real web images:
@modelcontextprotocol/sdk
- MCP server frameworksharp
- Image processing fallbackchalk
- Colorized terminal outputcommander
- CLI argument parsingglob
- File pattern matchingp-limit
- Concurrency controltypescript
- Type safetytsup
- Fast TypeScript bundlerjest
- Testing frameworkMIT License - see LICENSE file for details.
For issues and feature requests, please use the GitHub issue tracker.
Convert files between various formats, including images, documents, audio, video, and more.
Secure file operations with configurable access controls
Securely browse and read files within an Android project, with built-in validation and access controls for sensitive directories.
Parses various file formats using the 302.AI API, requiring a 302AI_API_KEY.
A secure server for filesystem operations with controlled access to specified directories.
Fast Windows file search using Everything SDK