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.
45 lines • 2.02 kB
TypeScript
/**
* `r.diagnostics` — anonymous reachability probes, owned by the Node SDK.
*
* `probeOrigin(url)` makes one bounded, unauthenticated `GET` that never
* follows a redirect and never reads more of the body than it must, and
* CLASSIFIES the outcome, so a caller can tell a DNS failure from a TLS
* failure from a redirect from an HTTP error from success — distinctions an
* SDK request (which retries, authenticates, and parses) deliberately
* erases. `r.buzz.doctor()` measures the Run402 API and console origins with
* it; nothing else needs a raw `fetch` of its own for this.
*/
/** How a probe ended. `ok` is a 2xx; `redirect` a 3xx (never followed); `http` any other status. */
export type OriginClassification = "ok" | "dns" | "tls" | "redirect" | "http" | "timeout" | "network";
export interface OriginProbeResult {
/** True exactly for a 2xx. */
reachable: boolean;
classification: OriginClassification;
/** The HTTP status, when a response arrived. */
status?: number;
/** The `Location` of a redirect, when one was answered. */
redirect_to?: string;
/** The failure, classified and bounded (never the raw transport message). */
error?: string;
elapsed_ms: number;
}
export interface ProbeOriginOptions {
/** Abort after this many milliseconds. Default 3000. */
timeoutMs?: number;
/** The `Accept` header sent. */
accept?: string;
}
/** Classify a transport failure from its message, code, and cause. */
export declare function classifyTransportFailure(error: unknown): {
classification: Exclude<OriginClassification, "ok" | "http">;
error: string;
};
export declare class Diagnostics {
/**
* One anonymous `GET` of `url`, bounded by `timeoutMs`, redirects never
* followed, the body discarded. Never throws for a network outcome: every
* failure is a classification.
*/
probeOrigin(url: string | URL, opts?: ProbeOriginOptions): Promise<OriginProbeResult>;
}
//# sourceMappingURL=diagnostics.d.ts.map