mcpField
M
m2mcent

m2mcent

Local
github.com/EvozimFinance0Updated 11w ago

About m2mcent

m2mcent is an x402 payment SDK for AI agents and MCP server operators who want to charge for protected API responses. It handles payment authorization and on-chain settlement in a request cycle using USDC on Base Mainnet.

Key features

  1. 01Intercepts requests for paid endpoints
  2. 02Creates 402 payment challenges
  3. 03Uses EIP-712 payment authorization
  4. 04Settles payments through on-chain escrow
  5. 05Supports USDC on Base Mainnet

Use cases

  1. 01Adding payments to a protected API
  2. 02Charging for MCP server tools
  3. 03Settling agent-to-service USDC payments

MCP support

The SDK can be integrated into MCP servers to gate tool or API responses behind x402 payments. It returns payment metadata for agent authorization and settles the payment on-chain before delivering the protected response.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"evozim-m2mcent": {
"command": "npx",
"args": [
"-y",
"m2mcent-sdk"
],
"env": {
"BASE_RPC_URL": "<BASE_RPC_URL>",
"RELAYER_PRIVATE_KEY": "<RELAYER_PRIVATE_KEY>",
"TREASURY_ADDRESS": "<TREASURY_ADDRESS>"
}
}
}
}
Run commandnpx -y m2mcent-sdk
Environment variables to set
BASE_RPC_URLBase Mainnet RPC endpoint URL
RELAYER_PRIVATE_KEYSecretRelayer wallet private key for on-chain settlement
TREASURY_ADDRESSTreasury wallet address to receive payments

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npmm2mcent-sdk1.0.5

Tools

2

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
querystringYesKeyword to search for in the catalog (e.g. 'pdf', 'crypto', 'vision')

Details

From the project README

🛰️ M2MCent SDK — x402 Payment Wrapper for AI Agents

npm version License: MIT Base Mainnet

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:

  1. Agent requests a protected endpoint
  2. Server responds with 402 Payment Required + payment metadata (Base64 encoded)
  3. Agent signs an EIP-712 typed data authorization (gasless for the payer)
  4. Server settles atomically on-chain via the M2MCent Escrow contract
  5. 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

ParameterDescriptionRequired
rpcUrlBase Mainnet RPC endpoint✅
privateKeyRelayer wallet private key (for settlement)✅
recipientTreasury 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

ParameterValue
NetworkBase Mainnet (Chain ID: 8453)
USDC Contract0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
Escrow Contract0xf3c3416A843d13C944554A54Ac274BB7fF264BcC
SettlementAtomic, 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

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.