cloudflare / cloudflare/agents
feat(example): optional pre-payment policy guard for x402 MCP client
- Dominant language
- TypeScript
- Stars
- 5.6k
- Forks
- 711
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 53
Description
Hi maintainers — filing before a PR per CONTRIBUTING.
Would an opt-in policy check fit the existing `examples/x402-mcp` example?
The draft composes with the existing `confirmationCallback`:
1. existing human confirmation
2. optional plain-fetch IntentFence preview
3. sign only on `safe_to_proceed`
It is disabled unless `INTENTFENCE_PREFLIGHT_URL` is set, adds no dependency, and fails closed only after explicit opt-in. It sends the selected x402 network, recipient, asset, and USDC amount, and clearly documents that the free preview is advisory and does not prove authorization or settlement.
Draft: https://github.com/razel369/agents/tree/codex/intentfence-x402-preflight/examples/x402-mcp
Validation: 6 tests, TypeScript, focused lint/format, and Vite build.
If this product-specific URL is not suitable upstream, I am happy to generalize the hook or keep it as an external integration. Is this in scope for a PR?
Contributor guide
Assessment
This issue has not been assessed yet.