
x402 Facilitator Proxy
io.github.seob5285-altPublished by GitHub account seob5285-altv1.0.1Updated Oct 24, 2026
Multi-tenant HTTP 402 infrastructure gateway and stdio MCP server for machine payments.
Overview
Lets an assistant handle HTTP 402 machine payments by verifying and settling USDC transactions on Base L2 through a hosted gateway.
- What you can do
- The MCP server exposes the x402 payment flow to an agent over stdio: it registers payment tools, parses HTTP 402 payment challenges, executes USDC split transfers, and submits them to a hosted verification gateway. The gateway validates on-chain settlement on Base L2 and splits funds 99% to the merchant and 1% to a platform vault. Companion Express middleware and LangChain/CrewAI templates show how merchants gate APIs and how agents pay for them.
- When to use it
- Worth adding when an assistant needs to pay for or monetize API access programmatically, for example autonomous agents that hit paywalled endpoints and settle per-request fees in USDC. Not useful for ordinary API calls that need no payment.
- Requirements
- Node.js and npm to install and run the stdio server locally; it is desktop-only. A funded wallet private key supplied through environment variables such as AGENT_PRIVATE_KEY or FACILITATOR_PRIVATE_KEY, plus network access to the hosted gateway and Base L2. Agent templates also reference OPENAI_API_KEY.
Installation
In SourceWeft
- Open x402 Facilitator Proxy in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
X402 Facilitator Proxy - Multi-Tenant Payment Gateway
A decentralized, autonomous payment infrastructure for API monetization on Base L2 with programmatic fee routing and agent-compatible settlement protocols.
🏗️ Architecture Overview
The X402 Facilitator Proxy implements a complete multi-tenant payment gateway that enables merchants to monetize APIs through HTTP 402 "Payment Required" responses, while autonomous agents can seamlessly settle transactions using USDC on Base L2.
🚀 Core Components
1. Cloudflare Worker Proxy Engine
The core backend (src/index.ts) operates as a serverless payment verification gateway deployed on Cloudflare's edge network:
- Endpoint:
https://x402-facilitator-proxy.seob5285.workers.dev/api/v1/verify-and-settle - Platform Vault:
0x2E3DADfb314718849A93c49A78618E586c3b2C60 - Fee Structure: Automated 1% platform fee routing
Key Features:
- Multi-tenant transaction verification
- Base L2 USDC settlement validation
- Automated fee splitting (99% to merchant, 1% to platform)
- Edge-deployed for global low-latency access
2. Model Context Protocol (MCP) Server
The MCP server (x402-client-sdk/src/mcp-server.ts) provides a standardized interface for AI agents to interact with the payment system:
Protocol Features:
- Standard I/O communication interface
- Agent-compatible payment tool registration
- Automatic transaction handling and verification
- Cross-platform AI framework compatibility
3. Merchant-Side API Gating
The Express middleware (templates/express-middleware/x402-guard.js) enables merchants to protect APIs with HTTP 402 challenges:
Middleware Behavior:
- Challenge: Returns HTTP 402 with payment instructions when headers are missing
- Verification: Validates payment through the proxy gateway
- Access: Grants API access upon successful payment verification
4. Autonomous Agent Templates
TypeScript/LangChain Agent (templates/langchain-ts/agent.ts)
Python/CrewAI Agent (templates/crewai-python/agent.py)
🔧 Quick Start
1. Deploy the Proxy Engine
2. Setup the MCP Server
3. Integrate Merchant Middleware
4. Setup Agent Templates
🔐 Security & Environment Variables
Critical Security Guidelines
⚠️ NEVER HARDCODE PRIVATE KEYS IN REPOSITORY FILES
All sensitive credentials must be managed through secure environment variables:
Cloudflare Worker Environment (Production)
Local Development Environment
Create .env files for local testing:
Agent Runtime Security
- TypeScript Agents: Use
process.env.AGENT_PRIVATE_KEY - Python Agents: Use
os.getenv("AGENT_PRIVATE_KEY") - MCP Server: Loads keys from system environment at runtime
🌐 Platform Reference
Core Infrastructure
- Verification Gateway:
https://x402-facilitator-proxy.seob5285.workers.dev/api/v1/verify-and-settle - Platform Vault:
0x2E3DADfb314718849A93c49A78618E586c3b2C60 - Network: Base L2 (Chain ID: 8453)
- Payment Token: USDC (
0x833589fCD6eDb6E08f4c7C32d4f71b54bda02913)
Fee Structure
- Merchant Revenue: 99% of payment amount
- Platform Fee: 1% automatically routed to platform vault
- Gas Optimization: Batched transfers for cost efficiency
📖 Integration Patterns
HTTP 402 Payment Flow
- API Request: Client attempts to access protected endpoint
- Payment Challenge: Server responds with HTTP 402 and payment instructions
- Agent Processing: Autonomous agent detects 402, executes USDC payment split
- Verification: Proxy gateway validates on-chain transaction
- Access Granted: Original API request succeeds with payment headers
Agent Integration Workflow
🛠️ Development Commands
📚 Documentation
- Client Integration Guide: Detailed integration instructions
- LangChain Template README: TypeScript agent setup
- API Reference: Core gateway endpoints and responses
🤝 Contributing
- Fork the repository
- Create feature branches for new integrations
- Test against Base L2 testnet before mainnet deployment
- Submit pull requests with comprehensive test coverage
📄 License
This project is licensed under the MIT License - enabling open-source innovation while maintaining platform sustainability through programmatic fee routing.
Built for the autonomous economy. Powered by Base L2. Secured by multi-tenant verification.
Source: README.md at commit c76feb4
Tools
0Version history
1- v1.0.1LatestSep 16, 2026
Score
40% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts
Declare a license in the repository or the registry entry.