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.
End-to-End Image Processing & Edge CDN Flow
Sub-50ms image optimization lifecycle from client upload to Cloudflare Enterprise edge delivery.
Client Application
WordPress / SDK / API
Uploads raw image binary with HMAC-SHA256 signature and UUID v4 idempotency key.
Cloudflare Edge CDN
Global Edge PoPs
Checks global edge cache. On cache HIT, delivers AVIF/WebP in <20ms worldwide.
SmallPict Go Gateway
AWS Lambda / API Gateway
Validates HMAC credentials, verifies quota limits, and scopes access to customer_id.
libvips SIMD Worker
High-Speed C-Engine
Multi-threaded quantization transcode to AVIF & WebP with 0 visual loss and ~88% compression.
S3 Pipeline & Storage
Global Object Store
Stores optimized output, invalidates outdated cache tags, and hydrates Cloudflare Edge.
⚡ 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/mcpwith Node.js 18+. - Secure by Design: Operates over standard input/output (
stdio) with error logging strictly routed tostderrto 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
image_path | string | Yes | Absolute or relative local file path, or public HTTP/HTTPS image URL. |
target_format | string | No | Target format: webp (default), avif, jpg, or png. |
quality | number | No | Compression quality from 1 to 100 (default: 80). |
mode | string | No | balanced (default), aggressive, ultra, or lossless. |
max_long_edge_px | number | No | Resize constraint: downscales image while maintaining original aspect ratio. |
output_path | string | No | Custom 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (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.
| Parameter | Type | Required | Description |
|---|---|---|---|
urls | string[] | No | Array of specific image URLs or CDN relative paths to invalidate. |
purge_all | boolean | No | Invalidate 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
{ "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
- Open Cursor Settings (
Cmd + ,orCtrl + ,). - Navigate to Features → MCP Servers.
- Click + Add New MCP Server.
- Name:
smallpict - Type:
command - Command:
npx -y @smallpict/mcp - Environment Variables:
SMALLPICT_API_KEY=sp_live_YOUR_API_KEY
- Name:
Option B: Workspace Configuration (.cursor/mcp.json)
Create a file at .cursor/mcp.json in your project root:
{ "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:
{ "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:
- Open the Cline panel and click the MCP Servers icon.
- Select Configure MCP Servers (opens
cline_mcp_settings.json). - Add the server entry:
{ "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:
{ "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:
# 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.jpgin 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:
"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.
