# Site report examples

Copy-paste examples for one site report: discovery, refusals before payment, the x402 payment, polling, and saving the
client-ready files. Status of the service: **available**; price: **US$0.01 per report (x402, USDC on Base)**.

| File | What |
|---|---|
| [curl.sh](https://shop.lordevo.com/agency/examples/curl.sh) | curl, step by step (uses node/sign-payment.mjs to sign the payment) |
| [node/site-report.mjs](https://shop.lordevo.com/agency/examples/node/site-report.mjs) | Node 20+: the lordevo-x402 SDK for the free catalog, @x402/fetch to pay, poll, save files |
| [node/sign-payment.mjs](https://shop.lordevo.com/agency/examples/node/sign-payment.mjs) | Node helper: reads the 402 terms and prints the PAYMENT-SIGNATURE value |
| [python/site_report.py](https://shop.lordevo.com/agency/examples/python/site_report.py) | Python: requests + the x402 package (same flow as the Node example) |
| [mcp/claude-desktop.json](https://shop.lordevo.com/agency/examples/mcp/claude-desktop.json) | Claude Desktop (stdio bridge `mcp-remote` to the HTTP server) |
| [mcp/cursor.json](https://shop.lordevo.com/agency/examples/mcp/cursor.json) | Cursor (`~/.cursor/mcp.json` or `.cursor/mcp.json`) |
| [mcp/generic-http.json](https://shop.lordevo.com/agency/examples/mcp/generic-http.json) | Clients that take a streamable HTTP server (e.g. Cline) |
| [mcp/http-jsonrpc.sh](https://shop.lordevo.com/agency/examples/mcp/http-jsonrpc.sh) | The MCP calls as plain JSON-RPC with curl |
| [a2a/message-send.json](https://shop.lordevo.com/agency/examples/a2a/message-send.json), [a2a/message-send.sh](https://shop.lordevo.com/agency/examples/a2a/message-send.sh) | A2A message/send to the free router |

## Run them against a local dev shop first (no real money)

From the shop's dev folder:

```bash
node tools/agency-dev-server.mjs --fixtures     # http://127.0.0.1:4999, dry mode, mock facilitator, offline test sites
```

Then, from `docs/agency/examples`:

```bash
export SHOP=http://127.0.0.1:4999 TARGET=https://acme-bakery.example
export BUYER_PRIVATE_KEY=0x...   # any throwaway key: the dev shop's mock facilitator moves no money
sh curl.sh
node node/site-report.mjs
```

Without `--fixtures` the dev shop reads real public sites: use a site you own or may assess (for example
`TARGET=https://lordevo.com`, which is the default and is owned by Lordevo).

The dev shop runs on the Base Sepolia test network with a mock facilitator: the payment signature is checked, nothing
is sent on chain. The dev shop lists the site report as on sale so the whole flow can be tried; the real shop sells it at US$0.01 per report (x402, USDC on Base).

## Against the real shop

Set `SHOP=https://shop.lordevo.com` and use a key that holds USDC on Base. Check first that the service is on sale:
`curl -s https://shop.lordevo.com/services.json` (slug `site-report`, `tiers[0].on_sale`). While it is not, the
endpoint answers 503 `not_for_sale_yet` and nothing is charged. Keep the spending cap (`MAX_PRICE_USD`) at the lowest
value you accept.

## MCP

- The server is `https://shop.lordevo.com/mcp` (streamable HTTP, JSON). In the files above it points at the dev shop;
  change the URL for the real one.
- Claude (desktop or web) can also add it under Settings > Connectors > Add custom connector (public https URL only).
- The tools `site_report` (paid) and `site_report_status` (free) are listed only while the service is on sale.
- MCP clients do not sign payments on their own. A paid call returns the x402 PaymentRequired result (`isError: true`,
  terms in `structuredContent`); your agent signs it with an x402 client and calls again with
  `params._meta["x402/payment"]`, or uses a wallet MCP server such as Coinbase payments-mcp against the HTTP endpoint.
- The client config files follow each client's documentation; they were not tried inside each client. The JSON-RPC
  calls in mcp/http-jsonrpc.sh were run against the dev shop by the test suite.

## What the test suite runs

`test/agency-200.test.js` starts a dev shop (dry mode, mock facilitator, offline fixture sites) and runs every `curl`
line of curl.sh, mcp/http-jsonrpc.sh and a2a/message-send.sh, plus node/site-report.mjs, and checks the answers
(refusals before payment, 402 terms, paid report, polling, saved files). The Python example and the client config files
are not executed by it.
