mayarin
POST
/x402/mcp

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"  }}