Use a separate wallet, private key, endpoint, and payment policy for each environment. Do not reuse
Staging payment material in Production, or the reverse.
Use the Staging guide for the login, API-key, smoke, and Base Sepolia
test flow.
Use MCP Client Guides for exact setup in Codex, Claude, GitHub
Copilot, VS Code, Cursor, Devin, Windsurf, Gemini CLI, Kiro, Continue, Cline, Roo Code, Zed,
Amazon Q Developer, JetBrains, Raycast, LM Studio, OpenCode, Warp, LibreChat, goose, and Cherry
Studio. The guide also states the current ChatGPT web and Claude web authentication boundaries.
Choose A Transport
The stdio bridge requires a checkout of this repository and a supported Node.js runtime. It
forwards MCP requests to the hosted endpoint. It is not a local PubFi backend.
Tools
pubfi.capabilities.listpubfi.capabilities.getpubfi.route.execute
Execution Modes
Public handshake and introspection methods, such asinitialize, ping, tools/list,
resources/list, resources/templates/list, prompts/list, and notifications/initialized,
can be called without a key.
pubfi.route.execute supports two endpoint-separated execution modes:
- The authenticated root accepts one Bearer credential: a
pf_sk_v1_PubFi API key or a Supabase OAuth access token. Both use account admission and allocation. Invalid credentials never fall back to the other credential type or to x402.X-PubFi-Api-Keyis not accepted. - The explicit
/x402endpoint uses a wallet payment for one eligible request. It rejectsAuthorization,X-PubFi-Api-Key, and every other Bearer carrier.
/.well-known/oauth-protected-resource URL for the selected environment. A client that supports
MCP OAuth can use that metadata. A static API-key client can continue to send
Authorization: Bearer <PubFi API key> to the authenticated root.
An agent with a wallet-capable x402 MCP client can pay an eligible
pubfi.route.execute call directly through MCP. It does not need a PubFi account, API key, or a
separate paid HTTP request. The payment uses USDC from the selected wallet and does not create an
invoice or Credits.
Do not pass upstream provider keys as MCP arguments. PubFi leases upstream credentials server-side
when the selected route is callable and configured.
Recommended Agent Flow
- Call
pubfi.capabilities.listand follow every opaquenext_cursorfor one installed generation. Optional exactprovider_keyandmethodfilters must remain unchanged across pages. - Select a capability in the client. PubFi does not rank or select one for you.
- Call
pubfi.capabilities.getwith its exactcapability_idto read the full typed contract. - Inspect the selected method’s
operations[].billing. Callpubfi.route.executefor the exact readyraw_pathandmethod. A priced API-key call consumes its positivecredit_cost; an exactfree_healthoperation is public and has no Credit or x402 charge. - Select the authenticated root with an API key or OAuth access token, or select the
/x402endpoint without a Bearer credential. Never mix those lanes.
Inspect Tool Schemas
Call hostedtools/list for current input and output schemas. Use the
Agent Interface Reference for the stable tool-purpose and field
summary. Do not copy an old schema into a client as permanent authority.
Local Stdio Bridge
The current public-safe local example lives in the source repository at:https://mcp.pubfi.ai. The local file is not a second MCP backend
and it does not run provider logic locally. It is a dependency-free stdio bridge for MCP clients
that launch tools as local commands. The bridge forwards initialize, ping, tools/list, and
authenticated tools/call requests to the hosted Rust MCP endpoint, then writes the response back
to stdio. Other hosted public introspection methods remain available on https://mcp.pubfi.ai;
the local bridge keeps its stdio surface intentionally small.
Accountless x402 Tool Flow
MCP uses the official x402 metadata flow on the explicit/x402 endpoint. It does not return HTTP
402 on the MCP POST and does not use a JSON-RPC payment error.
- Connect to
https://mcp-stg.pubfi.ai/x402orhttps://mcp.pubfi.ai/x402. Callpubfi.route.executewithout Bearer auth and without payment metadata. - For an eligible route, require a normal JSON-RPC success whose
CallToolResulthas:isError: true;- the exact x402 V2
PaymentRequiredobject instructuredContent; and - compact JSON of the same object in
content[0].text.
- Validate the payment requirements and create an x402 V2
PaymentPayloadwith your wallet. - Retry the same tool and arguments. Put the payment object at
params._meta["x402/payment"]. - On success, read the decoded settlement response at
result._meta["x402/payment-response"].
_meta object can also contain unrelated MCP client metadata. Only
_meta["x402/payment"] is a payment carrier. Other _meta entries do not select the payment lane.
Use an x402 MCP client that implements this flow. Do not convert the MCP challenge into a
PAYMENT-SIGNATURE HTTP header yourself. Do not send payment metadata to the authenticated root.
A pinned Staging-only runnable example uses @x402/mcp, @x402/core, @x402/evm, and the MCP SDK
against pubfi.route.execute. It validates a bounded Base Sepolia payment, verifies the signed
offer and receipt through PubFi’s did:web document, and checks exact replay:
free_health, so the pinned payment commands are archival and must not be run:
quantro_priced operation before constructing a new Production payment policy.
The wire shape is:
exact payment path: Registry route, Quantro quote and claim,
provider fence, settlement, Signed Receipt, and exact replay. A replay of the same paid tool call
returns the retained result and payment response without a second provider call, settlement, or
wallet charge. Replay equivalence applies to structuredContent and
result._meta["x402/payment-response"], not to raw JSON-RPC response bytes.
Fail-Closed Behavior
Unsupported paths, methods, non-ready operations, invalid exact query or body bytes, and supplier procurement attempts return explicit gate readbacks rather than silently calling upstream APIs. An unsupported route, invalid payment, or changed replay binding fails closed before a second provider execution. The/x402 endpoint rejects Bearer credentials. The authenticated root
rejects payment metadata. SIWX and anonymous Credits are not part of the current MCP flow.
For detailed tool contracts, continue to the Agent Interface
Reference. For payment metadata and replay policy, continue to
Accountless x402.