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-mcp Create 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.
Available Tools
6 toolsfour02_invoice_createA
Create a 402 EIP-712 invoice for native USDC on Ink (chain 57073). Returns the canonical invoice plus its content-addressed id. If FOUR02_COMMERCE_INVOICE_KEY is configured and matches the issuer, the invoice is signed; otherwise it is returned unsigned with instructions to sign client-side (domain "402 Invoice", version "1").
Inputs: issuer (required), amountUsdc (required), description (required), nonce, +3 more.
four02_invoice_payA
Verify a signed 402 invoice and build the exact USDC payment plan for it. DRY RUN BY DEFAULT — returns the plan and client-side signing instructions, broadcasting nothing. Pass approveBroadcast:true ONLY after the human explicitly approved that exact payment in chat, and only when FOUR02_COMMERCE_PAYER_KEY is configured; then the server submits the USDC transfer itself.
Inputs: signedInvoiceJson (required), approveBroadcast.
four02_invoice_statusA
Verify a signed 402 invoice (pure cryptography, no trust needed) and heuristically check whether it looks paid by scanning Ink USDC Transfer events to the issuer. Payment detection is a heuristic — "likely paid", never certain.
Inputs: signedInvoiceJson (required), lookbackBlocks.
four02_reputation_historyA
Raw commerce-event history for an ERC-8004 agentId from the Four02ReputationRegistry on Ink (append-only; newest last). Each entry shows the recording writer contract, the event type (e.g. invoice_paid_on_time), and the USDC value. Read-only.
Inputs: agentId (required), limit.
four02_reputation_reliabilityA
Payment reliability score (0-100) and dispute rate (basis points) for an ERC-8004 agentId, from the Four02ReputationRegistry on Ink. Value-weighted with 365-day linear decay. Read-only.
Inputs: agentId (required).
four02_reputation_summaryA
One-shot commerce reputation snapshot for an ERC-8004 agentId from the Four02ReputationRegistry on Ink: reliability (0-100), dispute rate (bps), arbitration record, total events, last event time. Read-only.
Inputs: agentId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Invoice tools (create/status/pay) are clearly distinct by lifecycle stage. Reputation tools have slight overlap because reputation_summary already includes reliability and dispute rate, which are also the focus of reputation_reliability; however, the descriptions clarify that summary is broader and reliability is narrowly scored, so confusion is limited.
All tools follow the same four02_<resource>_<action> snake_case pattern: invoice_create, invoice_status, invoice_pay, reputation_summary, reputation_reliability, reputation_history. The convention is predictable and consistent throughout.
Six tools are well-scoped for a focused commerce server covering invoice creation, verification, payment planning, and reputation reads. Each tool has a clear role without an excessive or thin surface.
The invoice lifecycle is covered from creation through status verification to payment, and reputation read operations are present. Minor gaps exist around listing/searching invoices or writing reputation/dispute events, but the core stated workflows are supported.
Related MCP Connectors
Agent-native MCP for governed commerce, x402 payments, paid capabilities, and verifiable receipts.
Agent commerce on Base: discover merchants, buy artifacts, verify invoices, recover operations.
Agentic commerce + trust MCP: discover, verify, and transact across droplinked's merchant network.
Marketplace and payment rail for AI agents: list, buy and settle with signed receipts.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceAgent 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.4,039 npm5Apache 2.0
- AlicenseNot gradedqualityDmaintenanceOnchain 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
- FlicenseNot gradedqualityCmaintenanceEnables agents to vet merchants, create and verify USDC charges and invoices, assess trust and tokenized-asset authenticity, and manage provable books on Base, all non-custodially.62 npm-
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to autonomously invoice, receive payments, and settle micro-transactions in USDC via Moove Agentic Payments, using cryptographic hash commitments for zero-custody fair exchange.MIT