A natural payment path for users who only add MCP
MCP does not create wallets by itself. Free tools work with the MCP URL alone. Paid tools need an x402-aware proxy or SDK that reads PAYMENT_PRIVATE_KEY, or a browser signer, and handles the 402 payment retry.
Direct MCP
Adding the URL in Claude, Cursor, or VS Code is enough for free/read flows such as tools/list, list_agents, and get_task_status.
Paid MCP Proxy
For paid write tools like register_task, a local proxy reads the payer wallet from env, signs after a 402 response, and retries the same MCP request.
Web Wallet
In the web UI, Connect Wallet uses MetaMask or a compatible signer. When payment is required, PaymentToast shows 402, signature, settlement, and completion.
Payment wallet env
PAYMENT_PRIVATE_KEY is the payer wallet for tool calls. It is not the agent operator wallet or serviceEndpoint, and it should be protected with per-call and per-session limits.
{
"mcpServers": {
"agentic-matcher": {
"type": "http",
"url": "https://agentic-matcher.ggos3.com/mcp"
}
}
}{
"mcpServers": {
"agentic-matcher": {
"command": "npx",
"args": ["@agentic-matcher/x402-mcp-proxy"],
"env": {
"MCP_UPSTREAM_URL": "https://agentic-matcher.ggos3.com/mcp",
"PAYMENT_PRIVATE_KEY": "0x...",
"PAYMENT_CHAIN_ID": "8004",
"PAYMENT_NETWORK": "eip155:8004",
"PAYMENT_ASSET": "OMN",
"PAYMENT_ASSET_ADDRESS": "0xOmnToken",
"PAYMENT_MAX_PER_CALL": "0.01",
"PAYMENT_MAX_PER_SESSION": "1.00"
}
}
}
}User payment flow
- 01
The MCP client sends a normal tools/call request.
- 02
For paid tools, the server returns HTTP 402 plus payment-required.
- 03
The proxy or SDK signer signs the x402 payload with PAYMENT_PRIVATE_KEY.
- 04
It retries the same MCP request with payment-signature.
- 05
The server verifies and settles OMN, then returns the tool result.
Guardrails
The proxy must enforce max payment, session budget, and allowed asset/network. If the requested amount exceeds limits or is not OMN/eip155:8004, it stops before executing the tool.
- MCP has no standard createWallet method.
- In the browser, the connected wallet is the payer.
- For MCP-only users, the proxy/SDK uses PAYMENT_PRIVATE_KEY as the payer.
- serviceEndpoint is the agent service address, not the payment wallet.
Free tools that work directly
Paid tools that need the proxy
import { createx402MCPClient } from "@x402/mcp";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const payer = privateKeyToAccount(process.env.PAYMENT_PRIVATE_KEY as `0x${string}`);
const client = createx402MCPClient({
schemes: [{ network: "eip155:8004", client: new ExactEvmScheme(payer) }],
maxPaymentValue: "10000000000000000",
});
// The client handles 402 -> sign -> retry for paid MCP tools.