@sovroute/doctor
v1.1.0
Published
The open-source conformance probe and diagnostic doctor for x402, L402, and agent payment endpoints.
Maintainers
Readme
@sovroute/doctor (x402-doctor)
The open-source conformance linter and diagnostic doctor for x402, L402, and autonomous agent payment endpoints.
Zero dependencies. Instant execution. Evaluates any HTTP 402 server against production RFC standards, header budget limits, and machine discovery specs.
⚡ Quick Start
Run instantly without installation:
npx @sovroute/doctor https://api.myserver.devOr audit a specific paid endpoint:
npx @sovroute/doctor https://sovroute.com/v1/chain/btc/tip🔍 What it Diagnoses
- HTTPS Transport Security: Verifies TLS encryption; autonomous agent wallets automatically abort unencrypted HTTP transactions.
- Machine Spec Discovery: Scans standard paths (
/openapi.json,/.well-known/openapi.json,/swagger.json,/openapi.yaml) for machine-readable API contracts. - HTTP 402 Challenge Status: Verifies whether unauthenticated requests return a standard
HTTP 402 Payment Requiredstatus instead of throwing400 Bad Request,422 Unprocessable Entity, or500 Internal Server Error. - Challenge Headers: Validates the presence and format of
Payment-RequiredandWWW-Authenticateheaders. - Header Size Budget (GitHub #3803 Guard): Measures exact header byte length. Unbounded challenge payloads exceed the 8 KB limit of Python aiohttp and 16 KB limit of Node.js, causing clients to drop connections before parsing.
- Payment Rails & Networks: Auto-detects supported protocols (
x402,l402,mpp) and networks (Base USDC,Polygon,Arbitrum,Bitcoin Lightning,Tempo PathUSD). - Agent Discovery (
/llms.txt): Checks for developer and LLM agent markdown documentation.
📊 Sample Output
┌────────────────────────────────────────────────────────┐
│ SovRoute x402-doctor — Conformance Diagnostic Report │
└────────────────────────────────────────────────────────┘
Target: https://sovroute.com/v1/chain/btc/tip
Latency: 94 ms · Timestamp: 2026-11-24T20:11:40.903Z
Rails: X402, MPP (eip155:8453, eip155:5042, eip155:5042002)
DIAGNOSTIC CHECKS:
[✔ PASS] HTTPS Transport Security (10/10 pts)
[✔ PASS] Machine Spec Discovery (20/20 pts)
Found at /openapi.json
[✔ PASS] HTTP 402 Payment Required Status (30/30 pts)
Returns standard HTTP 402 on /v1/chain/btc/tip
[✔ PASS] Challenge Headers (Payment-Required / WWW-Authenticate) (20/20 pts)
Both Payment-Required and WWW-Authenticate present
[✔ PASS] Header Size Budget (< 8 KB) (10/10 pts)
5610 bytes (Safe for aiohttp 8KB & Node 16KB)
[✔ PASS] Agent Discovery (llms.txt) (10/10 pts)
Found at /llms.txt
────────────────────────────────────────────────────────
CONFORMANCE SCORE: 100 / 100 GRADE: A+
────────────────────────────────────────────────────────
✔ Endpoint is fully conformant with production agent payment standards!🛠️ CI / CD Integration
Use the --json flag to integrate x402-doctor into GitHub Actions or automated staging pipelines:
npx @sovroute/doctor https://staging.api.dev --jsonExit Codes (Legacy Mode):
0: Pass (Score >= 70, Grade A+ / A / B)1: Fail (Score < 70, Grade C / F, or unreachable/restricted host)
Open402 Initiative Mode (--open402)
Run protocol-neutral 4-profile conformance (core, l402, x402, mpp) with SafeTransport SSRF/DNS-rebinding protection:
npx @sovroute/doctor https://api.myproject.com/paid --open402 --json- Exit Codes:
0COMPLIANT,1NON_COMPLIANT,2AUDIT_ERROR,3INVALID_ARGUMENTS,4PROVISIONAL (passive audits cap here),5UNSUPPORTED. - Active Testnet Mode (
--open402 --active --i-authorize-testnet-spend): Opt-in testnet/sandbox only (lntb/lnbcrt, Base Sepolia, etc.), configurable--max-spend-sats/--max-spend-atomic, mainnet refused. ConfigureOPEN402_LND_TESTNET_REST_URL+OPEN402_LND_TESTNET_MACAROONorOPEN402_X402_TESTNET_SIGNER_URL.
# .github/workflows/x402-conformance.yml
name: x402 Conformance Check
on: [push, pull_request]
jobs:
audit:
runs-on: ubuntu-latest
steps:
- name: Run x402-doctor
run: npx @sovroute/doctor https://api.myproject.com🏛️ Built by SovRoute
- Web: https://sovroute.com
- Interactive Web Auditor: https://sovroute.com/audit
- Manifesto: MANIFESTO.md
- License: Apache-2.0
