Integration guide

Connect. Run a test.
See what happened.

A free synthetic agent test, a timestamped report and the same case again. No account, wallet or real purchase. Paid data and payment examples are documented separately below.

Start here: a free agent test

Add https://api.402rates.com/mcp to a client supporting remote Streamable HTTP MCP. The server currently exposes 17 tools: 13 free and 4 paid. The five tools below are free and never make a real purchase.

{
  "mcpServers": {
    "402rates": { "url": "https://api.402rates.com/mcp" }
  }
}

This configuration block is for clients that accept an mcpServers configuration. Other clients expose a remote-server URL field. Connection alone does not start a test or authorize a paid call.

StepMCP toolInput and result
Inspect the casedescribe_agent_testNo arguments. Returns the task, exact case version, cost and limits.
Start a runstart_agent_testcase_id and case_version. Returns fresh run/task identifiers and a short-lived access token.
Perform a synthetic actionexecute_test_actionrun_id, task_id, access_token, a caller-generated UUID action_key, and quantity: 1.
Observe task stateinspect_test_staterun_id, task_id and access_token. Returns synthetic operation records.
Read or finish the reportread_agent_test_reportrun_id and access_token. Optional finalize: true freezes the timeline and ends actions.

Start arguments for the current case:

{
  "case_id": "commit_then_confirmation_unavailable",
  "case_version": "1.0.0"
}

An explicit task for the connected agent can be: create exactly one synthetic operation with quantity one, establish its state, then finalize the report. The agent's own tool calls drive the test; a fixed sequence of calls only demonstrates the interface.

The first committed action deliberately returns TEST_ACTION_OUTCOME_UNKNOWN: MCP isError: true, or HTTP 502. This replaces the normal confirmation on the application level. It is not a measured network timeout. Identical action keys with identical input replay the stored operation; new keys can create additional synthetic operations. The report shows the sequence without rating the agent.

Repeat the same case

After finalizing the first run, call start_agent_test with the same case identifier/version, its previous_run_id and its access_token. The result contains new identifiers and a new token. The task starts empty and the same confirmation replacement is applied again.

The repeated report includes the earlier frozen timeline under comparison.previous while it remains available. Optional configuration_changed is caller-declared, never independently verified. There is no score, certification or conclusion that an agent is generally reliable.

Runs are active for at most five minutes, with twenty action calls and forty read calls in total. Access expires twenty-four hours after creation. Caller model/hosting costs remain external. The token is returned once; losing it means losing access to that run.

For a local connector, use Node 22 or later, install the MCP SDK and save agent-test.mjs:

npm install @modelcontextprotocol/sdk@1.30.0

The module exports connectAgentTest({ api, transport }) and connection.call(toolName, arguments). It performs no automatic retry. The default transport is MCP; transport: "http" uses HTTP.

Saved report JSON can be rendered locally using agent-test-report.mjs:

node agent-test-report.mjs repeated-report.json repeated-report.html

# An archived prior run can also be paired after server retention expires:
node agent-test-report.mjs current.json comparison.html --previous=earlier.json

A locally supplied prior report is explicitly labelled as such, without authenticating its origin. The case/version must match and the earlier run must have ended before the current start. Reports contain calls, timestamps, executed operations and state. Versioned JSON schema.

HTTP equivalents are GET /v1/tests/case and POST JSON to /v1/tests/run, /v1/tests/action, /v1/tests/state and /v1/tests/report. HTTP tokens use the X-Test-Access-Token header, never the URL or JSON body. All POST inputs are bounded to 8 KiB. Full input and error contracts.

Test scope and report use ยท Data handling and retention. Other failure classes, real payments and network disconnections are outside this case.

1. Read a free sample

Open the USTB instrument record to see the response shape, yield basis, terms and source evidence.

curl "https://api.402rates.com/v1/rwa/instrument?ticker=USTB"

Up to three distinct instruments per rolling hour are free across instrument and history calls. Repeating those instruments stays free. Current coverage is public.

2. Choose the result you need

ResultMCP toolUSDC per call
Payment check and free/paid capability directorytest_payment0.001
Measured and quoted RWA yields, with provenanceget_rwa_yields0.03
All tracked instrument records, including terms and evidenceget_rwa_instruments5
Full settlement cost comparisoncompare_settlement_costs0.01

The same products are available over HTTP at /v1/rwa/yields, /v1/rwa/instruments and /v1/settlement/costs. The full snapshot is a single purchase with internal-use and attribution terms. Data-use terms.

Each paid call buys the described result for that request. The main obligation is fulfilled on delivery of the agreed result to your client, within the published scope and limits. Payment alone does not establish delivery. No ongoing monitoring, automatic updates or later transactions are included unless expressly agreed. Repeated individual purchases are permitted under the same use terms. Claims concerning a failed or defective delivery remain unaffected. Per-call scope and completion; separate test-run access and report limits.

For non-delivery after payment, duplicate charges for the same payment authorization or a calculation inconsistent with its supplied inputs and published method, email info@402rates.com. Include the capability, payment network, transaction identifier and available evidence with secrets removed. Reports are reviewed manually; statutory rights remain unaffected.

3. Install and supply your wallet locally

Use Node 20.6 or later. In a new local directory, install the packages below. Supply your wallet key through the EVM_PRIVATE_KEY environment variable using your local secret manager. The examples use USDC on Base, chain eip155:8453.

npm init -y
npm install @modelcontextprotocol/sdk@1.30.0 @x402/core@2.17.0 @x402/evm@2.17.0 @x402/mcp@2.17.0 viem@2.55.0

Connecting an MCP server exposes its tools. Paid calls also require an x402 payment-capable client and a wallet with enough USDC. The examples sign a real purchase when run with a funded key.

Paid capabilities are for business/professional use only, under the service and data-use terms. The HTTP v2 payment resource description and paid MCP descriptions include this notice before payment. Paid HTTP endpoints also return a Link header with rel="terms-of-service" and X-Paid-Service-Audience. The legacy XDC mirror supplies these headers while retaining its existing payment-body format.

4. Download and run the MCP example

Save mcp-paid-rwa.mjs in that directory. The default call buys USTB yields with a 0.03 USDC ceiling. The full snapshot requires --snapshot and has a 5 USDC ceiling.

node mcp-paid-rwa.mjs

# Separate purchase: full snapshot, up to 5 USDC
node mcp-paid-rwa.mjs --snapshot

The client reads the server's payment terms, accepts only Base USDC within its limit, signs and retries. A successful result includes a settlement receipt. A yield selection with no usable figure returns a data error without settlement.

Payment diagnostics

The same download can make a payment check with a 0.001 USDC ceiling:

node mcp-paid-rwa.mjs --ping

This performs a real Base USDC purchase when run with a funded key. It prints the capability directory and, separately, the call round-trip time and facilitator receipt. It does not perform independent chain confirmation.

GET /v1/ping costs 0.001 USDC and performs no external data lookup. Its next field lists free capabilities first, then paid capabilities with exact prices, and the MCP address. test_payment provides the same check over MCP.

HTTP payment networks can include Base, Polygon, Arbitrum and XDC. Each transport's current challenge lists the available options. Selecting one network tests that network only; an automatic fallback would test a different configuration.

The HTTP PAYMENT-RESPONSE receipt (legacy XDC: X-PAYMENT-RESPONSE) and the MCP paymentResponse contain the settled network and transaction identifier. The response body's rail identifies the transport. A transaction identifier alone is not independent confirmation of recipient funds.

Client round-trip time includes the connection, server work and settlement. Separate verification and settlement durations are not currently published. A failed or interrupted paid response has an uncertain payment outcome; receipt reconciliation precedes another purchase.

HTTP and discovery examples

node-paid-yield.mjs buys the same USTB yield result over HTTP with a 0.03 USDC ceiling and the same installed packages.

node node-paid-yield.mjs

mcp-discovery.mjs and coinbase-bazaar-target.mjs make free discovery calls. They require Node with built-in fetch, with no additional packages or wallet.

Free MCP tools are available at https://api.402rates.com/mcp using Streamable HTTP. See the OpenAPI manifest for HTTP arguments and response contracts.