io.github.Evozim/m2mcent
x402 payment wrapper for AI Agents and MCP Servers. USDC settlements on Base L2.
Install
Add this to your client's MCP configuration (Claude Desktop: claude_desktop_config.json; Cursor: .cursor/mcp.json; VS Code and others use the same "mcpServers" shape).
m2mcent-sdkclaude mcp add m2mcent -e 'BASE_RPC_URL=<BASE_RPC_URL>' -e 'RELAYER_PRIVATE_KEY=<your relayer_private_key>' -e 'TREASURY_ADDRESS=<TREASURY_ADDRESS>' -- npx -y m2mcent-sdk@1.0.5
{
"mcpServers": {
"m2mcent": {
"command": "npx",
"args": [
"-y",
"m2mcent-sdk@1.0.5"
],
"env": {
"BASE_RPC_URL": "<BASE_RPC_URL>",
"RELAYER_PRIVATE_KEY": "<your relayer_private_key>",
"TREASURY_ADDRESS": "<TREASURY_ADDRESS>"
}
}
}
}
Environment variables
BASE_RPC_URLrequired Base Mainnet RPC endpoint URLRELAYER_PRIVATE_KEYrequired secret Relayer wallet private key for on-chain settlementTREASURY_ADDRESSrequired Treasury wallet address to receive payments
Documentation
From the project's README on GitHub, refreshed weekly. Links open on GitHub.
Contents
🛰️ M2MCent SDK — x402 Payment Wrapper for AI Agents
Ultra-lightweight x402 payment interceptor for AI Agents and MCP Servers. Monetize any API in 3 lines of code.
🚀 Quick Start
npm install m2mcent-sdk
import { X402Handler } from 'm2mcent-sdk';
const x402 = new X402Handler({
rpcUrl: 'https://mainnet.base.org',
privateKey: process.env.RELAYER_PRIVATE_KEY!,
recipient: process.env.TREASURY_ADDRESS!
});
// Protect any Express endpoint with a USDC paywall
app.post('/api/analyze', x402.requirePayment("100000"), (req, res) => {
res.json({ result: "Premium analysis complete", receipt: req.paymentTx });
});
📐 How It Works
M2MCent implements the x402 Payment Protocol — a machine-native payment standard inspired by HTTP 402:
- Agent requests a protected endpoint
- Server responds with
402 Payment Required+ payment metadata (Base64 encoded) - Agent signs an EIP-712 typed data authorization (gasless for the payer)
- Server settles atomically on-chain via the M2MCent Escrow contract
- Agent receives the premium response + transaction receipt
Agent ──► API Server ──► 402 + metadata
Agent ◄── signs EIP-712 authorization
Agent ──► API Server + Payment-Signature header
└──► Escrow.settle() on Base L2
Agent ◄── Premium Response + tx hash
⚙️ Configuration
| Parameter | Description | Required |
|---|---|---|
rpcUrl | Base Mainnet RPC endpoint | ✅ |
privateKey | Relayer wallet private key (for settlement) | ✅ |
recipient | Treasury address to receive payments | ✅ |
🔒 Security
- Non-custodial: Funds flow directly from payer → treasury via on-chain escrow
- Gasless for payers: Uses EIP-3009
transferWithAuthorization(USDC native) - Zero-Leak: No agent data is retained after settlement
- Atomic: Payment and service delivery happen in a single request cycle
🌐 Network Details
| Parameter | Value |
|---|---|
| Network | Base Mainnet (Chain ID: 8453) |
| USDC Contract | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| Escrow Contract | 0xf3c3416A843d13C944554A54Ac274BB7fF264BcC |
| Settlement | Atomic, sub-second finality |
🧩 MCP Server Integration
Perfect for Model Context Protocol servers:
import express from 'express';
import { X402Handler } from 'm2mcent-sdk';
const app = express();
const x402 = new X402Handler({
rpcUrl: process.env.BASE_RPC_URL!,
privateKey: process.env.RELAYER_PRIVATE_KEY!,
recipient: process.env.TREASURY_ADDRESS!
});
// Any MCP tool endpoint becomes monetizable
app.post('/api/tools/analyze', x402.requirePayment("50000"), async (req, res) => {
const result = await runMCPTool(req.body);
res.json({ ...result, paymentTx: req.paymentTx });
});
📊 Ecosystem
M2MCent powers 100+ production MCP servers on Base Mainnet, processing real USDC micro-payments for AI-to-AI commerce.
📄 License
MIT © M2MCent
Frequently asked questions
What is io.github.Evozim/m2mcent?
x402 payment wrapper for AI Agents and MCP Servers. USDC settlements on Base L2.
How do I install io.github.Evozim/m2mcent?
It runs on your machine. In Claude Code: claude mcp add m2mcent -e 'BASE_RPC_URL=<BASE_RPC_URL>' -e 'RELAYER_PRIVATE_KEY=<your relayer_private_key>' -e 'TREASURY_ADDRESS=<TREASURY_ADDRESS>' -- npx -y m2mcent-sdk@1.0.5. For other clients, paste the JSON configuration from this page into their MCP settings.
Does io.github.Evozim/m2mcent need an API key?
Yes. It expects BASE_RPC_URL, RELAYER_PRIVATE_KEY, TREASURY_ADDRESS, which you set in its configuration.
Is io.github.Evozim/m2mcent open source?
Yes. Its code is on GitHub under the MIT license.
Who maintains io.github.Evozim/m2mcent?
It is published by Evozim. AI.tn lists it but does not maintain or endorse it.
From the official MCP Registry. Listing is not an endorsement: review a server's code and permissions before giving it access to your data.