mcp

v0.0.5
@smallpict/mcp Checked 2 days ago Published 25 days ago

Official Model Context Protocol (MCP) server for SmallPict Image Optimization

Official Model Context Protocol (MCP) server for smallPict, the high-performance image optimization and AVIF/WebP transcoding platform. This MCP server equips AI coding assistants (such as Claude Desktop, Cursor, Windsurf, and Antigravity) with direct capabilities to compress, transcode, and maintain web image assets. 1. smallpict_optimize_image: - Compresses local image files or remote URLs to WebP or AVIF.

Summary extracted from the README.

@smallpict/mcp

Official Model Context Protocol (MCP) server for smallPict, the high-performance image optimization and AVIF/WebP transcoding platform.

This MCP server equips AI coding assistants (such as Claude Desktop, Cursor, Windsurf, and Antigravity) with direct capabilities to compress, transcode, and maintain web image assets.


Capabilities / Tools

  1. smallpict_optimize_image:
    • Compresses local image files or remote URLs to WebP or AVIF.
    • mode: lossy (default), extreme (smallest files), lossless (pixel-perfect) or auto (the server picks, per image, the lowest quality that keeps the visual score at or above 70, and ignores quality; WP Pro and Business, Velocity, Momentum and sandbox keys). The server checks the mode against your plan; a mode outside it returns the modes your plan allows.
    • quality (1-100, optional). Leave it out and the server picks the default for the mode: 80 for lossy, a default per output format for extreme. The server applies the minimum quality of each mode, so the quality used can be higher.
    • Example: ask the assistant to "optimize hero.jpg to AVIF with mode extreme", which calls smallpict_optimize_image with { "filePath": "hero.jpg", "format": "avif", "mode": "extreme" } and no quality. extreme gives the smallest files on every plan; leave quality out so the server uses its default for the output format; a quality you set is kept or raised to the format floor. Mode comparison: https://smallpict.app/en/docs/image-settings
    • lossless: true is deprecated: it is treated as mode: "lossless" when mode is not set, and combining it with another mode is a validation error.
    • Downscaling constraints: maxDimension (longest edge), maxWidth, and maxHeight.
    • Automatically writes the optimized image back to the workspace if outputPath is provided.
    • folder (optional, e.g. blog/2026): 1-3 segments of a-z, 0-9, - or _. The server lower-cases it and stores the file in that folder; the result shows the stored folder.
    • Outputs full telemetry: original size, compressed size, percentage saved (up to 85%), and the mode and quality the server applied (mode_applied, quality_applied).
  2. smallpict_get_quota:
    • Inspects the account's active plan, processed bytes, and remaining monthly quota.
    • Shows the read-only capacity of the key's product when the server reports it: storage used/limit (plan + add-on blocks), CDN used/limit and status, booster balances (active or paused, and the lot that expires first), the unpaid-account state with its deletion date, the period end, and the dashboard link (manage_url). Members that do not apply are left out.
    • Read-only: boosters and storage are bought in the smallPict dashboard only; no tool buys anything.
  3. smallpict_purge_cdn_cache:
    • Invalidates cached asset URLs on Cloudflare Edge CDN PoPs globally.
    • purgeType: url (default, the listed urls), folder (one upload folder and its sub-folders) or all (every file of the account). folder and all purges are limited per hour by the server; the limit returns a tool error and is not retried.
    • On an account with BYO delivery the result says the purge was sent to your own CDN.
  4. Quota and capacity errors: a 402 or 409 capacity error from smallpict_optimize_image or smallpict_purge_cdn_cache returns a tool error with the server's reason and the dashboard link (upgrade_url) where capacity is added. The link is shown, never opened.

Installation & Setup

The server runs with npx, so there is nothing to install or build. It needs Node.js 18 or later and an API/SDK key with its secret key from the smallPict dashboard: the free sandbox key (sp_test_...) or a production key (sp_sdk_...). WordPress plugin keys (sp_wp_...) are refused.

1. Configure in Claude Desktop

Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "smallpict": {
      "command": "npx",
      "args": ["-y", "@smallpict/mcp"],
      "env": {
        "SMALLPICT_API_KEY": "sp_sdk_...",
        "SMALLPICT_SECRET_KEY": "sps_..."
      }
    }
  }
}

2. Configure in Cursor (~/.cursor/mcp.json)

{
  "mcpServers": {
    "smallpict": {
      "command": "npx",
      "args": ["-y", "@smallpict/mcp"],
      "env": {
        "SMALLPICT_API_KEY": "sp_sdk_...",
        "SMALLPICT_SECRET_KEY": "sps_..."
      }
    }
  }
}

Guides for Windsurf, Antigravity, OpenCode and other clients: smallpict.app/en/docs/mcp.

3. Build from source (for development)

git clone https://github.com/smallPict/smallpict-mcp.git
cd smallpict-mcp
npm install
npm run build

Then point your client at the build instead of npx: "command": "node" and "args": ["/absolute/path/to/smallpict-mcp/dist/index.js"].


Environment Variables

  • SMALLPICT_API_KEY (Required): Your API key (sp_sdk_... or sandbox evaluation key sp_test_...).
  • SMALLPICT_SECRET_KEY (Required): Your API secret key (sps_...). Every request is signed with it; without it every tool call fails.
  • SMALLPICT_BASE_URL (Optional): API endpoint URL (default: https://api.smallpict.app).
  • SMALLPICT_WAIT_TIMEOUT_MS (Optional): how long smallpict_optimize_image waits for the job to finish (default 120000). A job still running after that is a tool error naming the job id.
  • SMALLPICT_POLL_INTERVAL_MS (Optional): how often the job status is polled while waiting (default 1000).