Integrates with Coinbase Developer Platform (CDP) API to verify cryptocurrency payments through the x402 payment protocol, enabling AI agents to access paid resources after payment confirmation.
Supports Ethereum network for cryptocurrency payments via x402 protocol, allowing payment verification for paid AI services using EVM-compatible wallet addresses.
Supports Polygon network as a payment option for x402 protocol transactions, enabling cryptocurrency payments for AI-accessed paid services.
x402-mcp-payment
This is an example project combining MCP (Model Context Protocol) and the x402 payment protocol. It demonstrates how to enable LLMs (such as ChatGPT, Claude) to access paid resources via the MCP protocol. After a user completes payment in the chat using a universal crypto wallet (supporting x402), the LLM can automatically retrieve and process the paid content.
Core Functionality: Empowering AI Agents with the ability to "pay for information".
User Interaction Flow
Service Request: The user requests a paid service in ChatGPT (e.g., "Give me a riddle").
Order Generation: The MCP Server generates a dynamic x402 payment link containing a unique
payidand returns it to the user.User Payment: The user clicks the link and pays the specified amount using a universal crypto wallet.
Status Recording: The x402 Server confirms the payment success and records the
payidas "paid".Service Delivery: The user continues the conversation in ChatGPT (e.g., "I have paid"), and the AI automatically verifies the payment status and retrieves the service content.
Interaction Diagram
Prerequisites
Node.js (v18+)
Coinbase Developer Platform (CDP) API Key (for x402 payment verification)
Quick Start
1. Install Dependencies
2. Configure Environment Variables
Create a .env file in the project root directory and fill in your Coinbase API keys:
3. Configuration File (Optional)
Modify config.yaml to customize server ports, payment address, price, and riddle content.
4. Start Service
This project requires running two separate processes:
MCP Server - Deployed at
mcp.mydomain.com(port 3000)x402 Payment Server - Deployed at
x402.mydomain.com(port 3001)
Development Mode (Supports hot reload):
Production Mode:
5. Configure ChatGPT
To use this service in ChatGPT:
Open ChatGPT (web or app)
Go to Settings → App & Connectors (or similar MCP configuration section)
Add a new MCP server:
https://mcp.mydomain.comNow you can interact with paid riddles directly in ChatGPT!
Note: Currently requires a ChatGPT Pro, Plus, Team, or Education account to access MCP integration features.
This server cannot be installed