@openx402/mcp-server is a separate agent-facing process. It consumes the
facilitator’s public discovery HTTP API and never imports facilitator internals
or connects to the facilitator database. The facilitator can run without it.
The hosted profile is discovery-only (signer.mode: none), so it registers
search and get. The paid call tool is registered only when a signer is
configured. This is deliberate: a public MCP endpoint must not accidentally
hold a payer key.
Transports and endpoints
Remote transports require bearer authentication whenever a signer is enabled.
Discovery-only remote deployments may remain public. Configure keys through the
environment variable named by
http.api_keys_env.
x402_search_resources
Search or browse the facilitator’s canonical Bazaar catalog.
query selects /discovery/search; without it the
tool browses /discovery/resources. Supported filters are type, network,
scheme, payTo, asset, and extensions.
The tool returns:
ref encodes the exact identity tuple:
(type, resource URL, toolName) for MCP or (type, resource URL) for HTTP.
An empty result is a structured NO_RESULTS error rather than an empty success
payload, so an agent can distinguish “nothing matched” from a transport failure.
x402_get_resource
Resolve a stable reference and read the current canonical resource:
status: "stale" and a warning. A malformed reference or missing active entry
returns INVALID_ARGUMENT or NO_RESULTS; this tool never fetches an arbitrary
URL supplied by an agent.
x402_call_resource
This tool is available only with a configured signer and only calls cataloged
MCP resources. It accepts:
- Resolve the reference and require the active catalog version.
- Reject a changed
expectedVersionHashbefore any network call or signing. - Resolve a connectable MCP endpoint and apply SSRF-safe DNS/IP checks.
- Call the declared tool without payment using exactly the supplied arguments.
- Validate both x402
PaymentRequiredcopies in the MCP metadata. - Compare resource URL, tool name, transport, input schema, selected network, scheme, asset, recipient, amount, timeout, and extension data with the catalog version.
- Reserve the local budget before constructing or signing anything.
- Create one Payment Identifier for this logical invocation.
- Sign one canonical x402 payment and retry the same tool call once.
- Validate the settlement response’s success, network, payer, amount, and transaction metadata.
- Reconcile the reservation and return the upstream tool output plus receipt.
Error contract
Every failure is JSON withschemaVersion, code, message, retryable,
and optional details. Agents branch on code, not prose. The stable codes are:
SETTLEMENT_UNKNOWN is not permission to authorize a second payment. The
reservation remains held until an operator or a future polling path resolves it.
Signer and budget modes
No tool schema accepts secret material. The budget store uses decimal strings at
the boundary and
bigint internally. The effective cap is the minimum of the
per-call limit, remaining session/day limit, selected x402 amount or maximum,
and any known smart-account policy ceiling. Exact payments cannot be reduced;
an insufficient cap returns BUDGET_EXCEEDED. Upto remains interface-ready
but fails closed until a reusable Stellar client is available upstream.
Remote pubnet paid calls additionally require explicit pubnet enablement,
authenticated access, a signer, and a PostgreSQL budget store. This prevents a
restart or replica from losing the spend ledger.
Network security
Outbound MCP connections pin DNS resolution for the request, block loopback, private, link-local, cloud-metadata, and multicast ranges, require HTTPS unlessallow_insecure_local is explicitly enabled, cap redirects, cap response bytes,
bound JSON depth and timeouts, and limit concurrent connections. mcp://
identifiers are symbolic; they are rejected unless the operator maps them to a
verified HTTPS endpoint in resolved_mcp_endpoints.
The server probes a seller with initialize and tools/list, never tools/call.
Seller descriptions, schemas, and outputs remain inert data and are never fed
into an instruction-generating model.
See MCP guide, smart accounts, and
configuration for deployment examples.