x402-native-token-payment-demo
v0.0.1
Published
X402 Native Token Payment Demonstration with MCP, Resource Server, and Facilitator
Downloads
1
Readme
X402 Native Token Payment Demo
This project demonstrates native token payments using the X402 protocol with three main components: an MCP Server, a Resource Server, and a Facilitator Server.
[!CAUTION] This project is intended for demonstration purposes only. Exercise extreme caution if using it in a production environment.
Components
- MCP Server: Handles the core logic for processing X402 payments.
- Resource Server: Hosts protected resources that require X402 payment for access.
- Facilitator Server: Assists in the payment process, potentially handling token operations or relaying messages.
- Payment Network (Anvil): The blockchain network used for native token transactions (simulated with Anvil).
How to start
Start
anvil network: (foundry is required)anvilStart
facilitator server:npx -p x402-native-token-payment-demo node dist/facilitator/facilitator-server.jsStart
resource server:npx -p x402-native-token-payment-demo node dist/resource-server/resource-server.jsSetup
mcp server{ "mcpServers": { "x402-native-token-payment-demo": { "command": "npx", "args": [ "-p", "x402-native-token-payment-demo", "node", "./dist/mcp-server/mcp-server.js" ], "env": { "RESOURCE_SERVER_URL": "http://localhost:4021", "PAYMENT_PAYER_PRIVATE_KEY": "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d" } } } }
