Optimize public image URLs via the ShortPixel SPIO API for AI agents
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Inspect callable tools, capabilities, and parameters exposed to AI agents by ShortPixel Image Optimizer.
optimize_image_urlsOptimize one or more public image URLs via SPIO reducer API
Public HTTP MCP server that exposes ShortPixel SPIO image optimization to AI agents (Cursor, Claude Desktop, VS Code, etc.).
Each request carries the user's own ShortPixel API key. The MCP server does not store user keys β it forwards them to the public SPIO API.
Edit .env for server settings (port, allowed hosts, upstream API URL). Do not put user API keys in server .env.
Endpoints:
| Path | Method | Description |
|---|---|---|
/health | GET | Health check (no API key) |
/ping | GET | Auth check β returns ok if API key header is present |
/mcp | POST | MCP Streamable HTTP endpoint |
Server up, no API key:
API key present (simple check):
Use http:// (not https://) on port 3000 unless TLS is configured on nginx.
MCP request (important: Streamable HTTP clients must accept both JSON and SSE):
Send the user's ShortPixel API key on every MCP request:
Alternative header:
Users without a key can get one at shortpixel.com.
Replace the URL with your deployed host during development (e.g. http://localhost:3000/mcp).
| Variable | Required | Default | Description |
|---|---|---|---|
PORT | no | 3000 | HTTP listen port |
ALLOWED_HOSTS | no | β | Comma-separated Host header allowlist (recommended in production) |
SHORTPIXEL_API_URL | no | https://api.shortpixel.com/v2 | Upstream SPIO API base URL |
SHORTPIXEL_PLUGIN_VERSION | no | MCP01 | Plugin version sent to SPIO |
LOG_LEVEL | no | info | Log verbosity: debug, info, warn, error |
LOG_FORMAT | no | text | text = human-readable lines; json = structured JSON |
LOG_MCP_PROTOCOL | no | true | Log inbound/outbound MCP JSON-RPC payloads |
For internal ShortPixel development, set SHORTPIXEL_API_URL=https://devapi2.shortpixel.com/v2.
Logs go to stdout (pm2 logs / npm start).
Default (LOG_FORMAT=text) β narrative flow you can follow:
LOG_MCP_PROTOCOL=false keeps only high-level app logs and hides MCP payload dumps.
Structured (LOG_FORMAT=json) β one JSON object per line:
| Event | When |
|---|---|
http_request | Every request (method, path, status, duration, MCP method/tool) |
spio_request | Outgoing call to SPIO reducer.php |
spio_response | SPIO result summary (status, % improvement) |
mcp_auth_missing | Request without API key |
API keys are masked (****abcd). Full keys are never logged.
Note: The chat prompt never reaches this server. The LLM (inside the MCP client) turns user text into a structured tools/call; the server only sees JSON-RPC arguments and maps them to the SPIO API.
Set LOG_LEVEL=debug for tools/list and extra HTTP lines.
Re-upload package.json and package-lock.json after each dependency change. If build still fails, run npm ci --include=dev (some servers set NODE_ENV=production which skips devDependencies).
| Tool | Description |
|---|---|
optimize_image_urls | Optimize one or more public image URLs via SPIO reducer API |
optimize_image_urls arguments:
urls (required): Public image URLs to optimize (max 100)lossy: Compression level (0 lossless, 1 lossy, 2 glossy)wait: Max wait seconds (0 to return immediately, 1-30 to wait)upscale: Upscale factor (0, 2, 3, 4)resize: Resize mode (0 none, 1 outer, 3 inner, 4 smart crop)resize_width, resize_height: Resize target dimensions in pixelscmyk2rgb: Convert CMYK to RGB (1 yes, 0 no)keep_exif: Keep EXIF metadata (1 keep, 0 remove)convertto: Conversion value (+webp, +avif, +webp|+avif, webp|avif, jpg, png, gif)bg_remove: Background removal (1, image URL, or #rrggbbxx)refresh: Force source refetch (1) or use cached optimized data (0)paramlist: Per-URL overrides array (must match urls length)returndatalist: Any array echoed back unchanged in response| Kind | Style | Example |
|---|---|---|
| Files | kebab-case | spio-api-client.ts |
| Classes | PascalCase | SpioApiClient |
| Methods | camelCase | optimizeUrls |
| Command | Description |
|---|---|
npm run build | Compile TypeScript to dist/ |
npm start | Run HTTP MCP server |
npm run dev | Run with tsx (no build step) |
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/shortpixel-image-optimizer)<a href="https://allmcps.com/mcp/shortpixel-image-optimizer"><img src="https://allmcps.com/api/badge/shortpixel-image-optimizer?style=directory" alt="ShortPixel Image Optimizer on AllMCPs" /></a>