SpendPreflightdocs
Start / developer guide

x402 MCP quickstart

Connect SpendPreflight, make a free first call, then review a payment before signing.

Operator-maintained documentation
Live features and staging previews are distinguished. Index coverage is not yet available.

1. Connect the remote MCP server

Use https://api.spendpreflight.com/mcp with a client that supports remote Streamable HTTP. Connecting and discovering tools need no SpendPreflight account, API key or wallet. In clients that accept an mcpServers JSON configuration, add the entry below. Other clients provide a remote-server URL field; enter the same URL there. This configuration connects the server; it does not enable payments.

Copy snippet
{
  "mcpServers": {
    "spendpreflight": {
      "url": "https://api.spendpreflight.com/mcp"
    }
  }
}

2. Make the first call free

Ask your client to call get_service_info with empty arguments. It returns service information, tool groups and pricing. Look for pricing.preflight_payment: "$0.02". This is a free discovery result, not an allow decision or a paid preflight. No payment tool is needed for this step.

Copy snippet
{
  "name": "get_service_info",
  "arguments": {}
}

3. Review before signing

For an actual review, pass the merchant challenge and your rules to preflight_payment before your wallet signs. An eligible existing shared trial may apply; otherwise the remote review costs 0.02 USDC. Approve that separate screening fee deliberately. Allow means the configured rules passed, hold needs review, and block means stop. A missing or invalid response is not an allow. Keep enforcement in the payment path and keep the wallet's own limits enabled.

Copy snippet
Before signing an x402 payment, review the exact resource, amount, recipient, network and asset with preflight_payment and my spending rules. Stop on block. On hold or an unavailable result, show me the reasons and wait. Do not pay for screening or pay the merchant without the required approval.

What this setup checks

Preflight combines spending rules, payee screening and cached price/recipient evidence where available. Missing history stays unknown; allow does not prove continuous liveness, delivery or safety. Registry-to-wallet binding and transfer receipts are separate tools. The instruction above tells an agent what to do; your application must prevent direct access to an unguarded payment path. The advanced integration notes below explain that boundary.

Checking a store before a purchase

Use check_merchant in basic mode for a free review of the information you supply. Explicit deep mode costs 0.01 USDC and adds public observations. Its phishing lookup uses Sinking Yachts, which focuses on Discord phishing. A store can be missing from that list and still be fraudulent. If the store blocks automated checks for the requested page, the tool returns merchant_robots_denied with not_charged set to true.

Allow time for deep checks

Deep checks may wait on DNS, robots rules and third-party responses. Typical production latency has not been measured. For interactive clients, 25 seconds is a suggested time to stop waiting and show a pending result. The server can continue after the client times out. Its collection budget allows new fetches for up to 85 seconds. A timeout leaves the outcome unknown. Avoid automatically submitting another paid request.

Authentication and paid access

Authentication method: none. Connecting, initialize and tools/list require no SpendPreflight account, API key, OAuth or Authorization header. This does not make every tool free: paid calls separately require an approved x402 payment unless an existing free path or eligible shared trial applies. Your client must support x402 payment metadata and obtain your approval before spending. The public MCP discovery card and registry publisher metadata declare this distinction; they do not grant payment authorization.

preflight_payment: Spend Policy (free)

SDK 0.4.0 includes a free JSON Spend Policy helper for daily/per-call caps, merchant allow/block lists, hold thresholds and exact network/asset pairs. Attach it before signing: local gates run first, then explicit remote preflight returns allow, hold or block with reasons. Offline checks hold; a local preview is not authorization. The helper never signs or settles. Reservations are in-process per controller and UTC day, not a durable wallet-wide budget; failed or abandoned approvals retain reservations. The existing remote preflight fee is separate and needs its own guarded budget.

Using Spend Policy with Coinbase payments MCP

Coinbase's @coinbase/payments-mcp (now documented as Agentic Wallet MCP) provides user-set per-call and per-session limits that agents cannot change. Keep those controls enabled. SpendPreflight SDK 0.4.0 can accompany it as application-owned policy, but installing both does not automatically enforce our policy. Its daily cap is an in-process UTC-day reservation budget, not Coinbase's session limit or a durable wallet-wide ledger.

A trusted application must obtain the full x402 v2 challenge and selected exact requirement, apply an explicitly configured Spend Policy check, and reject hold/block before any payment dispatch. A local evaluate() preview is not authorization; check() holds without remote preflight, whose separate fee needs its own guarded budget. Validate that the network/native-USDC pair is supported by SDK 0.4.0; Coinbase supporting a network does not make it supported by this helper.

The documented MCP payment tool pays automatically; its public interface does not document our required onBeforePaymentCreation hook or an exact-approved-quote binding. controller.attach() therefore cannot simply attach to an MCP connection. Prevent direct model access to an unguarded payment tool, and ensure the actual signed resource, amount, recipient, network and asset match the reviewed terms. If that boundary cannot be enforced, hold and use an explicitly hookable payment path. Asking the agent to call preflight first is insufficient. This is a source-reviewed composition pattern, not a tested live MCP adapter or Coinbase endorsement.

Connection

Add https://api.spendpreflight.com/mcp as a remote Streamable HTTP server in a compatible client. No caller credentials. Client setup screens differ; the JSON-RPC example below exercises the protocol directly. get_service_info is always free. check_payee and preflight_payment use the shared trial first, then x402 payment in _meta.

mcp.mjs
// JSON-RPC requests for a stateless Streamable HTTP MCP connection.
// A client sends initialize, notifications/initialized, then tools/call.
export const initialize = {
  jsonrpc: "2.0", id: 1, method: "initialize",
  params: { protocolVersion: "2025-03-26", capabilities: {}, clientInfo: { name: "spendpreflight-docs", version: "1.0" } },
};
export const initialized = { jsonrpc: "2.0", method: "notifications/initialized" };
export const serviceInfo = { jsonrpc: "2.0", id: 2, method: "tools/call", params: { name: "get_service_info", arguments: {} } };
// POST to https://api.spendpreflight.com/mcp with Content-Type: application/json
// and Accept: application/json, text/event-stream. get_service_info is always free.
Download tested source

Tools and references

check_payee screens a name, domain or wallet; preflight_payment decides a challenge or cart. The check_endpoint tool reads cached public observations for $0.005. Three free resources expose default rules, pricing and trust; two prompts are preflight-before-paying and check-a-merchant. Free-trial exhaustion is an expected quota result, not a successful screen.