Example implementation of an MCP server with X402 payment integration, using @civic/x402-mcp.
- Install dependencies:
pnpm install- Generate a wallet and configure environment:
pnpm generate-wallet > .env- Edit
.envand add your receiver wallet address
pnpm devServer runs on http://localhost:3022/mcp
The server provides three paid MCP tools:
list-todos- List all todos ($0.001)add-todo- Add a todo ($0.002)delete-todo- Delete a todo by index ($0.001)
Payments are handled automatically via X402 protocol.