Skip to content

Repository files navigation

nzrt-x402

Pay-per-query knowledge API for the NZRT Network vault — powered by x402 micropayments on Base.

Live at https://api.nzrtnetwork.com

What it is

An AI agent calls an endpoint. The server returns HTTP 402 with payment details. The agent pays $0.001 USDC on-chain via the x402 facilitator, retries with proof, and gets the knowledge back. No API keys. No subscriptions. Agent pays at request time.

AI agent  →  GET /ncl/search?q=users
          ←  402 X-Payment-Required: <base64>
          →  pay $0.001 USDC on Base
          →  retry with X-Payment header
          ←  200 { results: [...] }

Endpoints

Path Description Auth
GET /health Status, network, domains Free
GET /wiki/search?q= Full-text search across all vault x402
GET /wiki/note?section=&file= Fetch any vault note x402
GET /togaf/search?q= Search TOGAF / EA content x402
GET /togaf/phase?n=&doc= Fetch TOGAF ADM phase doc x402
GET /<domain>/search?q= Search a specific domain x402
GET /<domain>/note?section=&file= Fetch note from a domain x402

Available domains: ncl dol wor git inf llm bch k8s

Knowledge Topics

Topic Code Content
bch 000BCH x402 protocol, USDC, Base network, wallet setup, smart contracts
dol 000DOL Dolibarr ERP: CRM, invoicing, HR, products, agent REST API patterns
git 000GIT GitHub repos, workflows, deploy pipelines, agent scripts
inf 000INF Hosting, subdomains, cPanel, Tailscale VPN, security architecture
k8s 000K8S Minikube, Kagent orchestration, agent deployments
llm 000LLM AI agent roles, task definitions, MCP servers, workflows
ncl 000NCL Nextcloud: setup, agent folders, WebDAV, OCS API, user management
wor 000WOR WordPress: ICS site, NCS site, REST API, Kadence, WP agent patterns

Each Topic has folder-level section= values — see https://api.nzrtnetwork.com/<domain>/ for the full section reference.

Example

# Search all vault content
curl -i "https://api.nzrtnetwork.com/app/wiki/search?q=x402"

# Fetch a specific note (after x402 payment)
curl -i "https://api.nzrtnetwork.com/app/bch/note?section=01+-+Core+Concepts&file=Ethereum+%26+Base+Network"

# Check API status (free)
curl "https://api.nzrtnetwork.com/app/health"

Repo structure

python-resource-server/   Flask x402 resource server (deployed to Hoopla cPanel)
mcp-server/               TypeScript MCP client (Claude Desktop integration)
resource-server/          TypeScript resource server (experimental)

Setup

Python resource server

cd python-resource-server
pip install -r requirements.txt
cp .env.example .env   # fill in values
python app.py

.env values needed:

VAULT_PATH=/path/to/obsidian/vault
EVM_ADDRESS=0x...          # receiving wallet
FACILITATOR_URL=https://x402.org/facilitator
NETWORK=eip155:84532       # Base Sepolia (testnet) or eip155:8453 (mainnet)
PRICE_PER_REQUEST=$0.001

MCP server (Claude Desktop)

cd mcp-server
npm install
npm run build

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "nzrt-wiki": {
      "command": "node",
      "args": ["/path/to/nzrt-x402/mcp-server/dist/index.js"],
      "env": {
        "EVM_PRIVATE_KEY": "0x...",
        "RESOURCE_SERVER_URL": "https://api.nzrtnetwork.com/app"
      }
    }
  }
}

The MCP server auto-pays x402 when Claude calls get_wiki_note or search_wiki.

Network

  • Testnet: Base Sepolia — public x402.org facilitator (unauthenticated), NETWORK=eip155:84532. Current.
  • Mainnet: Base — Coinbase CDP facilitator. The public x402.org facilitator does not settle Base mainnet (its /supported lists Base Sepolia only), so mainnet routes through CDP.

The middleware picks the facilitator automatically: set the CDP Secret API Key and every verify/settle call is authenticated with a short-lived JWT to https://api.cdp.coinbase.com/platform/v2/x402; with no CDP key, calls go to FACILITATOR_URL unauthenticated (the testnet path). CDP fees: first 1,000 onchain settlements/month free, then $0.001 each.

Go live — set on the server .env (uses the x402 v2 schema):

NETWORK=eip155:8453
EVM_ADDRESS=<Base-mainnet receiving address>
CDP_API_KEY_ID=<CDP Secret API Key id>
CDP_API_KEY_SECRET=<CDP Secret API Key secret>

The CDP path needs cryptography vendored for the server's Python (3.8) to sign the JWT.

Pricing

$0.001 USDC per request. Set via PRICE_PER_REQUEST in .env — do not use cPanel environment variables (lswsgi shell-expands $ in values).

Contact

nathan@nzrtnetwork.com
nzrtnetwork.com

About

NZRT x402 micropayment API — Flask resource server + MCP client

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages