baconservices-mcp is an MCP (Model Context Protocol) server that lets AI agents invoke the image processing tools provided by Bacon Services on demand, paying per use in USDC on the Base network via the x402 protocol. It requires no account or API keys; when an agent calls a tool, the server first checks the price against the user-configured spending limits, then signs a USDC payment for the exact amount and returns the processing result.
Main capabilities include: remove_background (background removal), optimize_image (image optimization), vectorize_image (vectorization), image_palette (palette extraction), brand_from_url (brand extraction from URL), page_metadata (page metadata), accessibility_check (accessibility check), and clean_svg (SVG cleanup). The image tools accept PNG, JPEG, or WebP formats, up to 8 MB, and can be passed via image_url (a public https address) or image_path (a local file). remove_background, optimize_image, and vectorize_image return signed download links valid for 24 hours; image_palette, brand_from_url, page_metadata, accessibility_check, and clean_svg return JSON directly in the tool results. The save_to parameter can be used to write results to disk. JSON results larger than 256 KB are not displayed directly and must be saved using save_to. Prices come from Bacon's live catalog, and each paid tool notes its current price in its description.
Usage: Node.js 20 or higher is required. Prepare a dedicated wallet with USDC on the Base network; ETH is not needed, because x402 payments are signed authorizations (EIP-3009) with gas paid by the facilitator. Place the private key in a file readable only by yourself (such as ~/.bacon/buyer.key), via BACON_WALLET_KEY_FILE The environment variable points to this file; BACON_WALLET_PRIVATE_KEY can also be used. Configure the same command/args/env block in MCP clients such as Claude Desktop, Cursor, Windsurf, and VS Code, or run npx -y baconservices-mcp directly as a stdio server. You can use list_services to view currently available services and prices, quote to get a quote, and wallet_status to view wallet and limit status.
Fund protection mechanisms: before payment, it verifies whether the price equals Bacon's real-time catalog price, whether the receiving address matches, and whether the network is Base USDC; it checks the per-transaction limit, the optional max_price_usdc, the session limit, and the 24-hour limit. The 24-hour total is recorded in a local ledger, and restarting the server does not reset the budget; it reads the USDC balance and does not sign if the balance is insufficient or cannot be read; where supported, it requests user confirmation for payment; for each purchase it signs the payment only once, and if the connection is interrupted it resends the same signed payment once; repeated requests within 10 minutes return the previous result and are free (unless allow_repeat: true is passed); it only runs known services, and new services can only be called after the package version is updated. If Bacon rejects the payment before receiving funds, the result will state that no charge was made and the limit will be returned; if the result is unknown, a request ID will be provided, and that amount will still count toward the limit.
Use cases: scenarios that need to provide pay-per-use image processing capabilities for AI agents and want to avoid account systems and API key management. Limitations: only Base network USDC payments are supported; you need to manage the wallet and private key yourself; some tools are only available after the Bacon catalog publishes the contract version; JSON results larger than 256 KB need to be saved to disk; production environments use only real USDC, and testing must target a local or test version of Bacon on Base Sepolia. This MCP client is MIT-licensed open-source software, but Bacon Services' hosted API, x402 services, and backend implementation are not covered by the MIT license, and use is subject to the Bacon Services terms.