minifypics

chileung69/minifypics

3.1

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 henry@mcphub.com.

MinifyPics MCP is a server that integrates with the MinifyPics API to optimize images efficiently while maintaining their quality.

MinifyPics MCP

MinifyPics MCP License Node.js

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

๐Ÿš€ Installation

Automatic Installation

The easiest way to install is using the provided installation script:

  1. Clone this repository:

    git clone https://github.com/yourusername/minifypics-mcp.git
    cd minifypics-mcp
    
  2. Run the installation script:

    node install.js
    
  3. 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:

  1. Clone this repository:

    git clone https://github.com/yourusername/minifypics-mcp.git
    cd minifypics-mcp
    
  2. Install dependencies:

    npm install
    
  3. Copy the example config file:

    cp config.example.js config.js
    
  4. Edit config.js to add your API key and customize settings.

  5. 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 minify
  • outputPath (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 is false. If set to true, 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