
x402 Facilitator Proxy
io.github.seob5285-alt由 GitHub 帳號 seob5285-alt 發布v1.0.1更新於 Oct 24, 2026
Multi-tenant HTTP 402 infrastructure gateway and stdio MCP server for machine payments.
概覽
讓助理透過託管閘道處理 HTTP 402 機器付款,在 Base L2 上驗證並結算 USDC 交易。
- 可以做什麼
- 此 MCP 伺服器透過 stdio 向代理開放 x402 付款流程:註冊付款工具、解析 HTTP 402 付款要求、執行 USDC 分帳轉帳,並提交至託管驗證閘道。閘道在 Base L2 上驗證鏈上結算,並將資金拆分為 99% 給商家、1% 給平台金庫。隨附的 Express 中介軟體與 LangChain/CrewAI 範本示範商家如何對 API 收費,以及代理如何付款。
- 適用情境
- 當助理需要以程式化方式為 API 存取付費或變現時適用,例如自主代理存取付費端點並以 USDC 按次結算費用。對不需要付款的一般 API 呼叫沒有用處。
- 執行需求
- 需要 Node.js 與 npm 在本機安裝並執行此 stdio 伺服器,僅支援桌面端。需要提供有資金的錢包私鑰,透過 AGENT_PRIVATE_KEY 或 FACILITATOR_PRIVATE_KEY 等環境變數傳入,並需要連線至託管閘道與 Base L2 的網路。代理範本另引用 OPENAI_API_KEY。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 x402 Facilitator Proxy,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
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.
來源:README.md,提交 c76feb4
工具
0版本歷史
1- v1.0.1最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。