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.
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 global edge delivery.
- 01
Client Application
WordPress / SDK / API
Uploads raw image binary with HMAC-SHA256 signature and UUID v4 idempotency key.
Origin Request
- 02
smallPict Edge CDN
Global Edge PoPs
Checks global edge cache. On cache HIT, delivers AVIF/WebP in <20ms worldwide.
Cache & Delivery
- 03
SmallPict API Gateway
Authentication & Quotas
Validates HMAC credentials, verifies quota limits, and scopes access to customer_id.
Auth & Scoping
- 04
Optimization Engine
High-Speed Native Encoder
Multi-threaded quantization transcode to AVIF & WebP with no visible quality loss and much smaller files.
Transcoding
- 05
Secure Storage & Sync
Encrypted Cloud Storage
Stores optimized output, invalidates outdated cache tags, and warms the edge cache.
Persistent Sync
Zero Data Interception: End-to-end HMAC validation & SHA256 integrity check
Engine: smallPict
Overview
- Supported clients: Works with Claude for Desktop, Cursor, Google Antigravity (AGY), OpenCode, Windsurf, Cline / Roo Code, Goose, and any MCP-compliant runtime.
- No build step: Runs with
npx -y @smallpict/mcpon Node.js 18+. - stdio transport: Communicates over standard input/output. Logs go to
stderrso they never corrupt the JSON-RPC stream. - Production and sandbox: Accepts production keys (
sp_live_...) and sandbox keys (sp_test_...), which do not use quota.
Tools
Once the server is configured, your agent can use three tools:
1. smallpict_optimize_image
Compresses local image files or remote URLs and converts them to WebP or AVIF.
| 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
Returns your plan, monthly limit, and remaining quota.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (None) | - | - | Uses the quota of the account that owns the API key. |
3. smallpict_purge_cdn_cache
Purges cached images from the CDN after you update them.
| 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
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. The SmallPict tools then appear in the tools menu.
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 agents can then optimize project images as part of their tasks.
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/mcpExample prompts
Once configured, you can ask your agent in plain language:
Optimize local images
"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 quota
"What is my remaining SmallPict quota this month before I start bulk optimizing hero assets?"
Purge the CDN cache
"I just replaced
hero-banner.jpgon my site. 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"}- Images are processed by the same pipeline as production.
- Requests are tracked separately and do not use your monthly quota.
- Converted files are deleted after 24 hours.