# x402 Behavior

## Challenge-First Calls

Some hosted Disruption Intelligence API endpoints are paid. When this MCP calls a paid endpoint without payment credentials, the API can respond with `402 Payment Required`.

The MCP treats that as expected behavior. It returns a structured payment challenge summary instead of throwing an opaque upstream error.

## Returned Metadata

When available, the response includes:

- HTTP status `402`
- payment-related response headers
- decoded challenge metadata from the payment challenge header
- human-readable instructions explaining that this MCP is in safe non-settling mode

The exact challenge metadata is controlled by the hosted API and the x402 facilitator flow.

## Why Default To Challenge Inspection

Private key handling is a high-risk boundary. This MCP package is intentionally a thin client and does not settle payments by default.

Challenge inspection lets agents discover:

- which endpoint requires payment
- what payment metadata is advertised
- which external wallet or payment client should handle settlement
- what request should be retried after payment

## Event Industry Output

Paid event-level routes can return `industry_classification` after settlement. The hosted API supplies this object; the MCP does not infer or rewrite industry data locally.

Expected fields include:

- `label`
- `naics_sector`
- `naics_code`
- `method`
- `confidence`
- `source_text`
- `coverage_note`

Agents should treat `confidence` and `coverage_note` as part of the paid output, especially when comparing source-provided NAICS against weaker source-text classification.

## Future Paid Execution Model

Future paid execution should use a standard, trusted x402 client pattern and remain opt-in. A safe implementation should:

- never log private keys
- never require private keys in plain MCP prompts
- provide dry-run behavior for tests
- document every environment variable
- make settlement explicit at the call site
- keep unpaid challenge inspection as the default behavior
