95% of MCP Servers make \ in revenue.
That's the harsh reality of the MCP ecosystem in 2026. Thousands of servers, countless hours of development — and almost nobody is paying. The core problem? There's no standard, frictionless way to charge per API call.
Enter x402 — HTTP 402 "Payment Required" meets USDC on Base. I built GoldBean API to solve exactly this problem.
What is x402?
x402 is a protocol that turns HTTP 402 "Payment Required" into a practical payment mechanism. When an AI agent makes a request:
- The server responds with \402 Payment Required\ + a unique payment address
- The client pays USDC on Base (2-second settlement, near-zero fees)
- The server validates the payment and serves the response
No subscriptions. No API key management. Just pay-per-call — exactly like a vending machine for AI tools.
Architecture Design
GoldBean runs on Express 5 with modular routing:
\\
goldbean/
├── routes/
│ ├── ocr.js # Baidu OCR (Chinese text recognition)
│ ├── nlp.js # Chinese NLP: sentiment, keywords, summarization
│ ├── translate.js # Multi-language translation
│ ├── tools.js # Weather, crypto prices, web search, code analysis
│ └── x402.js # Payment middleware
├── public/
│ └── ocr-demo.html # Demo page
└── server.js
\\
The x402 Middleware Core
Here's the critical middleware that makes pay-per-call work:
\\javascript
// x402 middleware — heart of pay-per-call
const x402Middleware = async (req, res, next) => {
const price = getToolPrice(req.path);
const paymentTx = req.headers['x402-tx'];
if (!paymentTx) {
return res.status(402).json({
error: 'Payment Required',
x402: {
chain: 'base',
token: 'USDC',
amount: price,
receiver: process.env.X402_RECEIVER,
metadata: { tool: req.path }
}
});
}
const verified = await verifyPayment(paymentTx);
if (!verified) {
return res.status(402).json({ error: 'Payment not confirmed' });
}
next();
};
\\
The beauty? AI agents handle this automatically. When Claude hits a 402, it reads the payment details, signs via its wallet, and retries — zero human intervention.
Deploy to VPS
\\ash
git clone https://github.com/wuzenghai616-lang/goldbean
cd goldbean && npm install
export X402_RECEIVER=0xYourBaseWallet
pm2 start server.js --name goldbean
\\
MCP Integration
Add to your Claude Desktop config:
\\json
{
"mcpServers": {
"goldbean": {
"command": "npx",
"args": ["goldbean-mcp"]
}
}
}
\\
84+ Tools Available
- OCR: Baidu OCR for Chinese text, receipts, ID cards
- NLP: Chinese sentiment analysis, keyword extraction, summarization
- Translation: Multi-language via Baidu Translate
- Utilities: Weather, crypto prices, web search, code analysis
New users get free trial credits — just top up on the website.
Links
- 🌐 Website: goldbean-api.xyz
- 🐙 GitHub: wuzenghai616-lang/goldbean
- 🔗 Glama: glama.ai/mcp/servers/wuzenghai616-lang/goldbean
- 📦 Awesome x402 PR: Add GoldBean API (#543)
Top comments (0)