# Claude Agent SDK: check several quotes on one page

Last updated: 2026-10-12

A Claude Agent SDK agent that checks up to 20 quotes from one web page in one call to `POST /v1/verify/quotes` before it cites them. Price: US$0.02 per call, for 1 to 20 quotes. Each quote comes back `exact`, `fuzzy` or `none`, with offsets and context, plus the page's verdict and an Ed25519-signed receipt. Payments are in USDC with x402 v2 on Base mainnet (real USDC).

Two ways to connect: the `quoteproof-mcp` server over stdio, which pays with x402 from your key, or the remote MCP endpoint over HTTP.

The same check for other frameworks: [LangChain](https://vehcdj664efetfrsolne5umanq.srv.us/examples/langchain.md), [LlamaIndex](https://vehcdj664efetfrsolne5umanq.srv.us/examples/llamaindex.md) and [OpenAI Agents SDK](https://vehcdj664efetfrsolne5umanq.srv.us/examples/openai-agents.md).

## Install

Node.js 20.3 or later.

```sh
npm init -y && npm pkg set type=module
npm install @anthropic-ai/claude-agent-sdk
export ANTHROPIC_API_KEY=...
```

`quoteproof-mcp` needs no install: `npx` fetches version 0.1.33 from [`/dl`](https://vehcdj664efetfrsolne5umanq.srv.us/dl/index.json), which lists its sha256. To pay, set `QUOTEPROOF_X402_KEY` to the private key (`0x` and 64 hex digits) of a wallet holding a little USDC. The key stays in the MCP server's process.

## With the stdio MCP server

```js
// agent.mjs: checks quotes with attestpage_verify_quotes before citing them.
import { query } from '@anthropic-ai/claude-agent-sdk';

const ORIGIN = 'https://vehcdj664efetfrsolne5umanq.srv.us';
const env = { QUOTEPROOF_URL: ORIGIN, QUOTEPROOF_NETWORKS: 'eip155:8453', QUOTEPROOF_MAX_USD: '0.02', QUOTEPROOF_SESSION_USD: '0.20' };
if (process.env.QUOTEPROOF_X402_KEY) env.QUOTEPROOF_X402_KEY = process.env.QUOTEPROOF_X402_KEY;

const prompt = 'Does https://www.iana.org/help/example-domains say "These domains may be used as illustrative '
  + 'examples in documents" and "without prior coordination with us"?';

for await (const message of query({
  prompt,
  options: {
    mcpServers: {
      attestpage: { type: 'stdio', command: 'npx', args: ['-y', `${ORIGIN}/dl/quoteproof-mcp-0.1.33.tgz`], env },
    },
    // Tools from an MCP server are named mcp__<server>__<tool>.
    allowedTools: ['mcp__attestpage__attestpage_verify_quotes', 'mcp__attestpage__attestpage_verify_receipt'],
    systemPrompt: 'Before you quote a web page, call attestpage_verify_quotes once with the url and every quote you plan to use. '
      + 'Cite a quote only when its match is exact or fuzzy and page.content_kind is real. '
      + 'If a tool fails with trial_exhausted or payment_refused_locally, give the price and stop.',
    maxTurns: 6,
  },
})) {
  if (message.type === 'result') console.log(message.subtype === 'success' ? message.result : `stopped: ${message.subtype}`);
}
```

```sh
node agent.mjs                             # free trial
QUOTEPROOF_X402_KEY=0x... node agent.mjs   # pays US$0.02 per call in USDC
```

The server refuses any offer on a network not in `QUOTEPROOF_NETWORKS` (Base) or above `QUOTEPROOF_MAX_USD` with `payment_refused_locally` and signs nothing. A paid result carries the settlement (transaction hash, payer, network) in `_meta["x402/payment-response"]`.

## With the remote MCP endpoint

No local process: point the SDK at `POST https://vehcdj664efetfrsolne5umanq.srv.us/mcp` (streamable HTTP).

```js
mcpServers: {
  attestpage: { type: 'http', url: 'https://vehcdj664efetfrsolne5umanq.srv.us/mcp' },
},
```

Paid tools use the free trial, then return the payment requirements. To pay over HTTP, the client puts an x402 payment payload in `_meta["x402/payment"]` of the tool call; the stdio server above does this for you. See [MCP server](https://vehcdj664efetfrsolne5umanq.srv.us/docs/mcp).

## What comes back

- `results[i].match`: `exact`, `fuzzy` or `none`, in the order of `quotes`. Read `page.content_kind` first: `none` on a `bot_wall` or `js_shell` page means the page could not be read.
- `receipt`: a signed JWS of what the fetcher saw and when. `attestpage_verify_receipt` checks it for free, or check it offline with [`verify-receipt.mjs`](https://vehcdj664efetfrsolne5umanq.srv.us/docs/verify-offline).
- A request with a bad URL or an empty quote is refused before payment and not charged.

## Terms

Pay per call, no account. See [Payments](https://vehcdj664efetfrsolne5umanq.srv.us/docs/payments), [Limits](https://vehcdj664efetfrsolne5umanq.srv.us/docs/limits) and the [Terms](https://vehcdj664efetfrsolne5umanq.srv.us/terms).
