chileung69/minifypics
If you are the rightful owner of minifypics and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
MinifyPics MCP is a server that integrates with the MinifyPics API to optimize images efficiently while maintaining their quality.
MinifyPics MCP
A Model Context Protocol (MCP) server for Cline that enables image optimization while maintaining quality. This MCP integrates with the MinifyPics API to provide efficient image compression without significant quality loss.
🌟 Features
- Efficient Image Optimization: Reduce image file sizes while maintaining visual quality
- Multiple Format Support: Works with JPEG, PNG, GIF, and WebP images
- Simple Integration: Easy to install and integrate with Cline
- Detailed Statistics: Get comprehensive information about size reduction and savings
- Flexible Output Options: Save optimized images to custom locations or replace originals
- Batch Processing: Process multiple images in sequence
📋 Requirements
- Node.js 14.x or higher
- npm 6.x or higher
- MinifyPics API key (obtain from https://minifypics.plogie.com/)
🚀 Installation
Automatic Installation
The easiest way to install is using the provided installation script:
-
Clone this repository:
git clone https://github.com/yourusername/minifypics-mcp.git cd minifypics-mcp -
Run the installation script:
node install.js -
Follow the prompts to:
- Install dependencies
- Configure your API key
- Set up output directory (optional)
- Configure logging level
The script will provide instructions for integrating with Cline and testing your installation.
Manual Installation
If you prefer to install manually:
-
Clone this repository:
git clone https://github.com/yourusername/minifypics-mcp.git cd minifypics-mcp -
Install dependencies:
npm install -
Copy the example config file:
cp config.example.js config.js -
Edit
config.jsto add your API key and customize settings. -
Start the server:
npm start
🔌 Integration with Cline
There are two ways to integrate this server with Cline:
Option 1: Direct Express Server Integration
This option starts the Express server directly:
{
"mcpServers": {
"minifypics": {
"command": "node",
"args": ["/absolute/path/to/minifypics/src/index.js"],
"env": {
"PORT": "3000",
"API_KEY": "your-api-key-here"
},
"disabled": false
}
}
}
Replace /absolute/path/to/minifypics with the actual absolute path to this repository on your system. The installation script will provide you with the correct path.
Option 2: MCP Wrapper Integration (Recommended)
This option uses the MCP wrapper, which provides a more seamless integration with Cline's MCP protocol:
{
"mcpServers": {
"minifypics": {
"command": "node",
"args": ["-e", "require('/absolute/path/to/minifypics/mcp-wrapper.js')"],
"env": {
"API_KEY": "your-api-key-here"
},
"disabled": false
}
}
}
Replace /absolute/path/to/minifypics with the actual absolute path to this repository on your system. The installation script will provide you with the correct path.
🛠️ Usage
Once integrated with Cline, you can use the minify_image tool directly:
<use_mcp_tool>
<server_name>minifypics</server_name>
<tool_name>minify_image</tool_name>
<arguments>
{
"imagePath": "/path/to/your/image.jpg",
"outputPath": "/path/to/output/image.jpg",
"replaceOriginal": false
}
</arguments>
</use_mcp_tool>
Parameters
imagePath(required): Path to the image file you want to minifyoutputPath(optional): Path where the minified image should be saved. If not provided, the minified image will be saved in the same directory as the original with "-minified" added to the filename.replaceOriginal(optional): Boolean indicating whether to replace the original image with the minified version. Default isfalse. If set totrue, the original image will be replaced only if the minified version is smaller.
Response
The tool returns an object with the following properties:
{
"success": true,
"originalPath": "/path/to/your/image.jpg",
"minifiedPath": "/path/to/save/minified-image.jpg",
"originalSize": 1024000,
"minifiedSize": 512000,
"savingsPercent": 50.00,
"replaced": false,
"message": "Image successfully minified and saved to: /path/to/save/minified-image.jpg"
}
🧪 Testing
Download a Test Image
node download-test-image.js
Test the Express Server
node test.js [path-to-image] [--replace]
Options:
[path-to-image]: Optional path to the image file to minify[--replace]: Add this flag to replace the original image with the minified version
Test the MCP Wrapper
node test-mcp-wrapper.js [path-to-image] [--replace]
Options:
[path-to-image]: Optional path to the image file to minify[--replace]: Add this flag to replace the original image with the minified version
📚 Examples
Check out the examples directory for sample code showing how to use the MinifyPics server:
# Start the server
npm start
# In another terminal, run the example
node examples/minify-example.js [path-to-image] [output-path] [--replace]
📄 License
MIT
👤 Author
Your Name
🙏 Acknowledgements
- MinifyPics API for providing the image optimization service
- Cline for the Model Context Protocol framework