run402-mcp
Version:
MCP server for Run402 — full-stack backend infrastructure for AI agents: Postgres, auth, storage, serverless functions and atomic deploys. Paid with x402/MPP. Includes $0.03 image generation.
34 lines • 1.34 kB
JavaScript
/**
* `tier` namespace — set (start / renew / upgrade) the organization's tier
* lease against `/tiers/v1*`. Requires wallet SIWX auth; `set` flows through x402
* for the actual payment.
*/
export class Tier {
client;
constructor(client) {
this.client = client;
}
/** Check the organization's current tier — tier name, status, and lease expiry. */
async status() {
return this.client.request("/tiers/v1/status", {
context: "checking tier status",
});
}
/**
* Set the organization's tier: start, renew, or upgrade the lease. The
* gateway auto-detects the action from the current tier state. Payment flows through the injected fetch (x402 in
* Node with a wallet). Throws {@link PaymentRequired} when the
* wrapper cannot fund the call.
*/
async set(tier, opts = {}) {
return this.client.request(`/tiers/v1/${tier}`, {
method: "POST",
body: {},
// Retry-safety: a caller-supplied key collapses a retried start/renew
// onto one charge. Omitted by default — tier renewal is not auto-keyed.
...(opts.idempotencyKey ? { headers: { "Idempotency-Key": opts.idempotencyKey } } : {}),
context: "setting tier",
});
}
}
//# sourceMappingURL=tier.js.map