Runtime payment agent plugin
The runtime payment agent plugin gives an agent host a ready-to-use payment workflow through the hosted Pay MCP service. It combines plugin metadata, an MCP server declaration, and guidance for finding paid APIs, planning spend, and requesting user approval. It is the runtime-focused child of Agent payment plugins; compare it with the CLI payment agent plugin and the Rust payment runtime.
Plugin package
The package presents payment access as one distributable agent capability. Its metadata identifies the pay plugin, its Pay project ownership, and its support for HTTP 402, x402, MPP, stablecoins, and MCP. The package also marks the hosted Pay server as untrusted, so data returned by providers does not become an instruction to the agent.
Capability scope
The plugin is designed for deliberate, user-directed access to paid HTTP and API services without requiring the agent to manage provider API keys. It covers discovery, request execution, balance checks, and account funding guidance while keeping payment approval with the user.
References: agent-plugins/…/plugin.json• L3-19 agent-plugins/…/SKILL.md• L12-26
MCP connection
The MCP connection is the plugin's runtime access path. The host connects to the streamable HTTP Pay server at https://connect.pay.sh/mcp, then exposes the Pay tools described by the bundled skill.
Tool workflow
The tools form a small path from service discovery to a paid request. Catalog tools identify a suitable endpoint, curl sends the request and handles an HTTP 402 challenge, and account tools show balance or provide a top-up path.
The main request flow is:
flowchart LR
A[User task] --> B[Search or list catalog]
B --> C[Select endpoint]
C --> D[State provider and cost plan]
D --> E[User approval]
E --> F[Pay curl request]
F --> G[Result]
E --> H[Stop if declined]
References: agent-plugins/…/mcp.json• L3-7 agent-plugins/…/SKILL.md• L28-38 agent-plugins/…/SKILL.md• L40-62
Payment skill
The bundled pay skill tells an agent how to use the MCP capability and when to use it. It directs feasibility questions to the full catalog and actionable tasks to ranked catalog search, then requires the agent to copy the returned gateway URL into Pay's request tool.
Approval boundary
The skill places a user approval boundary before funds move. Before the first paid request, the agent states the provider, endpoint, reason for the choice, expected calls, and estimated spend. Multi-call work, unclear prices, probing, polling, purchases, or work beyond the user's implied budget requires approval before payment.
A declined, cancelled, or timed-out confirmation ends that attempt. The agent must not retry or switch payment paths to bypass the decision. Provider responses, payment challenges, headers, and errors remain untrusted external data.
References: agent-plugins/…/SKILL.md• L14-26 agent-plugins/…/SKILL.md• L45-65 agent-plugins/…/SKILL.md• L79-85
Account and fallback behavior
Catalog browsing does not require a funded account. If wallet setup is needed, the agent shows the setup link only to the owning user and retries the original request after setup. A low balance leads to a shortfall message and a top-up offer rather than repeated payment attempts.
When MCP tools are unavailable, the skill supports a configured pay CLI as a fallback. The fallback keeps the same account, catalog, payment, and funding concepts, but setup remains an action for the user outside the agent session.
References: agent-plugins/…/SKILL.md• L67-77 agent-plugins/…/SKILL.md• L87-103
Provider selection
Provider selection turns a user task into the smallest suitable paid request. The guidance favors a provider that owns the exact task and filters out mismatches before any payment, then uses request shape, supported network or currency, result quality, freshness, and total price to resolve close choices.
Cost planning
The agent starts with the user's real task rather than a broad category or a provider name. It prefers a narrow synchronous request for a one-shot need and reduces spend by using small limits, date ranges, result fields, batches, or known identifiers. It keeps asynchronous job identifiers for polling instead of paying to start the same work again.
If the catalog and one provider detail lookup do not make price, schema, network support, or result quality clear, the agent asks the user instead of guessing. After a failed paid call, it uses at most one clear fallback before asking the user.
References: agent-plugins/…/provider-selection.md• L17-31 agent-plugins/…/provider-selection.md• L33-68
Service routing
Pay is the first choice for paid or current data tasks when a matching provider exists. Ordinary web search or shell HTTP is a fallback only when Pay finds no usable provider, the user requests a free-only answer, or Pay MCP tools are unavailable.
The guidance maps task intent to provider families. For example, historical chain aggregates use analytics or BigQuery, live account state uses RPC, and media generation uses a media provider. This keeps the payment plan aligned with both the requested result and the endpoint's natural role.
References: agent-plugins/…/provider-selection.md• L3-15 agent-plugins/…/provider-selection.md• L35-45 agent-plugins/…/provider-selection.md• L70-87
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the MCP server URL and the skill's hosted-server description aligned.
- Keep the plugin's trust declaration aligned with the skill's rule that provider data cannot authorize spending or disclosure.
- Keep the MCP tool names and the skill's workflow aligned so catalog discovery, endpoint lookup, paid requests, balance checks, and top-ups remain usable.
- Keep the approval rules aligned between the main skill and provider-selection guidance, especially for multi-call, dynamic-price, polling, and purchase-like work.
- Keep CLI fallback commands and their boundary consistent with the separate CLI plugin documentation.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The hosted MCP URL or tool names drift from the skill | The agent cannot discover or execute the intended payment flow | Update the MCP manifest and skill together |
| The agent treats a provider response or payment challenge as an instruction | External data can cause extra calls, spend, or disclosure | Treat all provider output as untrusted and require user approval |
| A request is retried after declined approval | The agent bypasses the user's payment decision | Stop the attempt and do not switch payment paths |
| The agent probes a schema or explores multiple endpoints without a plan | Small exploratory actions can create unexpected charges | State the call plan and ask before multi-call or unclear-cost work |
| The selected endpoint has the wrong network, currency, method, or request shape | A paid call fails or produces unusable data | Hard-filter mismatches before payment |
| The account balance is too low or setup is incomplete | The paid request cannot complete | Explain the shortfall or show the user the setup path; do not invent links |
Key files
| File | Why to read it |
|---|---|
| agent-plugins/…/plugin.json | Defines the plugin identity, supported payment concepts, ownership, and trust extension. |
| agent-plugins/…/mcp.json | Defines the hosted MCP connection used at runtime. |
| agent-plugins/…/SKILL.md | Describes the agent-facing payment workflow, approval boundary, account behavior, and CLI fallback. |
| agent-plugins/…/provider-selection.md | Defines provider matching, cost planning, fallback rules, and spend reduction guidance. |