Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .well-known/x402.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "apify/apify-mcp-server",
"description": "Apify MCP Server",
"accepts": [
{
"network": "eip155:8453",
"asset": "USDC",
"address": "YOUR_WALLET_ADDRESS"
}
],
"resources": [
{
"path": "/apify",
"price": "0.01",
"description": "Pay-per-call access to apify"
},
{
"path": "/server",
"price": "0.01",
"description": "Pay-per-call access to server"
},
{
"path": "/actors",
"price": "0.01",
"description": "Pay-per-call access to actors"
},
{
"path": "/model context protocol",
"price": "0.01",
"description": "Pay-per-call access to model context protocol"
}
]
}
25 changes: 25 additions & 0 deletions x402-middleware-example.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// x402 payment middleware - add before your protected routes
import { createPaymentMiddleware } from 'x402-express'; // or implement manually

// Option A: use the x402-express package
app.use('/api', createPaymentMiddleware({
walletAddress: process.env.X402_WALLET_ADDRESS,
network: 'eip155:8453', // Base mainnet
facilitatorUrl: 'https://facilitator.402.bot/verify',
}));

// Option B: manual (just check the payment header)
app.use('/api', (req, res, next) => {
const payment = req.headers['x-payment'];
if (!payment) {
// Return 402 with payment requirements
res.status(402).json({
accepts: [{ network: 'eip155:8453', asset: 'USDC', address: process.env.X402_WALLET_ADDRESS }],
price: '0.01',
});
return;
}
// Verify payment with facilitator
// See: https://api.402.bot/mcp/setup
next();
});