AI Gateway and AI SDK Integration
Introducing x402-mcp: Open protocol payments for MCP tools

Introducing x402-mcp: Open protocol payments for MCP tools

9/12/2025

What this post added

Introduced the x402 open protocol for programmatic payments in AI applications, enabling agents to autonomously discover and interact with paid external services via HTTP requests using the 402 Payment Required status code. Developed `x402-mcp` to integrate x402 payments with Model Context Protocol (MCP) servers and the Vercel AI SDK, including `paymentMiddleware` for API routes and `withPayment` wrappers for MCP clients. The protocol is payment-network agnostic, with current implementations using USDC on the Base blockchain. A starter template demonstrates x402 integration with Next.js, AI SDK, AI Elements, and AI Gateway.

Read the original post ↗