Installation
Server Implementation
Basic Setup
Create a payment-aware MCP server that charges for tool invocations:Advanced Configuration
Client Implementation
Basic Setup
Create a client that automatically handles payments:Proxy Deployments
Client Proxy (CLI)
Run a client proxy to enable non-payment-aware clients (like Claude Desktop) to use payment-required servers:Claude Desktop Configuration
Add to your Claude Desktop config:Client Proxy (Programmatic)
Server Proxy
Monetize existing API-key-protected MCP servers. See the example implementation:Testing
Testnet Setup
- Get Base Sepolia testnet ETH from Coinbase Faucet
- Get testnet USDC from the same faucet
- Use
baseSepolia
chain in your configuration - Learn more about X402 on Coinbase Developer Platform
Demo Server
Test against our hosted demo server:Network Configuration
Supported networks from Viem chains:base
- Base mainnetbaseSepolia
- Base Sepolia testnet (recommended for testing)mainnet
- Ethereum mainnetsepolia
- Ethereum Sepolia testnetoptimism
- Optimism mainnetarbitrum
- Arbitrum Onepolygon
- Polygon mainnet
Error Handling
Common errors and solutions:Insufficient Balance
Payment Verification Failed
Tool Not Found in Pricing
Security Considerations
- Private Keys: Never commit private keys to version control
- Environment Variables: Use environment variables for sensitive data
- Network Selection: Use testnet for development and testing
- Price Validation: Validate tool pricing on both client and server
- Rate Limiting: Implement rate limiting to prevent abuse
Support
- GitHub: civicteam/x402-mcp
- Issues: GitHub Issues
- Contact: Get in touch