M2mcent

io.github.EvozimPublished by GitHub account Evozimv1.0.5Updated Oct 24, 2026

x402 payment wrapper for AI Agents and MCP Servers. USDC settlements on Base L2.

Overview

AI-generated overview

M2mcent is an x402 payment wrapper SDK that lets an assistant or MCP server charge USDC micropayments on Base L2 for protected API endpoints.

What you can do
  • Wrap Express API or MCP tool endpoints behind a USDC paywall with a single requirePayment call
  • Return HTTP 402 payment metadata and accept signed EIP-712 / EIP-3009 authorizations from paying agents
  • Settle payments atomically on-chain through the M2mcent escrow contract on Base Mainnet
  • Hand back the premium response together with the settlement transaction receipt
  • No individual tools are listed in the manifest; the package is a library used inside your own server code.
When to use it
Use it when you are building an API or MCP server and want to charge other agents per request in USDC on Base, or when you need a drop-in x402 paywall for existing endpoints.
Requirements
Runs locally as an npm package (m2mcent-sdk) over stdio. Needs a Base Mainnet RPC endpoint URL (BASE_RPC_URL), a relayer wallet private key (RELAYER_PRIVATE_KEY) and a treasury address (TREASURY_ADDRESS). Requires network access to Base and a funded relayer wallet for settlement.
Before you install
The server requires a wallet private key (RELAYER_PRIVATE_KEY) that signs on-chain settlements, so a leaked key exposes those funds; use a dedicated, minimally funded relayer wallet. It moves real USDC on Base Mainnet, so misconfiguration can send funds to the wrong treasury address. The README's claims about non-custody, gasless payers and adoption are vendor statements that are not independently verified here.

Installation

In SourceWeft

  1. Open M2mcent in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

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

bash
npm install m2mcent-sdk
typescript
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 paywallapp.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 + metadataAgent ◄── signs EIP-712 authorizationAgent ──► API Server + Payment-Signature header          └──► Escrow.settle() on Base L2Agent ◄── 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:

typescript
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 monetizableapp.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

Source: README.md at commit 88718c8

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v1.0.5LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts