a2a-x402-guard-mcp
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., "@a2a-x402-guard-mcp audit this x402 PAYMENT-REQUIRED header and enforce my 5 USDC per-tx cap"
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.
a2a-x402-guard-mcp
a2a-x402-guard-mcp (v1.0.0) is a zero-dependency (dependencies = [], 100% Python >= 3.10 stdlib) deterministic security guard for x402 HTTP 402 Micropayments, A2A AP2 (Agent Payments Protocol) Mandates, Integer Minor-Unit Spend Caps, and S4-REJECT-005-Safe A2A v1.0.1 agent-card.json Signing, packaged as a 1-click .mcpb desktop bundle (< 50ms cold boot).
Autonomous agents interacting with paid HTTP 402 endpoints or A2A AP2 merchants face five concrete failure modes: IEEE-754 floating-point rounding drift (0.1 + 0.2 != 0.3), rogue/spoofed ERC-20 or SPL token contracts in PAYMENT-REQUIRED challenges, EIP-3009 authorization replay or unbounded validBefore windows, tampered CartMandate line-item totals, and broken agent-card.json JWS signatures caused by placing "x402" at the ProtoJSON top level (S4-REJECT-005). a2a-x402-guard-mcp eliminates all five deterministically with zero external pip dependencies.
Core Engineering Capabilities
Multi-Chain CAIP-2
x402Header Forensics: Parses and auditsPAYMENT-REQUIRED,X-PAYMENT, andPAYMENT-SIGNATUREheaders (JSON, base64, and base64url) acrosseip155:8453(Base Mainnet USDC EIP-3009TransferWithAuthorization),eip155:84532(Base Sepolia USDC),solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp(Solana USDC & SOL), andstacks:1(sBTCSIP-010).SPEC_CLASS_09100% Integer Minor-Unit Spend Gate: Strictly rejectsfloatinputs and negative slippage (slippage_bps < 0), computes exact integer basis-point fees (net_minor = amount_minor * (10000 - fee_bps) // 10000), enforcesmax_per_tx_minoranddaily_cap_minor, and blocks nonce replays via stateless sets or an atomic thread-safe SQLite WAL ledger (BEGIN IMMEDIATE).Pure-Python AP2
IntentMandate&CartMandateVerifier: Verifies ISO-4217 and crypto minor-unit exponents (0JPY/VND,2USD/EUR,3KWD,6USDC,8sBTC,9SOL,18WEI), line-item sum conservation,human_confirmation_threshold_minor, and pure-Python RFC 8032 Ed25519 + RFC 8785 JCS signatures.S4-REJECT-005-Safe A2Av1.0.1agent-card.jsonScaffolder: Emits spec-compliant HTTP 402PAYMENT-REQUIREDheaders alongside an Ed25519-signed/.well-known/agent-card.json+/.well-known/jwks.jsonbundle that embedsx402andAP2metadata insidecapabilities.extensions[]andskills[]soa2a-python,@a2a-js/sdk, anda2a-goProtoJSON JWS verifiers agree bit-for-bit.SPEC_CLASS_14Settlement Webhook & DLP Guard: Verifies facilitator webhooks with constant-timehmac.compare_digest(HMAC-SHA256) orEd25519, deduplicatesidempotency_key, and automatically redacts accidental API keys, secrets, and payment card digits.
Related MCP server: Lumière PayCheck
Quick Install
Option 1: 1-Click .mcpb Bundle (Claude Desktop)
Download a2a-x402-guard-mcp.mcpb from the v1.0.0 Release and open it in Claude Desktop (manifest_version: "0.3", zero pip install step).
Option 2: pip / uvx CLI & MCP Server
pip install a2a-x402-guard-mcp
a2a-x402-guard-mcp selftest --jsonOption 3: MCP Client Configuration (claude_desktop_config.json / Cursor / VS Code)
{
"mcpServers": {
"a2a-x402-guard": {
"command": "a2a-x402-guard-mcp-server",
"env": {
"X402_DEFAULT_MAX_TX_USDC_ATOMIC": "5000000"
}
}
}
}6 Deterministic MCP Tools (readOnlyHint = True)
Tool | Purpose & Enforced Invariants |
| Audits |
| Enforces |
| Verifies A2A AP2 |
| Generates HTTP 402 |
| Exact |
| Constant-time |
Built-in Prompts & Reference Resources
Slash Prompts (
3):audit-402-payment-challenge,verify-ap2-cart-mandate,add-x402-pricing-to-agent-cardResources (
2):x402-guard://spec/caip2-assets-and-decimals— Canonical Base/Sepolia USDC, Solana USDC/SOL, Stacks sBTC asset descriptors & minor-unit exponents.x402-guard://checklists/spec-class-09-payment-invariants— Production payment security invariants, linked to khoaphan.dev/a2a-iq/ and khoaphan.dev/webhooks/.
Engineering & Support Workflow (Transparent Written-First A2A Operation)
Maintained by Khoa Phan via an open, transparent A2A (AI-Orchestrated Senior Engineering) workflow:
100% Written Asynchronous Communication: All bug reports, integration specifications, and custom security engagements operate strictly via written channels (GitHub Issues, Pull Requests, and written async briefs at khoaphan.dev/services/ — zero live meetings) backed by deterministic Code-First PoCs and automated
pytestsuites.Interactive Benchmarks & Guides: Explore live A2A v1.0.1 conformance benchmarks at khoaphan.dev/a2a-iq/ and webhook hardening patterns at khoaphan.dev/webhooks/.
License
MIT © 2026 Khoa Phan.
Available Tools
6 toolsap2_verify_cart_mandateARead-onlyIdempotent
Verify A2A AP2 (Agent Payments Protocol) IntentMandate & CartMandate envelopes: validates line-item integer minor-unit sum == total_amount_minor, ISO-4217 & crypto currency exponents (0 JPY/VND, 2 USD/EUR, 3 KWD, 6 USDC, 8 sBTC, 9 SOL, 18 WEI), payee_id binding, TTL expiry, human_confirmation_threshold_minor, and pure-Python RFC 8032 Ed25519 + RFC 8785 JCS signatures.
Inputs: mandate_json (required), jwks_json, public_key, expected_payee_id, +4 more.
x402_convert_atomic_unitsARead-onlyIdempotent
Exact Decimal string <-> integer minor/atomic unit converter (USD 2, EUR 2, VND 0, JPY 0, KWD 3, USDC 6, sBTC 8, SOL 9, WEI 18) with explicit SUB_ATOMIC_DUST_REJECTED rounding rejection whenever fractional sub-atomic dust is supplied.
Inputs: amount (required), currency (required), direction, allow_negative.
x402_enforce_spend_policyARead-onlyIdempotent
Deterministic SPEC_CLASS_09 spend-cap & integer fee-math gate (net_minor = amount_minor * (10000 - fee_bps) // 10000, strictly rejecting IEEE-754 floats and slippage_bps < 0). Enforces max_per_tx_minor, cumulative_spent_minor + amount_minor <= daily_cap_minor, allowed_payees, allowed_caip2_networks, and idempotency_nonce replay rejection (stateless batch or optional thread-safe SQLite WAL ledger).
Inputs: payee (required), amount_minor (required), caip2_network (required), idempotency_nonce (required), +12 more.
x402_inspect_payment_headerARead-onlyIdempotent
Parse & audit HTTP 402 PAYMENT-REQUIRED, X-PAYMENT, and PAYMENT-SIGNATURE headers (JSON, base64, or base64url JSON) across CAIP-2 networks (eip155:8453 Base USDC EIP-3009 TransferWithAuthorization, eip155:84532 Base Sepolia, solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp, stacks:1 sBTC). Flags IEEE-754 floats, zero/negative atomic amounts, expired validBefore, future validAfter, untrusted asset contracts, and payee mismatch.
Inputs: header_value (required), header_name, expected_payee, reference_unix_ts, +3 more.
x402_scaffold_agent_card_extensionBRead-onlyIdempotent
Generate spec-compliant HTTP 402 PAYMENT-REQUIRED JSON/base64 headers and a strict S4-REJECT-005-safe A2A v1.0.1 /.well-known/agent-card.json + /.well-known/jwks.json bundle with x402 & AP2 extensions signed in pure Python (RFC 8032 Ed25519 + RFC 8785 JCS) without breaking ProtoJSON JWS verification.
Inputs: agent_name (required), description (required), price_minor (required), endpoint_url (required), +12 more.
x402_verify_settlement_webhookARead-onlyIdempotent
Verify x402 / facilitator settlement webhooks via constant-time hmac.compare_digest (HMAC-SHA256) or pure-Python RFC 8032 Ed25519, enforcing timestamp skew limits, mandatory idempotency_key deduplication (SPEC_CLASS_14), integer settlement math (SPEC_CLASS_09), and automatic redaction of accidental API keys, secrets, and payment card digits.
Inputs: raw_body (required), signature_header (required), scheme, ledger_db_path, +6 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct phase of the payment lifecycle: policy enforcement, header parsing, mandate verification, artifact scaffolding, unit conversion, and webhook verification. Only minor overlap exists between x402_enforce_spend_policy and ap2_verify_cart_mandate, since both validate amounts, payees, and thresholds, but their inputs (transactions vs. mandate envelopes) are clearly separated.
All six names follow a verb_noun pattern (enforce_spend_policy, inspect_payment_header, convert_atomic_units, etc.), so they are predictable and readable. The only deviation is the ap2_ prefix on ap2_verify_cart_mandate versus x402_ elsewhere, though this usefully signals the protocol family the tool handles.
Six tools is well-scoped for a focused x402/AP2 guard server, and each maps to a distinct responsibility (enforce, inspect, verify mandates, scaffold, convert, verify webhooks). No tool appears redundant or vestigial.
The surface covers the core guard workflow: policy enforcement, header audit, mandate verification, artifact generation, unit math, and webhook verification. Minor gaps remain: there is no payer-side X-PAYMENT payload construction or signing tool, and no way to query or reset the cumulative spend ledger that x402_enforce_spend_policy maintains, but agents can work around these with the scaffolding and enforcement tools.
Maintenance
Related MCP Connectors
Authorize and prove autonomous x402/AP2 agent payments with cryptographic receipts.
Stripe-backed HTTP 402 Agent Payment Hub with 15 tools, 6 interactive MCP Apps, $1-$500 prepaid spend keys, OAuth 2.1, delegated subagent caps, and Ed25519 receipts.
Agent-native MCP for governed commerce, x402 payments, paid capabilities, and verifiable receipts.
HTTP 402 and x402 billing for APIs and MCP servers. Agents pay your own wallet in USDC, 0% fee.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI agents to discover and pay for x402-gated HTTP APIs, handling 402 Payment Required flows with local signing. Supports EVM and Solana with non-custodial wallet management.3102 npmMIT
- AlicenseAqualityAmaintenanceEnables agents and developers to check x402 endpoints, assess scores and wallet risks, authorize payments with spending rules, and report outcomes before an agent pays.62MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to discover and safely call any x402/AgentCash pay-per-call endpoint with hard budget caps, idempotency keys, spend ledgers, pre-flight cost estimation, and offline-verifiable signed receipts. Exposes search, discovery, paid-call, spend, plan, and receipt tools, plus optional hosted-account balance, recharge, and proxy tools.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to make per-call paid tool requests over HTTP 402, with request-bound payments and replay protection, while returning auditable provenance and self-checks for every answer.MIT