SmallPict LogoSmallPict

Model Context Protocol (MCP)

Connect SmallPict image optimization tools directly to AI Agents: Claude Desktop, Cursor, Google Antigravity, OpenCode, Codex, Windsurf, and custom AI workflows.

SmallPict Model Context Protocol (MCP) Server

The SmallPict MCP Server (@smallpict/mcp) implements the open Model Context Protocol standard, giving Large Language Models (LLMs) and autonomous AI coding agents native tools to inspect, compress, convert, and manage web assets directly within their workflow.

Interactive Architecture Flowchart

End-to-End Image Processing & Edge CDN Flow

Sub-50ms image optimization lifecycle from client upload to Cloudflare Enterprise edge delivery.

Origin Request

Client Application

WordPress / SDK / API

Uploads raw image binary with HMAC-SHA256 signature and UUID v4 idempotency key.

Phase 1 Ready
Cache & Delivery

Cloudflare Edge CDN

Global Edge PoPs

Checks global edge cache. On cache HIT, delivers AVIF/WebP in <20ms worldwide.

Phase 2 Ready
Auth & Scoping

SmallPict Go Gateway

AWS Lambda / API Gateway

Validates HMAC credentials, verifies quota limits, and scopes access to customer_id.

Phase 3 Ready
Transcoding

libvips SIMD Worker

High-Speed C-Engine

Multi-threaded quantization transcode to AVIF & WebP with 0 visual loss and ~88% compression.

Phase 4 Ready
Persistent Sync

S3 Pipeline & Storage

Global Object Store

Stores optimized output, invalidates outdated cache tags, and hydrates Cloudflare Edge.

Phase 5 Ready
Zero Data Interception:End-to-end HMAC validation & SHA256 integrity check
Engine: libvips SIMD·Latency: <50ms

⚡ Key Highlights

  • Universal Multi-Agent Support: Compatible with Claude for Desktop, Cursor, Google Antigravity (AGY), OpenCode, Windsurf, Cline / Roo Code, Goose, and any MCP-compliant runtime.
  • Zero Local Compilation: Run instantly via npx -y @smallpict/mcp with Node.js 18+.
  • Secure by Design: Operates over standard input/output (stdio) with error logging strictly routed to stderr to prevent JSON-RPC stream corruption.
  • Dual Environment: Supports production API keys (sp_live_...) and free sandbox keys (sp_test_...) for zero-quota test operations.

🛠️ Available MCP Tools

Once installed, your AI agent automatically gains access to the following three high-performance tools:

1. smallpict_optimize_image

Compresses and converts local image files or remote URLs to next-generation formats (WebP, AVIF) with up to 88% size reduction.

ParameterTypeRequiredDescription
image_pathstringYesAbsolute or relative local file path, or public HTTP/HTTPS image URL.
target_formatstringNoTarget format: webp (default), avif, jpg, or png.
qualitynumberNoCompression quality from 1 to 100 (default: 80).
modestringNobalanced (default), aggressive, ultra, or lossless.
max_long_edge_pxnumberNoResize constraint: downscales image while maintaining original aspect ratio.
output_pathstringNoCustom local destination path (defaults to same folder with new extension).

2. smallpict_get_quota

Inspects your SmallPict account's active subscription tier, monthly bytes limit, and remaining bandwidth balance.

ParameterTypeRequiredDescription
(None)--Queries current quota telemetry using your API key.

3. smallpict_purge_cdn_cache

Instantly purges edge-cached images from Cloudflare Edge CDN after updating assets.

ParameterTypeRequiredDescription
urlsstring[]NoArray of specific image URLs or CDN relative paths to invalidate.
purge_allbooleanNoInvalidate all cached assets across the active domain (default: false).

🚀 Setup & Multi-Agent Configuration

1. Claude for Desktop

Add the smallpict server definition to your claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
JSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{  "mcpServers": {    "smallpict": {      "command": "npx",      "args": [        "-y",        "@smallpict/mcp"      ],      "env": {        "SMALLPICT_API_KEY": "sp_live_YOUR_API_KEY"      }    }  }}

Restart Claude Desktop, and you will see the hammer 🔨 tool icon active with SmallPict tools enabled.


2. Cursor IDE

Configure SmallPict MCP in Cursor globally or per-project:

Option A: Cursor Global Settings

  1. Open Cursor Settings (Cmd + , or Ctrl + ,).
  2. Navigate to Features → MCP Servers.
  3. Click + Add New MCP Server.
    • Name: smallpict
    • Type: command
    • Command: npx -y @smallpict/mcp
    • Environment Variables: SMALLPICT_API_KEY=sp_live_YOUR_API_KEY

Option B: Workspace Configuration (.cursor/mcp.json)

Create a file at .cursor/mcp.json in your project root:

JSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{  "mcpServers": {    "smallpict": {      "command": "npx",      "args": [        "-y",        "@smallpict/mcp"      ],      "env": {        "SMALLPICT_API_KEY": "sp_live_YOUR_API_KEY"      }    }  }}

3. Google Antigravity (AGY)

For developers using the Antigravity multi-agent coding environment, add the SmallPict MCP server to ~/.gemini/antigravity/mcp/smallpict/mcp.json or your workspace settings:

JSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{  "mcpServers": {    "smallpict": {      "command": "npx",      "args": [        "-y",        "@smallpict/mcp"      ],      "env": {        "SMALLPICT_API_KEY": "sp_live_YOUR_API_KEY"      }    }  }}

Antigravity subagents can now optimize project assets autonomously during build and frontend refactoring workflows.


4. VS Code (Cline / Roo Code)

In VS Code with the Cline or Roo Code extension:

  1. Open the Cline panel and click the MCP Servers icon.
  2. Select Configure MCP Servers (opens cline_mcp_settings.json).
  3. Add the server entry:
JSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{  "mcpServers": {    "smallpict": {      "command": "npx",      "args": [        "-y",        "@smallpict/mcp"      ],      "env": {        "SMALLPICT_API_KEY": "sp_live_YOUR_API_KEY"      },      "disabled": false,      "autoApprove": [        "smallpict_get_quota",        "smallpict_optimize_image"      ]    }  }}

5. Windsurf (Codeium)

Edit your Windsurf configuration at ~/.codeium/windsurf/mcp_config.json:

JSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{  "mcpServers": {    "smallpict": {      "command": "npx",      "args": [        "-y",        "@smallpict/mcp"      ],      "env": {        "SMALLPICT_API_KEY": "sp_live_YOUR_API_KEY"      }    }  }}

6. OpenCode, Codex & Custom AI Runners

For terminal-based agents (Goose, OpenCode, custom LangChain / LlamaIndex scripts), invoke @smallpict/mcp directly via standard input/output:

cURL / Shell
# Launch directly in your agent subprocessSMALLPICT_API_KEY"sp_live_YOUR_KEY" npx -y @smallpict/mcp

💬 Example AI Prompts

Once configured, you can talk naturally to your AI agent without writing manual scripts:

Batch Optimize Local Assets

"Agent, find all PNG and JPEG images inside public/images/, convert them to WebP at quality 80, and give me a summary table of how many bytes we saved."

Check Account Quota

"What is my remaining SmallPict quota this month before I start bulk optimizing hero assets?"

CDN Invalidation

"I just replaced hero-banner.jpg in S3. Please purge the SmallPict CDN cache for that asset."


🧪 Testing with Sandbox Keys

You can test without consuming your monthly transformation quota by using a Sandbox key:

JSON
"env": {  "SMALLPICT_API_KEY": "sp_test_sandbox_secret_key"}
  • Transforms images using the exact same production libvips engine.
  • Quota is tracked in an isolated sandbox pool with zero monthly deductions.
  • Assets are kept in ephemeral 24-hour test storage.