x402image
MCP · x402 · USDC on Base

Image tools your AI agent can
call and pay for, per use.

x402image is an MCP server of deterministic image-processing tools — remove background, AI upscale, resize, optimize. Your agent discovers them, pays a few cents per call over x402, and gets a finished image URL back. No account, no API key, no image library to install.

POST https://x402image.org/mcp Call service_info first — it's free.

Built for agents, not people

The customer here is another program. An AI agent maintaining a store's product photos has the recipe (which edits, what parameters) and the ingredients (an image URL) — but no kitchen (compute, image libraries). x402image is the kitchen: it takes the recipe, does the work, and hands back the plated result.

What comes back

Real output from the same Cloudflare Images AI transforms the paid tools use — no mockups. Your agent sends a source image URL and gets a finished image URL back.

remove_background $0.02 Subject isolated, background dropped to transparency.
A chair photographed in a room, before background removal Input · photo as shot
The same chair cut out, its background removed to transparency Output · alpha cutout (checkerboard = transparent)
upscale $0.02 Small source enlarged 4× by AI super-resolution, not interpolation.
A 233 by 263 pixel thumbnail of headphones, soft when enlarged Input · 233×263, shown enlarged
The same headphones after AI upscaling to 932 by 1052 pixels Output · 932×1052

Source photos are CC0 / public domain (Wikimedia Commons). resize and optimize are deterministic geometry and codec operations — no before/after needed, they hit the numbers you ask for.

It settles on-chain — go check

Our own first end-to-end runs on Base mainnet — real USDC, really settled — plus the registry entry agents discover this server through. Every link below is independently verifiable.

resize $0.005 settled · USDC on Base 0xc6f8…d697 on BaseScan
process $0.01 settled · resize + optimize, one payment 0x0eae…48b4 on BaseScan
org.x402image/image listed in the official MCP registry · v1.0.0, active registry entry

Tools & pricing

Each tool is independently priced per call. Prices below are reference values — the authoritative, live price and parameter schema always come from service_info and the 402 quote.

Tool Price What it does
remove_background $0.02 Isolate the subject and cut out the background (BiRefNet AI segmentation). Optional fill color, or a transparent cutout.
upscale $0.02 Enlarge with AI super-resolution (ESRGAN) for a sharper result at a target width and/or height.
resize $0.005 Resize or crop to an exact width/height, with fit and gravity controls (e.g. keep faces in frame).
optimize $0.005 Convert format (webp/avif/jpeg/png/gif) and/or compress to shrink file size at a chosen quality.
process dynamic Run an ordered pipeline of the ops above in a single paid call — one payment, one output. Price is the sum of the included ops.

How payment works

Pay per call, over x402

Call a paid tool without payment and you get an HTTP 402 with a machine-readable quote: price, currency, recipient, how to retry.

USDC on Base

Settlement is USDC on the Base network through a Coinbase CDP facilitator. No sign-up, no stored card, no invoice.

Pay first, work second

The image is processed only after settlement confirms. If the work fails, you are not charged. Output is a short-lived signed URL that expires and is deleted automatically.

Connect an agent

Point your MCP client at the endpoint

Send JSON-RPC over POST https://x402image.org/mcp. Any MCP-compatible agent works — no keys to provision.

Discover with service_info

The free service_info tool returns the current tool list, per-call prices, and how to pay. Read it before you spend.

Call a tool with an image URL

Pass a source image URL (https only; private/internal addresses are refused). Pay the 402 quote, receive the processed image URL.

# 1 — initialize, and keep the session id the server hands back.
#     Every later request must echo it in the mcp-session-id header.
SID=$(curl -sD - -o /dev/null https://x402image.org/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{
       "protocolVersion":"2025-06-18","capabilities":{},
       "clientInfo":{"name":"curl","version":"1.0"}}}' \
  | tr -d '\r' | awk 'tolower($1)=="mcp-session-id:"{print $2}')

# 2 — confirm the handshake.
curl -s https://x402image.org/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -H "mcp-session-id: $SID" \
  -d '{"jsonrpc":"2.0","method":"notifications/initialized"}'

# 3 — discover: free, no payment. Returns tools, live prices, how to pay.
curl -s https://x402image.org/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -H "mcp-session-id: $SID" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call",
       "params":{"name":"service_info","arguments":{}}}'

# 4 — a paid tool without payment answers with the 402 quote:
#     amount, asset, payTo, network. Pay it and repeat the call.
curl -s https://x402image.org/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -H "mcp-session-id: $SID" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{
       "name":"process","arguments":{
         "source":"https://example.com/product.jpg",
         "steps":[{"op":"remove_background","params":{"background":"white"}},
                  {"op":"resize","params":{"width":800}}]}}}'

Paste all four as-is — they run end to end. Steps 1 and 2 are the MCP handshake, which any MCP client does for you; skip them and the server answers -32000 Mcp-Session-Id header is required. The accept header must list both types — replies come back as server-sent events.