home / mcp / tinypng mcp server

TinyPNG MCP Server

🧙🏻 Integrated TinyPNG MCP server, quickly use TinyPNG through LLMs.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "aiyogg-tinypng-mcp-server": {
      "command": "bun",
      "args": [
        "/path/to/tinypng-mcp-server/src/index.ts"
      ],
      "env": {
        "TINYPNG_API_KEY": "your-tinypng-api-key"
      }
    }
  }
}

This TinyPNG MCP Server enables you to compress images through a dedicated MCP endpoint, turning local or remote image data into optimized outputs via the TinyPNG API key you provide. It’s useful when you want automated image optimization as part of a larger MCP workflow or client integration.

How to use

You connect to the TinyPNG MCP Server from an MCP client and request image compression through the server’s endpoints. The server accepts a local image path or a remote image URL, then returns a compressed image saved to your specified path, using the TinyPNG API under the hood. You’ll supply your API key via environment configuration so the server can authenticate with TinyPNG.

How to install

Prerequisites: you need either Bun or Node to run the server. You also need a valid TinyPNG API key to enable image compression.

pnpm i
pnpm build

Create or edit your MCP configuration file to define how the server should run. You must specify the command to run the server, the path to the entry file, and your TinyPNG API key in the environment.

{
  "mcpServers": {
    "tinypng": {
      "command": "bun", // or "node"
      "args": ["/path/to/tinypng-mcp-server/src/index.ts"], // or "dist/index.js"
      "env": {
        "TINYPNG_API_KEY": "your-tinypng-api-key"
      }
    }
  }
}

If you prefer to install the server automatically for a client like Claude Desktop via Smithery, run the following command to install the TinyPNG MCP Server with the appropriate client integration.

npx -y @smithery/cli install @aiyogg/tinypng-mcp-server --client claude

Additional notes

You can run the server either with Bun or Node by switching the command and keeping the same entry file path. Ensure the API key is kept secure and not exposed in public code or logs. The server exposes tools to compress local images and remote images, each requiring the appropriate input and output paths and an allowed output format.

Configuration and tools

The server provides two tools for image compression. You configure and call these through your MCP client by providing the necessary inputs and, for local outputs, absolute file paths.

Troubleshooting and notes

If you encounter authentication errors with TinyPNG, double-check that your TINYPNG_API_KEY is correct and that the key is loaded into the server’s environment. If you see file path errors for the input or output files, verify that absolute paths are used and that the process has permission to access those paths.

Security considerations

Keep your TinyPNG API key confidential. Do not commit the key in publicly accessible code. Use environment management or secret storage to inject the key at runtime.

Available tools

compress_local_image

Compress a local image file by providing the absolute input path and an absolute output path, optionally specifying the output format.

compress_remote_image

Compress an image from a remote URL and save it to a specified absolute output path, with an optional output format.