local402
🔒 local402
AI 에이전트를 위한 원클릭 로컬 페이월
모든 로컬 서버를 몇 초 만에 유료 리소스로 전환하세요. 에이전트가 API나 MCP 도구에 접근하기 전에 비용을 지불해야 하는 상황을 테스트하는 데 완벽합니다.
npx local402 --target http://localhost:3000 --price 0.001
이게 뭔가요?
local402는 x402 스타일의 HTTP 402 Payment Required 페이월을 모든 로컬 HTTP 서버나 MCP 도구 앞에 배치합니다 — 단일 명령어, 설정 제로, 블록체인 없이.
결제가 없는 요청은 깔끔한 402를 받습니다. "결제"한 요청은 실제 서버로 바로 프록시됩니다. 그게 전부입니다.
기본적으로 완전 시뮬레이션 모드로 실행됩니다: 지갑, 가스, 외부 서비스, 대기 시간 없음. 즉시, 결정론적 402를 로컬에서 구축하고 테스트할 수 있습니다.
agent ──▶ local402 (402 paywall) ──▶ your server
│
└── no payment? → 402 Payment Required
paid? → proxied response ✅Related MCP server: 402-mcp
💸 왜 local402인가요?
에이전트는 비용을 지불하는 법을 배우고 있습니다 — API 호출, 도구 호출, 데이터, 컴퓨팅. x402 프로토콜은 HTTP 기반 결제를 현실로 만듭니다. 하지만 간극이 있습니다:
실제 돈을 쓰거나, 지갑을 세우거나, 매번 전체 결제 스택을 연결하지 않고 결제하는 에이전트를 어떻게 테스트하나요?
에이전트가 402를 인지하고 결제와 함께 재시도하는지 확인하기 위해 facilitator를 배포하고 테스트넷 지갑에 자금을 조달하고 싶지 않을 것입니다. 한 번의 명령어로 세우고 빠르게 내릴 수 있는 페이월이 필요합니다.
바로 local402입니다.
local402 없이 | local402 사용 시 |
facilitator + 지갑 + 테스트넷 자금 설정 |
|
모든 테스트 실행 시 실제 트랜잭션 | 즉시, 무료, 결정론적 |
테스트 루프에 블록체인 지연 시간 | 0ms — 모두 로컬 |
결제 로직이 앱에 얽힘 | 그 앞에 하나의 리버스 프록시 |
"미결제" 경로 재현 어려움 | 요청 시 보장된 |
다음과 같은 용도로 사용하세요:
✅ AI 에이전트가
402를 처리하고x-payment헤더로 재시도하는지 테스트✅ 체인에 닿지 않고 "호출당 지불" API 또는 MCP 도구 데모
✅ 오프라인, 비행기 안, CI에서 x402 클라이언트 로직 개발
✅ 실제 결제에 투자하기 전에 가격 책정 프로토타입
⚡ 빠른 시작
설치할 필요도 없습니다.
# 1. Have any local server running (your API, MCP tool, whatever)
# e.g. something on http://localhost:3000
# 2. Put a paywall in front of it
npx local402 --target http://localhost:3000 --price 0.001local402가 이제 http://localhost:4020 에서 수신 대기 중이며 서버를 보호하고 있습니다.
# ❌ No payment → 402 Payment Required
curl -i http://localhost:4020/
# ✅ "Pay" → request is proxied to your real server
curl -i http://localhost:4020/ -H "x-payment: simulated"에이전트를 실제 서버 대신 http://localhost:4020으로 지정하면 에이전트가 결제하는 법을 배우는 것을 지켜보세요! 🎉
🛠 사용법
local402 --target <url> [options]플래그 | 별칭 | 기본값 | 설명 |
|
| (필수) | 보호할 서버, 예: |
|
|
| local402가 수신 대기할 포트 |
|
|
| |
|
| 가격에 대한 통화/자산 레이블 | |
|
| 시뮬레이션 모드 — 블록체인 없음, 즉시 (기본값) | |
| 실제 x402 결제용 예약 (출시 예정) | ||
| 색상 콘솔 출력 비활성화 |
규칙
x-payment헤더 없음 →402 Payment Required(도움이 되는 JSON 본문 + 헤더 포함).x-payment: simulated(또는paid) → 요청이--target으로 프록시되고 실제 응답이 그대로 반환됩니다.
시뮬레이션 모드에서는 비어 있지 않은 모든 x-payment 값이 허용됩니다 — simulated와 paid는 단지 표준 값일 뿐입니다.
예시
# Guard an MCP tool on a custom port, charge 0.01
local402 --target http://localhost:8787 --port 9000 --price 0.01
# Free status check — always open, never paywalled
curl http://localhost:4020/__local402🔍 작동 방식
local402는 하나의 원칙을 가진 작은 리버스 프록시입니다: 먼저 지불하고, 그다음 통과.
┌──────────────────────────────┐
│ local402 │
│ :4020 (paywall) │
┌─────────┐ │ │ ┌──────────────┐
│ agent │ ───────▶ │ x-payment header present? │ │ your server │
│ / curl │ │ │ │ :3000 │
└─────────┘ │ NO ─▶ 402 Payment Required │ └──────────────┘
▲ │ │ ▲
│ │ YES ─▶ proxy the request ──┼─────────────────┘
│ │ return real response │ │
└───────────────┤◀──────────────────────────────┼─────────────────┘
402 or proxied response │
└──────────────────────────────┘미결제 응답 (HTTP 402):
{
"x402Version": 1,
"error": "Payment Required",
"message": "This resource costs 0.001 USD. Retry with header 'x-payment: simulated'.",
"accepts": [
{
"scheme": "simulated",
"network": "local",
"maxAmountRequired": "0.001",
"asset": "USD",
"payTo": "local402-simulated",
"resource": "/",
"description": "local402 simulated paywall",
"mimeType": "application/json"
}
],
"hint": "x-payment: simulated"
}402 응답 헤더:
HTTP/1.1 402 Payment Required
x-payment-required: true
x-payment-amount: 0.001
x-payment-asset: USD
x-payment-network: local
accept-payment: x-payment: simulated결제된 요청에서 local402는 시뮬레이션된 결제 영수증을 첨부하여 클라이언트가 엔드투엔드 흐름을 검증할 수 있도록 합니다:
x-payment-response: <base64 JSON receipt with a sim txHash>🗺 로드맵
local402는 의도적으로 간단하게 시작합니다. 계획:
v0.1 — 시뮬레이션 모드. 즉시, 로컬, 블록체인 없는
402페이월. (현재 위치)v0.2 — 실제 x402 결제. 플러그 가능한 facilitator를 통해 실제
X-PAYMENT페이로드 검증.v0.3 — MCP 네이티브 모드. HTTP뿐만 아니라 MCP 도구/리소스에 대한 일급 페이월.
v0.4 — 경로별 가격 책정. 다른 경로와 메서드에 대해 다른 가격.
v0.5 — 사용량 대시보드. 요청, 결제, 수익의 실시간 TUI.
형태를 만들고 싶으신가요? 이슈를 열어주세요.
🤝 기여하기
기여, 아이디어, 버그 리포트 모두 환영합니다 — 친근한 작은 도구로 만들고자 합니다.
git clone https://github.com/wushu75/local402.git
cd local402
npm install
npm run dev -- --target http://localhost:3000 # run from source
npm run build # compile to dist/포크하기 🍴
브랜치 생성 (
git checkout -b feat/amazing-thing)변경 사항 커밋 (
git commit -m 'feat: amazing thing')푸시하고 PR 열기
작은 기여도 환영합니다 — 오타 수정도 도움이 됩니다.
📄 라이선스
MIT © local402 기여자들. 원하는 대로 사용하세요.
⭐ 유용하다면 저장소에 별표를 눌러주세요
local402가 에이전트를 테스트하기 위해 결제 스택을 세우는 수고를 덜어주었다면,
별표를 눌러주세요 — 다른 사람들이 이 도구를 찾는 데 진정으로 도움이 됩니다.
자신의 길을 지불하는 에이전트를 위해 만들어졌습니다. 🔒
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceAg402 is the payment layer for Coinbase's x402 protocol. Wrap any API or MCP server with a paywall in one command (ag402 serve), or let your AI agent auto-pay for paid APIs (ag402 run). Zero code changes for both buyers and sellers. Solana USDC, ~0.5s settlement, non-custodial, 648+ tests, MIT licensed. Works with Claude Code, Cursor, OpenClaw, LangChain, AutoGen, CrewAI out of the box.9MIT
- Alicense-qualityAmaintenanceL402 + x402 client MCP. AI agents discover, pay for, and consume any payment-gated API autonomously. Supports Lightning (NWC), Cashu ecash, stablecoins, and human-in-the-loop payments.371MIT
- Alicense-qualityBmaintenanceHTTP 402 paywall middleware for MCP servers. XRPL/RLUSD native settlement, Phase 3 compliance receipts, zero API keys required.1MIT
- Alicense-qualityDmaintenanceA local MCP proxy that connects to remote MCP servers and automatically handles x402 payments, signing USDC on-chain when a tool returns HTTP 402.71MIT
Related MCP Connectors
Monetize any MCP server: x402 paywall, pay-per-call billing in USDC on Base, agent marketplace.
Pay for HTTP APIs and charge for your own: x402 micropayments in USDC on Base.
Agent x402 Paywall MCP — Coinbase HTTP 402 protocol + on-chain settlement. Agents pay per-call
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/wushu75/local402'
If you have feedback or need assistance with the MCP directory API, please join our Discord server