four02-commerce-mcp
OfficialAllows agents to create, verify, and pay invoices in Circle's USDC stablecoin on the Ink blockchain, with payment detection based on USDC Transfer events.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@four02-commerce-mcpCreate a 2.50 USDC invoice for 10k API calls"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
four02-commerce-mcp
The commerce layer for the Ink agentic economy, as an MCP server.
Any MCP-capable agent (Claude Code, Cursor, Claude Desktop, …) can point at this server and immediately:
invoice another agent for work, in native USDC on Ink (EIP-712)
verify invoices and check whether they look paid
pay invoices with a dry-run-first payment plan
read onchain commerce reputation for any ERC-8004 agent: reliability scores, dispute rates, and raw event history
This is the 402 protocol's agent-commerce toolkit, extracted as a standalone
open-source package. It is designed to sit alongside
inkonchain-mcp (Sergio's
Ink agent stack): every tool is prefixed four02_, so there are zero
tool-name collisions. His stack gives agents hands (trade, launch, bridge);
this gives them a business (bill, verify, trust).
Chain: Ink mainnet (chain ID 57073). Settlement asset: native Circle USDC
0x2D270e6886d130D724215A266106e6832161EAEd.
Install
npm install -g four02-commerce-mcp
# or run directly:
npx four02-commerce-mcpMCP client config
Claude Code / Cursor / Claude Desktop (.mcp.json or equivalent):
{
"mcpServers": {
"four02-commerce": {
"command": "npx",
"args": ["-y", "four02-commerce-mcp"],
"env": {
"FOUR02_COMMERCE_FACILITATOR_URL": "https://402-production.up.railway.app"
}
}
}
}Run it next to inkonchain-mcp in the same config — the four02_ prefix
guarantees no collisions:
{
"mcpServers": {
"inkonchain": { "command": "npx", "args": ["inkonchain-mcp"] },
"four02-commerce": { "command": "npx", "args": ["-y", "four02-commerce-mcp"] }
}
}Configuration (env)
Variable | Default | Purpose |
|
| 402 facilitator base URL |
|
| Ink RPC for reads |
|
| Four02ReputationRegistry on Ink |
| — | Optional issuer key: |
| — | Optional payer key: enables |
Related MCP server: pyrimid
Tool catalog
Invoices (EIP-712, offchain)
Tool | What it does |
| Create a 402 invoice for Ink USDC. Returns the canonical invoice + content-addressed id. Signed automatically if |
| Verify a signed invoice (pure cryptography) and heuristically scan Ink USDC |
| Verify the invoice and build the exact payment plan. Dry run by default — broadcasts nothing. Pass |
Reputation (onchain reads, Four02ReputationRegistry)
Tool | What it does |
| One-shot snapshot for an ERC-8004 agentId: reliability (0–100), dispute rate (bps), arbitration wins/losses, total events, last event time. |
| Reliability score + dispute rate. Value-weighted, 365-day linear decay. |
| Raw append-only commerce-event history (newest last): writer contract, event type ( |
Typical agent flow
1. four02_invoice_create → issuer bills payer "2.50 USDC for 10k API calls"
2. four02_invoice_status → payer verifies the signature before paying
3. four02_invoice_pay → dry-run plan; human approves; broadcast
4. four02_reputation_summary → anyone checks the issuer's track record firstSecurity
Keys are env-only. The server never accepts a private key as a tool argument, never logs one, and never transmits one. Without the
*_KEYvars, signing/payment tools return client-side instructions instead.Pay is dry-run first.
four02_invoice_payreturns a plan and broadcasts nothing unless the caller passesapproveBroadcast: trueand the operator configuredFOUR02_COMMERCE_PAYER_KEY. Agents must only pass that flag after the human explicitly approved the exact payment in chat — same posture as the 402pay --broadcastCLI.Reputation tools are pure reads. They cannot write, sign, or spend.
Invoice verification is trustless.
four02_invoice_statusrecovers the signer with pure ECDSA; no RPC trust required for validity. The payment heuristic is explicitly labeled as such.This package is experimental software interacting with a live blockchain. It has not had a professional audit. Do not wire it to wallets holding funds you cannot afford to lose.
Roadmap
Escrow tools (
four02_escrow_*) after the 402AgentEscrowcontract deploys on Ink: fund → deliver → release, dispute → arbitrate.Reputation writes stay restricted by design: only owner-approved 402 protocol contracts can record commerce events. This package reads; the protocol writes.
Faucet/testnet support if Ink ships a public testnet.
Development
npm install
npm run typecheck # tsc --noEmit
npm test # tsx test/commerce-mcp.test.ts (13 checks, no mainnet)
npm run build # emits dist/src/invoice.ts and src/chain.ts are vendored from the 402 monorepo
(~/workspace/402/src/); keep them in sync when the invoice format or
chain helpers change.
License
MIT. See LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Agent-native MCP for governed commerce, x402 payments, paid capabilities, and verifiable receipts.
Agentic commerce + trust MCP: discover, verify, and transact across droplinked's merchant network.
MCP layer for local businesses: discover, query, book, and transact with verified SMB AI agents.
On-chain ERC-8004 agent registry. Search, register, and check reputation across 16 chains.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAgent network intelligence for trust verification, broker discovery, and capability matching. Ed25519 identity, graph-based trust scoring, USDC payments, and MCP tools for agent registration, search, and trust attestation.284 npm5MIT
- AlicenseNot gradedqualityFmaintenanceOnchain agent-to-agent commerce protocol using x402 and ERC-8004. Enables AI agents to buy/sell services, manage vendor catalogs, and process payments on Base.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to discover and interact with onchain agent infrastructure on Base, including identity, micropayments, and tool capabilities via MCP.4MIT
- AlicenseAqualityBmaintenancePayment infrastructure MCP server enabling AI agents to make gasless USDC payments on Base and JIT single-use virtual card checkouts, with zero-trust card handling, merchant checkout hints, and signed receipts.1399 npm1MIT