An MCP server over the same rail, speaking JSON-RPC 2.0. initialize and tools/list are free; tools/call costs one authorization and answers 402 until it carries one.
Discovery is free and answers are paid by design: an agent cannot decide a price is worth paying for a tool it has not been allowed to read the description of.
Two tools. rail_stats reports samples, median headroom, and the worst and best observed per rail; choose_rail ranks them and returns the one to pay on. Three refusals never charge — arguments the tool will not accept (refused before the gate, since a response cannot be un-served), no settlements observed at all, and a tool that does not exist, which is a tool error rather than a JSON-RPC error so a model can tell 'the server said no' from 'the call never arrived'.
Send the same body in both the request that receives the 402 and the retry carrying the signature; a different one is a different purchase settled against the first one's authorization. A JSON-RPC notification (no id) is answered 202 with no body.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/x402/mcp" \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "method": "string" }'{ "jsonrpc": "2.0", "id": "string", "result": { "property1": null, "property2": null }, "error": { "code": 0, "message": "string" }}Which rail to pay on, and why
The ordering inside a `402` already carries the answer, but an agent reading `accepts[0]` cannot see what the order was based on. This is that reasoning in the open: median headroom, how many settlements it is over, and whether the choice was a choice at all. _Headroom_ is the seconds an order had left before its deadline when it landed. `unobserved: true` means no rail had enough observations and the first accepted rail was taken.
Quote a resource without calling it
The price and rails, without making the call being decided about. Not part of the x402 specification — the price normally rides a `402` — but a client deciding whether to pay should not have to make the call first.