UNPKG

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.

199 lines • 7.84 kB
/** * `domains` namespace — ProjectDomain lifecycle. * * Domain operations are project-scoped control-plane actions. They use the * SDK credential provider's server auth (SIWX, control-plane session, or * grant key) and deliberately do not require local project-key cache entries. */ import type { Client } from "../kernel.js"; export type ProjectDomainStatus = "action_required" | "waiting" | "active" | "needs_repair" | "failed"; export type ProjectDomainReceiveStrategy = "auto" | "outbound_only" | "forwarding_mode" | "subdomain_mode" | "full_receive_takeover"; export type ProjectDomainMailboxAddressMode = "primary" | "alias" | "managed" | "none"; export type ProjectDomainActivationMode = "automatic_when_ready" | "manual"; export type ProjectDomainWaitUntil = "active" | "safe" | "receive-active"; export interface ProjectDomainMailboxAddressBinding { local_part: string; mailbox_slug: string; create_mailbox?: boolean; } /** * Declarable connect-time authority. `hosted_dns_zone` opts the domain into a * Run402-hosted DNS zone: the owner makes ONE nameserver change and Run402 * applies every in-zone record (the only workable path for a root domain at * most registrars). Absent means manual DNS. */ export type ProjectDomainAuthorityIntent = "manual_dns" | "hosted_dns_zone"; export interface ProjectDomainDesired { authority?: ProjectDomainAuthorityIntent; web?: { enabled: boolean; target?: string; role?: "primary" | "alias"; }; email?: { send?: { enabled: boolean; }; receive?: { enabled: boolean; strategy?: ProjectDomainReceiveStrategy; resolved_strategy?: ProjectDomainReceiveStrategy; observed_mx_fingerprint?: string; mail_subdomain?: string; }; mailbox_addresses?: { mode: ProjectDomainMailboxAddressMode; addresses: ProjectDomainMailboxAddressBinding[]; /** Every active mailbox of the project receives at its slug on this domain (domain-wide receive strategies only). */ all_mailboxes?: boolean; /** * Slug of the mailbox that catches every local part no binding or mailbox * owns, and may send as any of them (`from_address`). Only beside * `all_mailboxes: true` on `full_receive_takeover` or `subdomain_mode`; * `null` clears it. */ catch_all?: string | null; }; activation?: ProjectDomainActivationMode; }; } export interface ProjectDomainCheck { id: string; status: "unknown" | "pending" | "passed" | "failed" | "drifted" | "blocked"; blocking: boolean; reason_code?: string; summary?: string; blocked_by?: string[]; checked_at?: string; } export interface ProjectDomainDnsRecord { id: string; purpose: string; type: string; name: string; value: string; priority?: number; required: boolean; status: "unknown" | "missing" | "present" | "conflict"; safety: { safe_to_auto_run: boolean; confirmation_required: boolean; destructive: boolean; external_required: boolean; conflict_policy?: string; [key: string]: unknown; }; bind?: string; } export interface ProjectDomainNextAction { type: string; method?: string; path?: string; auth?: string; why?: string; safe_to_auto_run?: boolean; destructive?: boolean; confirmation_required?: boolean; external_required?: boolean; affected_record_ids?: string[]; [key: string]: unknown; } export interface ProjectDomainReceiveTest { id: string; local_part: string; address: string; target_managed_address: string; token: string; status: "pending" | "passed" | "failed" | "stale"; created_at: string; passed_at?: string | null; } export interface ProjectDomainHostedZone { dns_hosting: "run402_hosted"; status: "provisioning" | "awaiting_delegation" | "delegated" | "releasing"; /** The nameserver pair to set at the registrar — the one customer-side step. */ ns_assigned: string[]; /** Pre-existing MX/TXT copied into the zone before the change was recommended, named at or under this domain. */ imported_records: Array<{ type: string; name: string; value: string; priority?: number; }>; } /** What `disconnect` did. The hosted-zone fields appear only for a domain a Run402-hosted DNS zone served. */ export interface ProjectDomainDisconnectResult { status: string; domain: string; /** `true`: the zone is being deleted with the organization's last domain under it, and DNS stops resolving until nameservers are re-pointed. `false`: the zone stays. */ hosted_zone_released?: boolean; /** The zone stays because other domains of the organization are still connected under it. */ hosted_zone_retained?: true; /** What happened to the zone, in words. */ warning?: string; } export interface ProjectDomain { project_id: string; domain: string; status: ProjectDomainStatus; desired: ProjectDomainDesired; observed: Record<string, unknown>; effective: Record<string, unknown>; authority: { recommended_mode: string; options: Array<Record<string, unknown>>; }; dns_records: ProjectDomainDnsRecord[]; checks: ProjectDomainCheck[]; /** Ordered follow-ups; `next_actions[0]` is the recommended action. */ next_actions: ProjectDomainNextAction[]; /** Present only for a domain served by a Run402-hosted DNS zone of the project's organization. */ hosted_zone?: ProjectDomainHostedZone | null; provenance: { project: "server_control_plane"; desired: "server_control_plane"; observed_dns: "authoritative_nameservers"; effective: "run402_control_plane"; local_cache: "not_used"; }; created_at?: string; updated_at?: string; } export interface ProjectDomainListResult { domains: ProjectDomain[]; } export interface ProjectDomainConnectInput { /** The domain to connect, e.g. `example.com` or `app.example.com`. */ domain: string; /** Desired web / email state for the domain. */ desired: ProjectDomainDesired; } export interface ProjectDomainTestReceiveResult extends ProjectDomain { receive_test: ProjectDomainReceiveTest; } export interface ProjectDomainWaitOptions { until?: ProjectDomainWaitUntil; timeoutMs?: number; intervalMs?: number; } export type DomainRequestOptions = Record<string, never>; export declare class Domains { private readonly client; constructor(client: Client); /** * Connect a custom domain to a project, or change what an already-connected * domain should serve: `POST /projects/v1/:project_id/domains { domain, desired }`. * Returns the ProjectDomain state with `dns_records` and `next_actions`. */ connect(projectId: string, input: ProjectDomainConnectInput): Promise<ProjectDomain>; get(projectId: string, domain: string): Promise<ProjectDomain>; list(projectId: string): Promise<ProjectDomainListResult>; check(projectId: string, domain: string): Promise<ProjectDomain>; apply(projectId: string, domain: string): Promise<ProjectDomain>; repair(projectId: string, domain: string): Promise<ProjectDomain>; testReceive(projectId: string, domain: string, to: string): Promise<ProjectDomainTestReceiveResult>; activate(projectId: string, domain: string): Promise<ProjectDomain>; disconnect(projectId: string, domain: string): Promise<ProjectDomainDisconnectResult>; wait(projectId: string, domain: string, opts?: ProjectDomainWaitOptions): Promise<ProjectDomain>; } //# sourceMappingURL=domains.d.ts.map