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.
19 lines • 997 B
JavaScript
import { ApiError, isRun402Error } from "./errors.js";
/** Client diagnostic only: the original PostgREST body/status remain available. */
export class RestPermissionDenied extends ApiError {
code = "REST_PERMISSION_DENIED";
details;
constructor(error, method, relation) {
super("PostgREST denied this operation; check grants and policies for the request role.", error.status, error.body, error.context);
this.details = { source: "postgrest", upstream_status: error.status, upstream_code: "42501", method, relation };
}
}
export function restDiagnostic(error, method, relation) {
if (!isRun402Error(error))
return error;
const body = error.body;
// Only the public native SQLSTATE is interpreted. Never parse private schema
// names out of upstream text or infer exposure/RLS from permission denial.
return body?.code === "42501" ? new RestPermissionDenied(error, method, relation) : error;
}
//# sourceMappingURL=rest-diagnostics.js.map